请教 discord 机器人开发问题,登录总是失败

2022-11-19 22:38:40 +08:00
 xcmkxcmk81
有没有大佬 开发过 discord 的 bot 啊,我总是遇到如下报错
<> node index.js
RequestAbortedError [AbortError]: Request aborted
at abort (/Users/cx/discord_bot/node_modules/undici/lib/api/abort-signal.js:10:18)
at self.<computed> (/Users/cx/discord_bot/node_modules/undici/lib/api/abort-signal.js:29:5)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:645:20)
at AbortSignal.dispatchEvent (node:internal/event_target:587:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:322:5)
at Timeout.<anonymous> (/Users/cx/discord_bot/node_modules/@discordjs/rest/dist/index.js:515:73)
at listOnTimeout (node:internal/timers:564:17)
at process.processTimers (node:internal/timers:507:7) {
code: 'UND_ERR_ABORTED'
}

代码如下:

const { Client, GatewayIntentBits } = require("discord.js");
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages]
});

const TOKEN =
"MTA0......";

client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`);
});

client.login(TOKEN).catch(console.error);

求教
1680 次点击
所在节点    问与答
1 条回复
leslie2leslie
2023-05-11 23:36:47 +08:00
你解决了吗老哥?我也有同样的问题

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/896492

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX