Open FlickNoJutsu opened 3 years ago
Can you provide your modified code on https://pastebin.com/ or https://paste.ofcode.org/ ?
Sure! Here's the link https://pastebin.com/KN0azMBL
Thank you! I will try to investigate and fix it as soon as possible after work 👍
I cannot reproduce it on my end. :(
I think it's because the message is already deleted, so when the bot try to delete it, the bot throw an error.
But I think you don't have to worry, because message.delete()
is inside try-catch
block.
In case you don't like it because it's probably spamming the console, just delete/comment the console.error(error)
😁
Yeah so when I remove this piece of code I get an error. https://github.com/andrerahardjo97/discord-sticky-message-bot/blob/74eb73ff2d00943aad5fefd33015600370b8479f/index.js#L23-L25
Not sure what I can do to fix this.
Error:
(node:19132) UnhandledPromiseRejectionWarning: TypeError: lastStickyMessage.delete is not a function at Client.<anonymous> (C:\Users\x\Desktop\x\Sticky\index.js:29:41) at Client.emit (events.js:315:20) at MessageCreateAction.handle (C:\Users\x\Desktop\x\Sticky\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14) at Object.module.exports [as MESSAGE_CREATE] (C:\Users\x\Desktop\x\Sticky\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) at WebSocketManager.handlePacket (C:\Users\x\Desktop\x\Sticky\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31) at WebSocketShard.onPacket (C:\Users\x\Desktop\x\Sticky\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22) at WebSocketShard.onMessage (C:\Users\x\Desktop\x\Sticky\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10) at WebSocket.onMessage (C:\Users\x\Desktop\x\Sticky\node_modules\ws\lib\event-target.js:132:16) at WebSocket.emit (events.js:315:20) at Receiver.receiverOnMessage (C:\Users\x\Desktop\x\Sticky\node_modules\ws\lib\websocket.js:834:20) (Use
node --trace-warnings ...to show where the warning was created) (node:19132) 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:19132) [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.