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 toolkit17mo 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!
小
OP17mo ago
btw I added partials and it didn't solve the problem
treble/luna
treble/luna17mo ago
show your code
小
OP17mo ago
ofc
treble/luna
treble/luna17mo ago
and also note that you wont have access to its content if its a partial
小
OP17mo ago
小
OP17mo ago
this is the messageDelete event
小
OP17mo ago
client ..
treble/luna
treble/luna17mo ago
the first line if the message content is empty, you return which will always be true for a partial
小
OP17mo ago
So, how do I get the deleted message to send it ?
treble/luna
treble/luna17mo ago
if its a partial? you dont if its gone its gone
小
OP17mo ago
oh i dont send it ? oh
treble/luna
treble/luna17mo ago
messageDelete event relies on cache
小
OP17mo ago
what about messageUpdate ?
treble/luna
treble/luna17mo ago
the oldMessage might be a partial but can be fetched
小
OP17mo 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/luna17mo ago
that should work, not entirely sure
monbrey
monbrey17mo ago
It makes no sense to do that If you fetch an oldMessage, you get the newMessage
小
OP17mo ago
so what should I do
treble/luna
treble/luna17mo ago
oh right
小
OP17mo ago
return void if its partial ?
monbrey
monbrey17mo ago
It really depends what you intend to do with the event You will always get a complete newMessage
小
OP17mo ago
so partial make no sens with newMessage? understood understood thank you guys have a good day
monbrey
monbrey17mo 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
小
OP17mo ago
tysm
Want results from more Discord servers?
Add your server