意图不断给我一个错误,即使意图代码是来自工作机器人的 C&P
Intents keep giving me a error even though the intents code is a C&P from a working bot
我试过这个,它是从我的另一个机器人复制和粘贴的
const client = new Discord.Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.GUILD_PRESENCES,
],
})
错误:
ReferenceError: Intents is not defined
简单地说,您应该通过这样做来定义意图:
const { Client, Intents } = require('discord.js')
编辑:您不需要在 discord.js v13 上使用 Discord
,因为它不需要,而是这样做:
const { Client, Intents } = require('discord.js')
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.GUILD_PRESENCES,
],
})
我试过这个,它是从我的另一个机器人复制和粘贴的
const client = new Discord.Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.GUILD_PRESENCES,
],
})
错误:
ReferenceError: Intents is not defined
简单地说,您应该通过这样做来定义意图:
const { Client, Intents } = require('discord.js')
编辑:您不需要在 discord.js v13 上使用 Discord
,因为它不需要,而是这样做:
const { Client, Intents } = require('discord.js')
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.GUILD_PRESENCES,
],
})