相关疑难解决方法(0)

升级到 v14 时 Discord.js v13 代码中断

我刚刚将 Discord.js 从 v13 更新到 v14,但有很多错误。

message和事件的错误interaction

message事件也都没有发生interaction

意图错误:

const client = new Client({
  intents: [
    Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MESSAGES,
    Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
  ],
});
//     Intents.FLAGS.GUILDS,
//            ^
//
// TypeError: Cannot read properties of undefined (reading 'FLAGS')

const client = new Client({
  intents: ['GUILDS', 'GUILD_MEMBERS', 'GUILD_MESSAGES'],
});
//    throw new RangeError(ErrorCodes.BitFieldInvalid, bit);
//
// RangeError [BitFieldInvalid]: Invalid bitfield flag or number: GUILDS.
Run Code Online (Sandbox Code Playgroud)

s的错误interaction

if (interaction.isCommand()) {}
// TypeError: interaction.isCommand is not a function

if …
Run Code Online (Sandbox Code Playgroud)

javascript node.js discord discord.js

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

discord ×1

discord.js ×1

javascript ×1

node.js ×1