V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
xcmkxcmk81
V2EX  ›  问与答

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

  •  
  •   xcmkxcmk81 · 2022-11-19 22:38:40 +08:00 · 1681 次点击
    这是一个创建于 733 天前的主题,其中的信息可能已经有所发展或是发生改变。
    有没有大佬 开发过 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);

    求教
    1 条回复    2023-05-11 23:36:47 +08:00
    leslie2leslie
        1
    leslie2leslie  
       2023-05-11 23:36:47 +08:00
    你解决了吗老哥?我也有同样的问题
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   987 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 21:16 · PVG 05:16 · LAX 13:16 · JFK 16:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.