Running a discord.js node keeps returning ReferenceError: Intents is not defined(运行 discord.js 节点不断返回 ReferenceError: Intents is not defined)
问题描述
我是制作 Discord.js 机器人的绝对初学者.目前我正在尝试第一次运行教程机器人,但我不断收到 ReferenceError: Intents is not defined for the following source code.
I am an absolute beginner to making a Discord.js bot. Currently I'm trying to run a tutorial bot for the first time but I keep getting ReferenceError: Intents is not defined for the following source code.
const Discord = require('discord.js');
const client = new Discord.Client({ intents: [Discord.Intents.FLAGS.DIRECT_MESSAGES, Discord.Intents.FLAGS.GUILD_MESSAGES] });
client.once('ready', () => {
console.log('Ready!');
});
client.login('token here');
这是我的完整错误日志:
Here's my full error log:
ReferenceError: Intents is not defined
at Object.<anonymous> (C:UsersduybasourceDiscordBotmain.js:2:47)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
感谢您的关注.
推荐答案
目前版本为 13.1.0.您必须从包中导入标志.
In version 13.1.0 at this date. You must import the flags from the package.
const { Client, Intents } = require('discord.js');
如图所示
这篇关于运行 discord.js 节点不断返回 ReferenceError: Intents is not defined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:运行 discord.js 节点不断返回 ReferenceError: Intents
基础教程推荐
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
