messageDelete event

When I try to delete a message that was sent before I run the client the message that is on the messageDelete event doesn't appear
25 Replies
d.js toolkit
d.js toolkit10mo ago
- 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!
小
10mo ago
btw I added partials and it didn't solve the problem
treble/luna
treble/luna10mo ago
show your code
小
10mo ago
ofc
treble/luna
treble/luna10mo ago
and also note that you wont have access to its content if its a partial
小
10mo ago
小
10mo ago
this is the messageDelete event
小
10mo ago
client ..
treble/luna
treble/luna10mo ago
the first line if the message content is empty, you return which will always be true for a partial
小
10mo ago
So, how do I get the deleted message to send it ?
treble/luna
treble/luna10mo ago
if its a partial? you dont if its gone its gone
小
10mo ago
oh i dont send it ? oh
treble/luna
treble/luna10mo ago
messageDelete event relies on cache
小
10mo ago
what about messageUpdate ?
treble/luna
treble/luna10mo ago
the oldMessage might be a partial but can be fetched
小
10mo ago
if (oldMessage.partial) await oldMessage.fetch();
if (oldMessage.partial) await oldMessage.fetch();
like this ? I mean
if (oldMessage.partial) oldMessage = await oldMessage.fetch();
if (oldMessage.partial) oldMessage = await oldMessage.fetch();
treble/luna
treble/luna10mo ago
that should work, not entirely sure
monbrey
monbrey10mo ago
It makes no sense to do that If you fetch an oldMessage, you get the newMessage
小
10mo ago
so what should I do
treble/luna
treble/luna10mo ago
oh right
小
10mo ago
return void if its partial ?
monbrey
monbrey10mo ago
It really depends what you intend to do with the event You will always get a complete newMessage
小
10mo ago
so partial make no sens with newMessage? understood understood thank you guys have a good day
monbrey
monbrey10mo ago
Well it does, if you want to get events for messages that arent in the cache But if that happens, oldMessage will be partial and newMessage will be complete
小
10mo ago
tysm