c.a*_*les -2 discord discord.js
我最近启动了一个新的 discord.js bot,并收到了“无效令牌”错误。这不可能是因为异步功能,因为我只启动了机器人并且我有 0 个命令,上次发生这种情况是当我试图在 heroku 上托管另一个机器人时。我从来没有找到解决方案,这是我的终端:
C:\Users\Lory\Desktop\pp>node .
(node:3760) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (C:\Users\Lory\Desktop\pp\node_modules\discord.js\src\client\websocket\WebSocketManager.js:133:26)
at Client.login (C:\Users\Lory\Desktop\pp\node_modules\discord.js\src\client\Client.js:222:21)
(node:3760) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3760) [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.
C:\Users\Lory\Desktop\pp>
Run Code Online (Sandbox Code Playgroud)
我正在使用的代码:
C:\Users\Lory\Desktop\pp>node .
(node:3760) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (C:\Users\Lory\Desktop\pp\node_modules\discord.js\src\client\websocket\WebSocketManager.js:133:26)
at Client.login (C:\Users\Lory\Desktop\pp\node_modules\discord.js\src\client\Client.js:222:21)
(node:3760) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3760) [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.
C:\Users\Lory\Desktop\pp>
Run Code Online (Sandbox Code Playgroud)
将An invalid token was provided给出错误,因为你已经设置令牌.login()是无效的或不和谐的原因有几个像垃圾邮件,恶意行为或活动取消。还要确保您在Discord Developer Portal 中创建了自己的机器人应用程序。要生成机器人令牌,请按照下列步骤操作:
Bot。只需点击Add Bot。
在此页面上,您可以设置头像、用户名并重新生成令牌。单击Regenerate,然后单击copy。将令牌粘贴到client.login('Paste the copied token here').
运行你的脚本
享受!
| 归档时间: |
|
| 查看次数: |
8099 次 |
| 最近记录: |