【发布时间】:2021-11-14 21:40:36
【问题描述】:
(节点版本:14.17.6)
当我在终端输入node . 时,它给了我这个问题:
抛出新的 TypeError('CLIENT_MISSING_INTENTS'); ^
TypeError [CLIENT_MISSING_INTENTS]:必须为客户端提供有效的意图。 在 Client._validateOptions (C:\Users\DELL\Desktop\Discord Bot\node_modules\discord.js\src\client\Client.js:544:13) 在新客户端(C:\Users\DELL\Desktop\Discord Bot\node_modules\discord.js\src\client\Client.js:73:10) 在对象。 (C:\Users\DELL\Desktop\Discord Bot\index.js:2:13) 在 Module._compile (internal/modules/cjs/loader.js:1072:14) 在 Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10) 在 Module.load (internal/modules/cjs/loader.js:937:32) 在 Function.Module._load (internal/modules/cjs/loader.js:778:12) 在 Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 在内部/main/run_main_module.js:17:47 { [符号(代码)]:'CLIENT_MISSING_INTENTS' }
我在 VSC 中写的内容:
const Discord = require('discord.js');
const bot = new Discord.Client();
const token ='MY TOKEN';
bot.on('ready', () =>{
console.log('This bot is online!');
})
bot.on("message", msg=>{
if (msg.content === "HELLO"){
msg.reply('HELLO FRIEND!');
}
})
bot.login(token);
【问题讨论】:
-
我已经修好了
标签: node.js visual-studio-code discord