[英]Discord bot stops working after a few hours
My bot works for 7-8 hours then i get that message.我的机器人工作了 7-8 个小时,然后我收到了这条消息。
at GuildMember.isStaff (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\app.js:126:98) at Client.
在 GuildMember.isStaff (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\app.js:126:98) 在客户端。 (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\app.js:56:25) at Client.emit (events.js:400:28) at VoiceStateUpdate.handle (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\actions\\VoiceStateUpdate.js:40:14) at Object.module.exports [as VOICE_STATE_UPDATE] (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\handlers\\VOICE_STATE_UPDATE.js:4:35) at WebSocketManager.handlePacket (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\WebSocketManager.js:384:31) at WebSocketShard.onPacket (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\WebSocketShard.js:444:22) at WebSocketShard.onMessage (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\WebSocketShard.js:301:10) at WebSocket.onMessage (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\ws\\lib\\event-target.j
(C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\app.js:56:25) 在 Client.emit (events.js:400:28) 在 VoiceStateUpdate.handle (C:\\Users\\Mert\\ Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\actions\\VoiceStateUpdate.js:40:14) 在 Object.module.exports [as VOICE_STATE_UPDATE] (C:\\Users\\Mert\\Desktop\\Tasarım \\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\handlers\\VOICE_STATE_UPDATE.js:4:35) 在 WebSocketManager.handlePacket (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules \\discord.js\\src\\client\\websocket\\WebSocketManager.js:384:31) 在 WebSocketShard.onPacket (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\ websocket\\WebSocketShard.js:444:22) 在 WebSocketShard.onMessage (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\WebSocketShard.js:301:10 ) 在 WebSocket.onMessage (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\ws\\lib\\event-target.j s:132:16) at WebSocket.emit (events.js:400:28) (Use
node --trace-warnings ...
to show where the warning was created) (node:12296) UnhandledPromiseRejectionWarning: Unhandled promise rejection.s:132:16) 在 WebSocket.emit (events.js:400:28) (使用
node --trace-warnings ...
显示警告的创建位置)(节点:12296) UnhandledPromiseRejectionWarning:未处理的承诺拒绝。 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().这个错误要么是因为在没有 catch 块的情况下抛出了异步函数,要么是因为拒绝了一个没有用 .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).要在未处理的承诺拒绝时终止节点进程,请使用 CLI 标志
--unhandled-rejections=strict
(请参阅 https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode)。 (rejection id: 1) (node:12296) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated.(rejection id: 1) (node:12296) [DEP0018] DeprecationWarning:不推荐使用未处理的承诺拒绝。 In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
将来,未处理的承诺拒绝将使用非零退出代码终止 Node.js 进程。 (node:12296) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'position' of undefined at GuildMember.isStaff (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\app.js:126:98) at Client.
(node:12296) UnhandledPromiseRejectionWarning: TypeError: 无法在客户端读取 GuildMember.isStaff (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\app.js:126:98) 的未定义属性“位置”。 (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\app.js:56:25) at Client.emit (events.js:400:28) at VoiceStateUpdate.handle (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\actions\\VoiceStateUpdate.js:40:14) at Object.module.exports [as VOICE_STATE_UPDATE] (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\handlers\\VOICE_STATE_UPDATE.js:4:35) at WebSocketManager.handlePacket (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\WebSocketManager.js:384:31) at WebSocketShard.onPacket (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\WebSocketShard.js:444:22) at WebSocketShard.onMessage (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\WebSocketShard.js:301:10) at WebSocket.onMessage (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\ws\\lib\\event-target.j
(C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\app.js:56:25) 在 Client.emit (events.js:400:28) 在 VoiceStateUpdate.handle (C:\\Users\\Mert\\ Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\actions\\VoiceStateUpdate.js:40:14) 在 Object.module.exports [as VOICE_STATE_UPDATE] (C:\\Users\\Mert\\Desktop\\Tasarım \\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\handlers\\VOICE_STATE_UPDATE.js:4:35) 在 WebSocketManager.handlePacket (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules \\discord.js\\src\\client\\websocket\\WebSocketManager.js:384:31) 在 WebSocketShard.onPacket (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\ websocket\\WebSocketShard.js:444:22) 在 WebSocketShard.onMessage (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\discord.js\\src\\client\\websocket\\WebSocketShard.js:301:10 ) 在 WebSocket.onMessage (C:\\Users\\Mert\\Desktop\\Tasarım\\Discord Botları\\bot3\\node_modules\\ws\\lib\\event-target.j s:132:16) at WebSocket.emit (events.js:400:28) (node:12296) UnhandledPromiseRejectionWarning: Unhandled promise rejection.
s:132:16) 在 WebSocket.emit (events.js:400:28) (node:12296) UnhandledPromiseRejectionWarning:未处理的承诺拒绝。 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().
这个错误要么是因为在没有 catch 块的情况下抛出了异步函数,要么是因为拒绝了一个没有用 .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).要在未处理的承诺拒绝时终止节点进程,请使用 CLI 标志
--unhandled-rejections=strict
(请参阅 https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode)。 (rejection id: 2)(拒绝编号:2)
What should i do ?我该怎么办 ?
You have a few options I'd think:我认为你有几个选择:
You need to handle promise rejections accordingly or at least handle them in some way.您需要相应地处理承诺拒绝或至少以某种方式处理它们。 The error message does have instructions at the bottom "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()"
错误消息的底部确实有说明“此错误源于在没有 catch 块的异步函数内部抛出,或拒绝未使用 .catch() 处理的承诺”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.