Skip to content

fix: VC自動作成時の権限問題を修正#28

Merged
tanahiro2010 merged 5 commits intosf-kosen:mainfrom
tanahiro2010:main
Mar 5, 2026
Merged

fix: VC自動作成時の権限問題を修正#28
tanahiro2010 merged 5 commits intosf-kosen:mainfrom
tanahiro2010:main

Conversation

@tanahiro2010
Copy link
Member

This pull request updates the bot's configuration and improves permission handling for dynamically created voice channels. The main changes include adding a member role ID to the configuration and refining how permissions are set when users join voice channels.

Bot configuration update:

  • Added memberId to the role section of botConfig in bot.config.ts to support member role permissions.

Voice channel permission improvements:

  • When creating a new voice channel in vc/join.ts, added permission overwrites to allow members with the member role (memberId) to view and connect to the channel.
  • After channel creation, explicitly set the @everyone role to deny viewing the channel, ensuring privacy for the voice channel.

Copilot AI review requested due to automatic review settings March 5, 2026 10:45
@tanahiro2010
Copy link
Member Author

tanahiro2010 commented Mar 5, 2026

this issue #24

@tanahiro2010
Copy link
Member Author

まだマージ不可

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the bot configuration and adjusts permission overwrites for dynamically created voice channels so that members with a specific “member” role can view/connect, while @everyone is restricted for privacy.

Changes:

  • Add role.memberId to bot.config.ts for member-role-based permissions.
  • Update VC auto-creation in src/handlers/events/vc/join.ts to grant memberId View/Connect and then deny @everyone ViewChannel.
  • Refresh some dependencies in package-lock.json.

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

File Description
src/handlers/events/vc/join.ts Adds member-role allow overwrites and applies an @everyone visibility restriction for new VCs.
bot.config.ts Adds a configured member role ID (memberId) used by VC permission logic.
package-lock.json Dependency lockfile updates (diff/lodash).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +22 to 25
},
{
id: newState.member?.id || newState.member?.user.id || "",
allow: [
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newState.member can be null on VoiceState (e.g., partials). In that case this code will pass an empty string as the overwrite id, which will cause the channel create call to fail (and also produce a channel name with undefined). Add an early guard (e.g., return if !newState.member) and use newState.member.id directly instead of falling back to "".

Copilot uses AI. Check for mistakes.
Comment on lines 34 to 39

await newState.member?.voice.setChannel(channel);
await channel.permissionOverwrites.create(newState.guild.roles.everyone, {
ViewChannel: false,
});
} catch (error) {
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @everyone deny is applied after the channel is created and after moving the member into it. That leaves a window where the new channel may be visible/joinable based on guild default permissions, which undermines the privacy goal. Prefer including the @everyone deny overwrite directly in the initial permissionOverwrites passed to channels.create (and then you can drop the extra API call).

Copilot uses AI. Check for mistakes.
@tanahiro2010 tanahiro2010 merged commit bb05b2a into sf-kosen:main Mar 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants