【问题标题】:How to make a bot react to media messages (png, mp4 and more)?如何让机器人对媒体消息(png、mp4 等)做出反应?
【发布时间】:2020-11-21 12:17:55
【问题描述】:

嗯,我已经尝试过了,但我无法让他对媒体消息做出反应。它只有在没有文字的情况下才会做出反应......然后它变得很困难......有人可以帮助我吗?代码是:

   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
    }
}});

谢谢@Jakye!

【问题讨论】:

    标签: javascript node.js json discord discord.js


    【解决方案1】:
    if (message.attachments.size > 0) {
        // We have media. (Photos / Videos)
        try {
            await message.react("✔️");
            await message.react("✖️");
        } catch (error) {
            console.log(error);
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2018-12-15
      • 1970-01-01
      • 2020-12-14
      • 2020-11-07
      • 2021-10-31
      • 2020-12-13
      • 2020-09-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多