不和Bot将无法登录服务器



我首先要说的是,我对不和谐机器人的制作有点陌生。我只是想让机器人在这一点上联机,我一直得到错误:

TypeError [CLIENT_MISSING_INTENTS]:必须为客户端提供有效的意图。

在客户端。_validateOptions (C:UserslevanDesktopDiscordbotnode_modules←[4mcord .js←[24msrcclient client .js:544:13)
at new client (C:UserslevanDesktopDiscordbotnode_modules←[4mcord .js←[24msrcclient client .js:73:10)
at Object。(C:UserslevanDesktopDiscordbotmain.js:3:16)←[90m
at Module.)_compile(节点:内部/模块/cj/装载机:1101:14)←(39 m

←[90m    

at Object.Module._extensions. js (node:internal/modules/cjs/loader:1153:10)←[39m

←[90m    

模块。负载(节点:内部/模块/cj/装载机:981:32)←(39 m

`←[90m    at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39`m

←[90m at Function.executeUserEntryPoint [as runMain] ``(node:internal/modules/run_main:79:12)←[39m

←[90m    at node:internal/main/run_main_module:17:47←[39m {
[←[32mSymbol(code)←[39m]: ←[32m'CLIENT_MISSING_INTENTS'←[39m
}

到目前为止这是我得到的


const Discord = require('discord.js');
const client = new Discord.Client();

client.once('ready', () => {
console.log('Tec Control Bot is online!');
});

client.login('redacted sign in key');

所以,你使用的是discord.js v13,这与之前的v12版本有很大不同。在v13中,必须添加意图。

你可以在这里阅读更多信息:

新的Discord版本V13需要您设置您的bot将使用的意图。

首先,你可以访问https://ziad87.net/intents/,在那里你可以选择你想要的意图并给你一个数字,你应该像这样使用这个数字:

const intents = new Discord.Intents(INTENTS NUMBER);
const client = new Discord.Client({ intents });

例如,如果你想要所有的意图,你将有:

const intents = new Discord.Intents(32767);
const client = new Discord.Client({ intents });

最新更新