asmarchioli
asmarchioli

Reputation: 21

How to make a bot react to media messages (png, mp4 and more)?

Well, I already tried, but I couldn't get him to react to the media message. It only reacts if there is no text in it ... then it becomes difficult ... Can someone help me? The code is:

   if (message.content === '') { //In this part I am in doubt of how to put just react on media ...

try {
       await message.react('✔️');
       await message.react('✖️');
} catch (error) {
      console.error('Does not recognize the emoji that another user has placed
(ignore)');//Ignore
    }
}});

Thank you @Jakye!

Upvotes: 0

Views: 62

Answers (1)

Jakye
Jakye

Reputation: 6625

if (message.attachments.size > 0) {
    // We have media. (Photos / Videos)
    try {
        await message.react("✔️");
        await message.react("✖️");
    } catch (error) {
        console.log(error);
    }
}

Upvotes: 1

Related Questions