BitFieldInvalid djs 14.15.3

RangeError [BitFieldInvalid]: Invalid bitfield flag or number: SEND_MESSAGES.
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: SEND_MESSAGES.
ℹ️ [email protected]
if (!interaction.member.permissions.has(PermissionsBitField.Flags.SendMessages, true)) {
return interaction.followUp({ content: 'You do not have permission to send messages.' });
}

if (!interaction.guild.members.me.permissions.has(PermissionsBitField.Flags.SendMessages, true)) {
return interaction.followUp({ content: 'I do not have permission to send messages.' });
}
if (!interaction.member.permissions.has(PermissionsBitField.Flags.SendMessages, true)) {
return interaction.followUp({ content: 'You do not have permission to send messages.' });
}

if (!interaction.guild.members.me.permissions.has(PermissionsBitField.Flags.SendMessages, true)) {
return interaction.followUp({ content: 'I do not have permission to send messages.' });
}
Help me please
7 Replies
d.js toolkit
d.js toolkit4mo ago
- 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 OP
Mark
Mark4mo ago
error doesn't match the code you provided. did you save your file and restart? what's the full error including stack?
Gabizoc
GabizocOP4mo ago
node:events:496
throw er; // Unhandled 'error' event
^

RangeError [BitFieldInvalid]: Invalid bitfield flag or number: SEND_MESSAGES.
at PermissionsBitField.resolve (C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\node_modules\discord.js\src\util\BitField.js:174:11)
at C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\node_modules\discord.js\src\util\BitField.js:168:35
at Array.map (<anonymous>)
at PermissionsBitField.resolve (C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\node_modules\discord.js\src\util\BitField.js:168:18)
at PermissionsBitField.has (C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\node_modules\discord.js\src\util\BitField.js:60:28)
at PermissionsBitField.has (C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\node_modules\discord.js\src\util\PermissionsBitField.js:92:82)
at Client.<anonymous> (C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\events\interactionCreate.js:41:55)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:401:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
code: 'BitFieldInvalid'
}

Node.js v20.11.1
node:events:496
throw er; // Unhandled 'error' event
^

RangeError [BitFieldInvalid]: Invalid bitfield flag or number: SEND_MESSAGES.
at PermissionsBitField.resolve (C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\node_modules\discord.js\src\util\BitField.js:174:11)
at C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\node_modules\discord.js\src\util\BitField.js:168:35
at Array.map (<anonymous>)
at PermissionsBitField.resolve (C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\node_modules\discord.js\src\util\BitField.js:168:18)
at PermissionsBitField.has (C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\node_modules\discord.js\src\util\BitField.js:60:28)
at PermissionsBitField.has (C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\node_modules\discord.js\src\util\PermissionsBitField.js:92:82)
at Client.<anonymous> (C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\events\interactionCreate.js:41:55)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:401:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
code: 'BitFieldInvalid'
}

Node.js v20.11.1
// Vérification des permissions
if (!interaction.guild || !interaction.member) {
return interaction.followUp({ content: 'This command can only be used in a server.' });
}

if (!interaction.member.permissions.has(PermissionsBitField.Flags.SendMessages, true)) {
return interaction.followUp({ content: 'You do not have permission to send messages.' });
}

if (!interaction.guild.members.me.permissions.has(PermissionsBitField.Flags.SendMessages, true)) {
return interaction.followUp({ content: 'I do not have permission to send messages.' });
}

if (!interaction.member.permissions.has(cmd.userPermissions || [])) {
return interaction.followUp({ content: 'You do not have the required permissions to run this command.' });
}

if (!interaction.guild.members.me.permissions.has(cmd.botPermissions || [])) {
return interaction.followUp({ content: `I need the following permissions to run this command: [${cmd.botPermissions}]` });
}

cmd.run(client, interaction, args);
}
// Vérification des permissions
if (!interaction.guild || !interaction.member) {
return interaction.followUp({ content: 'This command can only be used in a server.' });
}

if (!interaction.member.permissions.has(PermissionsBitField.Flags.SendMessages, true)) {
return interaction.followUp({ content: 'You do not have permission to send messages.' });
}

if (!interaction.guild.members.me.permissions.has(PermissionsBitField.Flags.SendMessages, true)) {
return interaction.followUp({ content: 'I do not have permission to send messages.' });
}

if (!interaction.member.permissions.has(cmd.userPermissions || [])) {
return interaction.followUp({ content: 'You do not have the required permissions to run this command.' });
}

if (!interaction.guild.members.me.permissions.has(cmd.botPermissions || [])) {
return interaction.followUp({ content: `I need the following permissions to run this command: [${cmd.botPermissions}]` });
}

cmd.run(client, interaction, args);
}
Mark
Mark4mo ago
at Client.<anonymous> (C:\Users\gabiz\3D Objects\Discord Bot - Autres\WinBot\events\interactionCreate.js:41:55)
what's line 41
Gabizoc
GabizocOP4mo ago
if (!interaction.guild.members.me.permissions.has(cmd.botPermissions || [])) { return interaction.followUp({ content: I need the following permissions to run this command: [${cmd.botPermissions}] }); } ha hum very sorry
Mark
Mark4mo ago
and what is cmd.botPermissions
Gabizoc
GabizocOP4mo ago
😅 sorry and thank's
Want results from more Discord servers?
Add your server