(節點版本:14.17.6)
當我在終端輸入node . ,它給了我這個問題:
當我在終端輸入 拋出新的型別錯誤('CLIENT_MISSING_INTENTS')。
^ TypeError [CLIENT_MISSING_INTENTS]。必須為客戶端提供有效的intents。
在 Client._validateOptions(C:UsersDELLDesktopDiscord Bot
ode_modulesdiscord.jssrcclientClient.js:544:13)
在new Client(C:UsersDELLDesktopDiscord Bot
ode_modulesdiscord.jssrcclientClient.js:73:10)
在Object. (C:UsersDELLDesktopDiscord Botindex.js:2:13)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions.js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
[Symbol(code)]: 'CLIENT_MISSING_INTENTS'
} 我在VSC中寫道: uj5u.com熱心網友回復: 客戶端沒有意圖
這些將是你的主要內容
標籤:node.
const Discord = require('discord.js');
const bot = new Discord.Client()。
const token ='MY TOKEN'。
bot.on('ready', ( ) =>{
console.log('此機器人已上線!')。
})
bot.on("message", msg=> {
if (msg.content == "HELLO"){
msg.reply('HELLO FRIEND! ')。
}
})
bot.login(token)。
let bot = new Discord. Client({ intents: ["GUILDS", "GUILD_MESSAGES"] })
