【问题标题】:Discord bot not runningDiscord 机器人未运行
【发布时间】:2021-04-19 16:47:21
【问题描述】:

所以,我正在创建一个不和谐的机器人,昨天它刚刚停止运行。所以我在看这里,有人说要处理错误。有了这个所以我试了一下。

bot.on('error', (e) => console.error(e));
bot.on('warning', (e) => console.warn(e));
bot.on('debug', (e) => console.info(e));

现在我明白了

Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
    URL: wss://gateway.discord.gg
    Recommended Shards: 1
[WS => Manager] Session Limit Information
    Total: 1000
    Remaining: 1000
[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
    Gateway    : wss://gateway.discord.gg/
    Version    : 6
    Encoding   : json
    Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CLOSE]
    Event Code: 1006
    Clean     : false
    Reason    : No reason received
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] WS State: CLOSED
[WS => Shard 0] Failed to connect to the gateway, requeueing...
[WS => Manager] Shard Queue Size: 1; continuing in 5 seconds...
[WS => Manager] Session Limit Information
    Total: 1000
    Remaining: 1000
[WS => Shard 0] [CONNECT]
    Gateway    : wss://gateway.discord.gg/
    Version    : 6
    Encoding   : json
    Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CLOSE]
    Event Code: 1006
    Clean     : false
    Reason    : No reason received
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] WS State: CLOSED
[WS => Shard 0] Failed to connect to the gateway, requeueing...
[WS => Manager] Shard Queue Size: 1; continuing in 5 seconds...

在我的终端中,机器人仍然没有运行。 有人可以帮我吗?

【问题讨论】:

  • 你的机器人代码是什么,请提供更多详细信息

标签: javascript discord.js


【解决方案1】:

我相信您遇到的问题已直接列在控制台中。您将碎片设置为 0,或者根本不生成任何碎片。这显示在控制台中:

[WS => Manager] Spawning shards: 0

要解决此问题,我建议关注this guide,它涵盖了分片的内容、方式和时间。而且,如果您决定使用指南开始分片,请注意 Discord 推荐的分片数量。您可以在控制台中找到此金额。目前,这似乎是 1,如下所示:

[WS => Manager] Fetched Gateway Information
    URL: wss://gateway.discord.gg
    Recommended Shards: 1

【讨论】:

  • 我试过这个,现在我得到“启动的分片 0”,后来我得到“(节点:13)UnhandledPromiseRejectionWarning:错误 [SHARDING_READY_TIMEOUT]:分片 0 的客户端花了太长时间才准备好。”所以它仍然没有启动。
猜你喜欢
  • 2017-10-11
  • 1970-01-01
  • 2019-01-19
  • 2021-08-19
  • 2021-11-08
  • 2020-08-16
  • 2019-11-06
  • 1970-01-01
  • 2021-04-01
相关资源
最近更新 更多