【问题标题】:Discord.js Unknown Guild when removing all roles from a userDiscord.js Unknown Guild 从用户删除所有角色时
【发布时间】:2018-11-29 05:51:13
【问题描述】:

我正在尝试删除用户的所有角色。这段代码昨天有效,但我今天上了,它不知何故坏了。

message.member.removeRoles(message.member.roles.filter(role => role.name!='Admin' && role.name!='@everyone'));

堆栈跟踪:

(node:27392) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Guild
at item.request.gen.end (C:\Users\nnova\Documents\Discord\Bots\repbot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:71:65)
at then (C:\Users\nnova\Documents\Discord\Bots\repbot\node_modules\snekfetch\src\index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:27392) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

(node:27392) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

堆栈跟踪中没有任何地方引用我的代码...

有人知道发生了什么吗?我花了一个小时搜索并尝试调试它。

【问题讨论】:

    标签: javascript node.js discord.js


    【解决方案1】:

    结果发现它是 discord API 或 discord.js 的一个错误。通过更改完全不相关的代码行来修复。不要尝试使用 client.guilds.filter(...) 引用您的公会,这会导致各种问题,只能通过踢掉您的机器人并让他重新加入服务器来解决

    【讨论】:

      猜你喜欢
      • 2020-12-27
      • 2021-11-03
      • 2021-06-28
      • 2020-11-03
      • 1970-01-01
      • 2020-08-24
      • 2021-08-12
      • 1970-01-01
      • 2017-04-25
      相关资源
      最近更新 更多