(solved) Strange permissions error inside discordjs that I cant catch and cant replicate?
Once in a while I will receive a strange error from discordjs that will crash my entire bot, and a try/catch block in the area of my code that seems to cause the issue doesnt ever catch the error. Instead it seems to be internal to discordJS and unavoidable.
24 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!
- ✅
Marked as resolved by staffits not an internal error
you just try to send a message to a channel the bot doesnt have access to
Thats the issue... It works sometimes, and doesnt other times
Its inconsistent
Ill run the bot locally on my main rig and send the same identical command to the same channel
and itll work
but wait a week when its running on the main server, and boom it randomly dies after sending a command
does the bot have the ReadMessageHistory permission
its an admin
I use message.reply most of the time, such as this

Oh shit really? huh.. The more you know
but sounds like your bot doesnt have permission to read message history
(or just viewchannel at all)
Bot's internal role

Bot is visible in the channel member list
has full admin on his top level role anyways
:cat_happycry:
and is the channel id 1201565597453009018
1201565597453009018
Copied directly
yup
My personal server. Its just the general channel lol
it doesnt have any fancy permission requirements
ironically the command doesnt error out in my private mod channel
only the general channel
:concernwilde:
And the bot is an admin anyways
so I dont get it lol
:method: BaseGuildVoiceChannel#permissionsFor()
[email protected]
Gets the overall set of permissions for a member or role in this channel, taking into account channel overwrites..toArray that for the bot
log it and show the output
Does the bot have a quick reference to grab the guildmember?
I havent worked on this in months lol, I dont remember immediately
<Guild>.members.me
gotcha

Definitely has readmessagehistory
like, thats the same channel, and that command worked
(its not a slash command, but an internal command... same type as the one that crashes it)
Theyre doing the same thing
So Im not sure why one would inconsistently crash it
Anyways I got all the awaits and stuff in so hopefully that wont kill the bot again next time
but rather just send the error to me

Yup
haha
I genuinely dont get it
it literally sees the message, replied to me
HOW is it failing :kekw:
Code

Oh? perhaps I was mistaken
one moment
Ah
Probably it
Yeah I just appended admin to the bots internal role and that fixed it
lol
so goofy of me
Well, fixed two birds with one stone... Hopefully no more death by permission error