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

Did you find this page helpful?