当前位置: 首页 > 知识库问答 >
问题:

位字段\u无效的不一致。JSV12

鄢博简
2023-03-14

BITFIELD_INVALID是我的错误,我无法找到与我的问题相关的修复,只要我运行一个命令,任何命令,只要回复我,也只是我删除nuke时开始出现的一个旁注。js

如果你遇到这种情况,请告诉我,或者如果你有答案,我需要键入mroe,这样就没有必要了!!!,,,,

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'
}

这儿呢

const{owner}=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];
}

共有1个答案

华易安
2023-03-14

权限。has()要求第一个参数是PermissionResolvable,而不是数组。你应该在上面写的地方换行

if (!message.guild.me.permissions.has(["SEND_MESSAGES"])) return;

js prettyprint-override">if (!message.guild.me.permissions.has("SEND_MESSAGES")) return;
 类似资料:
  • 我们的QA检测到了一个bug:当旋转Android设备(Droid Turbo)时,发生了以下与RecyclerView相关的崩溃: java.lang.IndexOutOfBoundsException:检测到不一致。无效的物料位置%2(偏移量:%2)。状态:%3 对我来说,这看起来像是RecyclerView内部的一个内部错误,因为我想不出这是由我们的代码直接导致的任何方式... 有人遇到过这

  • 很抱歉,如果这个问题在某个地方得到了回答,但如果有,我找不到。 我正在对字节数组进行一些操作,并注意到当转换无效字符(例如,字节0x9C)时,它被解释为“?”.因此,当我把它转换回一个字节时,结果是0x3F。 我的问题是字节数组的一部分是ASCII,但其他部分是校验和,可能包含像这样的无效字符。为了方便起见,我希望能够将整个数组转换成一个字符串。有没有一种编码方式可以产生正常字符的ASCII码,并

  • 致命异常:检测到java.lang.IndexOutOfBoundsException不一致。无效的物料位置5(偏移量:5)。状态:24 这种撞车的情况太多了!!! 我在布料上弄到的。 DateList是涉及RecyclerView片段: callToServer(带有假输入)首先清除键列表,然后填充它。几毫秒后,将调用callToServer(具有true输入)来再次清除keyList,并填充新

  • 你们能帮我做这个吗 这是我添加片段的代码 但当我从添加的片段中按back时,我出现了这个错误,我的应用程序崩溃了。 为什么会这样?请帮忙。我正在使用两个片段。产品列表fragent和产品详细信息片段

  • 我在MongoDB文档模型上使用Azure CosmoDB,并且在使用DBRefs$id更新一些文档时遇到奇怪的行为 看看这个脚本示例: 然后返回: 如果有人知道发生了什么,我真的很感激。

  • 我们的 QA 检测到一个错误:发生了以下与 RecyclerView 相关的崩溃:' Java . lang . indexoutofboundsexception:检测到不一致。无效的项目位置2(偏移量:2)。状态:3 一个残酷的解决方法可能是在异常发生时捕获它,并从头开始重新创建RecycleverView实例,以避免处于损坏状态。 但是,如果可能的话,我想更好地理解这个问题(也许从根源上修复