user11287402
user11287402

Reputation:

How to delete message upon reaction discord.js

This code errors no matter how I change it, and I just want it to delete the message upon receiving "🗑" reaction.

client.on('messageReactionAdd', (reaction, user) => {
    if (user.bot) return;
    if (reaction.emoji.name === "🗑") {
    message.delete(0500);
    }
})

Upvotes: 0

Views: 3348

Answers (1)

Adam Kerik
Adam Kerik

Reputation: 491

To delete a message upon reaction use the reaction.message.delete() method. This accesses the message that the reaction refers to, and deletes it.

Upvotes: 3

Related Questions