diff --git a/src/bot.ts b/src/bot.ts index e128773c5b227b0dc2241c265316a8d56010e256..3879c8b8a69b68fb8c994120b4d33d5c2f888435 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -353,6 +353,13 @@ export class DiscordBot { } const channel = guild.channels.get(room); if (channel && channel.type === "text") { + if (hasSender) { + const permissions = channel.permissionsFor(guild.me); + if (!permissions || !permissions.has("VIEW_CHANNEL") || !permissions.has("SEND_MESSAGES")) { + throw new Error(`Can't send into channel`); + } + } + this.ClientFactory.bindMetricsToChannel(channel as Discord.TextChannel); const lookupResult = new ChannelLookupResult(); lookupResult.channel = channel as Discord.TextChannel;