Invalid bitfield flag or number: undefined.
WHAT DOES THIS EVEN MEANS
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 OPshow the full error
because this is not the code that throws it
Started refreshing application (/) commands.
Successfully reloaded application (/) commands.
node:events:496
throw er; // Unhandled 'error' event
^
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined.
at PermissionsBitField.resolve (/home/authtbh/mirai/node_modules/discord.js/src/util/BitField.js:174:11)
at PermissionsBitField.has (/home/authtbh/mirai/node_modules/discord.js/src/util/BitField.js:60:28)
at PermissionsBitField.has (/home/authtbh/mirai/node_modules/discord.js/src/util/PermissionsBitField.js:92:82)
at purge (/home/authtbh/mirai/libs/purgeFunction.js:22:33)
at Client.<anonymous> (/home/authtbh/mirai/index.js:82:13)
at Client.emit (node:events:518:28)
at MessageCreateAction.handle (/home/authtbh/mirai/node_modules/discord.js/src/client/actions/MessageCreate.js:28:14)
at module.exports [as MESSAGE_CREATE] (/home/authtbh/mirai/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/authtbh/mirai/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
at WebSocketManager.<anonymous> (/home/authtbh/mirai/node_modules/discord.js/src/client/websocket/WebSocketManager.js:239:12)
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.12.2
[nodemon] app crashed - waiting for file changes before starting...
whats purgefunction.js line 22
const isWhitelistedUser = await isWhitelisted(interaction.user.id);
and what does that function do
check the db
if the user is whitelisted
is your code saved. because i see you importing PermissionsBitField but never using it
autosave
so yes
where tf am i importing it
the top
are you sure it is saved
because the error is either from that or invalid intents
lemme just do small changes real quick
yeah those arent valid permissions
did you ask ai to write that
hell yeah
this is exactly why you shouldnt do that
write your own code and use the docs
alright wait lemme try it myself
..no
where did you get that from
:class: PermissionsBitField
@14.16.1
Data structure that makes it easy to interact with a permission bitfield. All GuildMembers have a set of permissions in their guild, and each channel in the guild may also have PermissionOverwrites for the member that override their default permissions.😭
if (
!message.member.permissions.has(PermissionsBitField.Flags.MANAGE_MESSAGES)
)
shouldnt it work
those are discord docs
i linked you the docs
read them
holy shit
ManageMessages
worked
ily