我的 Discord 机器人无法在第二台服务器上运行
My Discord bot is not working on a second server
我用 discord.js
和 enmap.js
编写了一个 Discord 机器人。
一切都在我的 Discord 服务器上运行。我把所有东西都放在 VPS 服务器上,它仍然可以在我的 Discord 服务器上运行。
现在我把它放在第二个 Discord 服务器上,但命令在第二个服务器上不起作用。
我收到这个错误:
(node:9131) UnhandledPromiseRejectionWarning: TypeError: Supplied parameter was neither a Role nor a Snowflake.
at GuildMember.addRole (/root/node_modules/discord.js/src/structures/GuildMember.js:452:38)
at Client.client.on (/root/masterbot/mainl.js:149:43)
at Client.emit (events.js:189:13)
at MessageCreateHandler.handle (/root/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/root/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (/root/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/root/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/root/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:189:13)
at Receiver._receiver.onmessage (/root/node_modules/ws/lib/websocket.js:137:47)
(node:9131) 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: 8)
UnhandledPromiseRejectionWarning: TypeError: Supplied parameter was neither a Role nor a Snowflake.
我真的不知道我在读什么。 :D
错误说:
(node:9131) UnhandledPromiseRejectionWarning: TypeError: Supplied parameter was neither a Role nor a Snowflake.
at GuildMember.addRole (/root/node_modules/discord.js/src/structures/GuildMember.js:452:38)
at Client.client.on (/root/masterbot/mainl.js:149:43)
这意味着您调用 GuildMember.addRole()
时使用了错误的参数。尝试检查您的 mainl.js
文件,第 149 行。
我用 discord.js
和 enmap.js
编写了一个 Discord 机器人。
一切都在我的 Discord 服务器上运行。我把所有东西都放在 VPS 服务器上,它仍然可以在我的 Discord 服务器上运行。
现在我把它放在第二个 Discord 服务器上,但命令在第二个服务器上不起作用。
我收到这个错误:
(node:9131) UnhandledPromiseRejectionWarning: TypeError: Supplied parameter was neither a Role nor a Snowflake.
at GuildMember.addRole (/root/node_modules/discord.js/src/structures/GuildMember.js:452:38)
at Client.client.on (/root/masterbot/mainl.js:149:43)
at Client.emit (events.js:189:13)
at MessageCreateHandler.handle (/root/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/root/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (/root/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/root/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/root/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:189:13)
at Receiver._receiver.onmessage (/root/node_modules/ws/lib/websocket.js:137:47)
(node:9131) 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: 8)
UnhandledPromiseRejectionWarning: TypeError: Supplied parameter was neither a Role nor a Snowflake.
我真的不知道我在读什么。 :D
错误说:
(node:9131) UnhandledPromiseRejectionWarning: TypeError: Supplied parameter was neither a Role nor a Snowflake.
at GuildMember.addRole (/root/node_modules/discord.js/src/structures/GuildMember.js:452:38)
at Client.client.on (/root/masterbot/mainl.js:149:43)
这意味着您调用 GuildMember.addRole()
时使用了错误的参数。尝试检查您的 mainl.js
文件,第 149 行。