From 0769b442c1416d3690484b0cefa58d7b663166f3 Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Sun, 20 Mar 2022 15:27:09 +0000 Subject: [PATCH] fix: view channel required for joining. Closes #2009 --- plugins/permissions/src/connectToVoiceChannels.ts | 6 +++--- types/shared.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/permissions/src/connectToVoiceChannels.ts b/plugins/permissions/src/connectToVoiceChannels.ts index 26f40fd5e..96b42da8f 100644 --- a/plugins/permissions/src/connectToVoiceChannels.ts +++ b/plugins/permissions/src/connectToVoiceChannels.ts @@ -9,7 +9,7 @@ export default function connectToVoiceChannel(bot: BotWithCache) { channelId, options, ) { - const channel = await bot.channels.get(channelId); + const channel = bot.channels.get(channelId); if (!channel) throw new Error("CHANNEL_NOT_FOUND"); if ( @@ -25,7 +25,7 @@ export default function connectToVoiceChannel(bot: BotWithCache) { // Permissions needed for the bot to connect // CONNECT is needed - const permsNeeded: PermissionStrings[] = ["CONNECT"]; + const permsNeeded: PermissionStrings[] = ["CONNECT", "VIEW_CHANNEL"]; // Check if there is space for the bot if channel has user limit // Having MANAGE_CHANNELS permissions bypasses the limit @@ -38,7 +38,7 @@ export default function connectToVoiceChannel(bot: BotWithCache) { permsNeeded.push("MANAGE_CHANNELS"); } - await requireBotChannelPermissions(bot, channel, permsNeeded); + requireBotChannelPermissions(bot, channel, permsNeeded); return await connectToVoiceChannelOld(guildId, channelId, options); }; diff --git a/types/shared.ts b/types/shared.ts index e8ee1c2d8..465f16187 100644 --- a/types/shared.ts +++ b/types/shared.ts @@ -496,7 +496,7 @@ export enum BitwisePermissionFlags { PRIORITY_SPEAKER = 0x0000000000000100, /** Allows the user to go live */ STREAM = 0x0000000000000200, - /** Allows guild members to view a channel, which includes reading messages in text channels */ + /** Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels */ VIEW_CHANNEL = 0x0000000000000400, /** Allows for sending messages in a channel. (does not allow sending messages in threads) */ SEND_MESSAGES = 0x0000000000000800,