Hi everyone! This is an error that I get approximately every few days for my 1500+ servers bot:
https://pastebin.com/mpqvFGZz
I suspect that this is occurring because the bot is trying to send a message in a channel that hasn't given it send messages permissions. I try to handle this case in my code with 2 ways: one with a universal try-catch that just prints the error and doesn't error out (which obviously doesn't work) and another like so:
if (
!streamChannel.isDMBased() &&
!streamChannel
.permissionsFor(botGuildMember)
?.has("SendMessages" as PermissionResolvable)
) {
return await channel.send(
`:x: I do not have permission to send messages in ${streamChannel.name}.`
);
}
in this case, channel is the original channel in which an interaction was initialized, and streamChannel is another channel in the server that the bot is, later on, attempting to send a message in. However, I'm not sure why, but this logic doesn't work either, and I'm not sure why.
Any ideas?
discord.js veresion: 14.14.1