Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lastStickyMessage.delete is not a function #20

Open
FlickNoJutsu opened this issue May 27, 2021 · 4 comments
Open

lastStickyMessage.delete is not a function #20

FlickNoJutsu opened this issue May 27, 2021 · 4 comments

Comments

@FlickNoJutsu
Copy link

Yeah so when I remove this piece of code I get an error.

if (message.author.bot) {
return;
}

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.

@andrerahardjo97
Copy link
Owner

Can you provide your modified code on https://pastebin.com/ or https://paste.ofcode.org/ ?

@FlickNoJutsu
Copy link
Author

Sure! Here's the link https://pastebin.com/KN0azMBL

@andrerahardjo97
Copy link
Owner

andrerahardjo97 commented May 28, 2021

Thank you!
I will try to investigate and fix it as soon as possible after work 👍

@andrerahardjo97
Copy link
Owner

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) 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants