#Crash if members do not have a permission.
7 messages · Page 1 of 1 (latest)
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: MANAGE_GUILD.
at Function.resolve (/mnt/DATA/general_programming/CL bot/Club-League-Bot/node_modules/discord.js/src/util/BitField.js:168:11)
at /mnt/DATA/general_programming/CL bot/Club-League-Bot/node_modules/discord.js/src/util/BitField.js:163:54
at Array.map (<anonymous>)
at Function.resolve (/mnt/DATA/general_programming/CL bot/Club-League-Bot/node_modules/discord.js/src/util/BitField.js:163:40)
at PermissionsBitField.has (/mnt/DATA/general_programming/CL bot/Club-League-Bot/node_modules/discord.js/src/util/BitField.js:60:28)
at PermissionsBitField.has (/mnt/DATA/general_programming/CL bot/Club-League-Bot/node_modules/discord.js/src/util/PermissionsBitField.js:92:82)
at Client.<anonymous> (/mnt/DATA/general_programming/CL bot/Club-League-Bot/src/bot.js:157:44)
at Client.emit (node:events:527:28)
at InteractionCreateAction.handle (/mnt/DATA/general_programming/CL bot/Club-League-Bot/node_modules/discord.js/src/client/actions/InteractionCreate.js:81:12)
at Object.module.exports [as INTERACTION_CREATE] (/mnt/DATA/general_programming/CL bot/Club-League-Bot/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:384:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21) {
[Symbol(code)]: 'BITFIELD_INVALID'
So member is a PermissionsBitField in this instance (bad variable naming/would at least need some explanation in your question)
ManageGuild would be a valid value, CamelCase not SCREAMING_SNAKE_CASE
Why did it work when the member actually had the permission tho....
Additionally I was just following the names on the official discord website as the documentation mentioned
Probably because that if wasn’t reached in that case
Don’t know where the documentation says to use those. It refers to discord-api-types PermissionFlagsBits