Invalid bitfield in audit log channel permissions event
Hey,
I currently have the issue that errors like these are sent multiple times a minute into my bot's console:
It seems like this is being sent every time I am trying to parse permissions sent from the Audit Log event ChannelOverwriteCreate/-Update/-Delete.
The code causing this error:
I am not sure why this would suddenly be an issue, especially because Discord sent those bitfield numbers.
5 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 OPPermissions bit field should be a string or a BigInt, not a number.
Oh yeah, it works if I make it a string:
Why does it say in the docs that it accepts a number as well though?
It depends on what the DefaultBit of the BitField is. For PermissionsBitField it's BigInt. And you'll lose some data if you'll use numbers for permissions since it's larger then the MAX_SAFE_NUMBER.
Alright, thank you very much