Editing a message deletes it for some reason.
To explain my system. I have a music bot that some events trigger certain message edits. Upon a user playing a song, an embed with buttons get sent (pic 1) this message gets stored within Guild class I extended with types. upon clicking one of the buttons, the message gets edited with new information. For example if someone pauses the song the button changes to another button. But the problem with that is that, upon editing the message. It deletes it. Pictures besides 1st one, show the code pretty much.
2nd pic shows how i store the message and what happens when a track starts playing
3rd pic shows what happens when player gets resumed (same thing happens with pausing or any event that edits the message stored)
After editing the message, it emits messageDeleted event within api for some reason (probably because it does delete the message)
5 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPLook at audit logs and see who deletes the message
i did
no trace of it
So we now know it's actually your bot deletes its message. It can't magically delete the message.
Try to find the place where you use .delete() method.
I have
done that
nowhere to find .delete()
it happens on button interaction
i checked button interaction events none do message.delete()
you gave me an idea
Alright I tried listening to interactionCreate and logging the interaction
There's only one buttonInteraction and that's it
I tried debugging it even further
no sign of anything
Im so confused
I found the issue
I was testing it in my friend's server and he has Mee6 and other bots
probably
one of the bot's button events are incorrectly handled and they ruin my bot probably
Yep it only happens in that server
nowhere else