DiscordAPIError[50001]: Missing Access, likely due to missing "send messages" permissions
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:
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.1Pastebin
DiscordAPIError[50001]: Missing Access at handleErrors (/app/nod...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
7 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!you also need ViewChannel
also you can use the permission flags bits to avoid that type assertion
how do you mean? not sure i understand
.has(PermissionFlagsBits.SendMessages)
instead of your current .has()after adding this permission I'm still getting the same error instead of it failing out. could there be other causes? if there aren't any I'll remove the global try catch and see if it helps
the bot doesn't attempt to send messages in threads though
just in channels
but i can add that permission in just in case
like 90% sure. but i'll check for that permission too in case i'm misremembering
threads are also channels btw