BITFIELD_INVALID is my error and I cant find a fix related to my issue as soon as I run a command any command, just reply to me, also just a side note started happening when I deleted nuke.js
Please if this has happened to you tell me or just if you have the answer Also i need to type mroe so this is unnecessary,,,,,,,
SyntaxError: missing ) after argument list
at wrapSafe (node:internal/modules/cjs/loader:1018:16)
at Module._compile (node:internal/modules/cjs/loader:1066:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.module.exports.run (C:\Users\james\OneDrive\Desktop\Discover2\stru
ctures\command.js:9:22)
at Object.<anonymous> (C:\Users\james\OneDrive\Desktop\Discover2\index.js:13
:10)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
[nodemon] app crashed - waiting for file changes before starting...
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
Loaded 13 commands!
Loadeded 3 events!
This is: Discover Now+#2319
C:\Users\james\OneDrive\Desktop\Discover2\node_modules\discord.js\src\util\BitFi
eld.js:150
throw new RangeError('BITFIELD_INVALID');
^
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.
at Function.resolve (C:\Users\james\OneDrive\Desktop\Discover2\node_modules\
discord.js\src\util\BitField.js:150:11)
at Permissions.has (C:\Users\james\OneDrive\Desktop\Discover2\node_modules\d
iscord.js\src\util\BitField.js:45:28)
at Permissions.has (C:\Users\james\OneDrive\Desktop\Discover2\node_modules\d
iscord.js\src\util\Permissions.js:45:85)
at module.exports (C:\Users\james\OneDrive\Desktop\Discover2\events\message.
js:18:67)
at Client.emit (node:events:376:20)
at MessageCreateAction.handle (C:\Users\james\OneDrive\Desktop\Discover2\nod
e_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\james\OneDrive\Deskto
p\Discover2\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE
.js:4:32)
at WebSocketManager.handlePacket (C:\Users\james\OneDrive\Desktop\Discover2\
node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (C:\Users\james\OneDrive\Desktop\Discover2\node_m
odules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\james\OneDrive\Desktop\Discover2\node_
modules\discord.js\src\client\websocket\WebSocketShard.js:301:10) {
[Symbol(code)]: 'BITFIELD_INVALID'
}
[nodemon] app crashed - waiting for file changes before starting...
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
Loaded 13 commands!
Loadeded 3 events!
This is: Discover Now+#2319
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
Loaded 13 commands!
Loadeded 3 events!
This is: Discover Now+#2319
C:\Users\james\OneDrive\Desktop\Discover2\node_modules\discord.js\src\util\BitFi
eld.js:150
throw new RangeError('BITFIELD_INVALID');
^
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.
at Function.resolve (C:\Users\james\OneDrive\Desktop\Discover2\node_modules\
discord.js\src\util\BitField.js:150:11)
at Permissions.has (C:\Users\james\OneDrive\Desktop\Discover2\node_modules\d
iscord.js\src\util\BitField.js:45:28)
at Permissions.has (C:\Users\james\OneDrive\Desktop\Discover2\node_modules\d
iscord.js\src\util\Permissions.js:45:85)
at module.exports (C:\Users\james\OneDrive\Desktop\Discover2\events\message.
js:18:67)
at Client.emit (node:events:376:20)
at MessageCreateAction.handle (C:\Users\james\OneDrive\Desktop\Discover2\nod
e_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\james\OneDrive\Deskto
p\Discover2\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE
.js:4:32)
at WebSocketManager.handlePacket (C:\Users\james\OneDrive\Desktop\Discover2\
node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (C:\Users\james\OneDrive\Desktop\Discover2\node_m
odules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\james\OneDrive\Desktop\Discover2\node_
modules\discord.js\src\client\websocket\WebSocketShard.js:301:10) {
[Symbol(code)]: 'BITFIELD_INVALID'
}
Here
const { owners } = require("../config");
module.exports = async (client, message) => {
if (!message.guild || message.author.bot) return;
const args = message.content.split(/ +/g);
const command = args.shift().slice(client.prefix.length).toLowerCase();
const cmd = client.commands.get(command) || client.aliases.get(command);
if (!message.content.toLowerCase().startsWith(client.prefix)) return;
if (!cmd) return;
if (!message.guild.me.permissions.has(["SEND_MESSAGES"])) return;
if (cmd.requirements.ownerOnly && !message.author.id.includes(owners)) return;
if (cmd.requirements.userPerms && !message.member.permissions.has(cmd.requirements.userPerms && !message.author.id.includes(owners)))
return message.reply(`you are missing the following permissions: ${missingPerms(message.member, cmd.requirements.userPerms)}`);
if (cmd.requirements.clientPerms && !message.guild.me.permissions.has(cmd.requirements.clientPerms))
return message.reply(`I am missing the following permissions: ${missingPerms(message.guild.me, cmd.requirements.clientPerms)}`)
cmd.run(client, message, args);
}
const missingPerms = (member, perms) => {
const missingPerms = member.permissions.missing(perms)
.map(str => `\`${str.replace(/_/g, ' ').toUpperCase()}\``);
return missingPerms.length > 1 ?
`${missingPerms.slice(0, -1).join(", ")} and ${missingPerms.slice(-1)[0]}` :
missingPerms[0];
}
Permission.has()
expects the first argument to be a PermissionResolvable
, not an array. You should change the line where it says
if (!message.guild.me.permissions.has(["SEND_MESSAGES"])) return;
to
if (!message.guild.me.permissions.has("SEND_MESSAGES")) return;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.