【问题标题】:How do I make my Discord.JS bot react to it's own Direct Message?如何让我的 Discord.JS 机器人对其自己的直接消息做出反应?
【发布时间】:2020-12-05 21:44:55
【问题描述】:

当我在制作我的机器人时,我想这样当你输入 afv!support 时,它会发送这样的 DM: DM example

Thanks for contacting AFV support. Please react below for which problem you have.
:one: Ban Appeal
:two: Bug Report
:three: Report Staff/User

This command will expire in two minutes.

然后与 :one:、:two: 和 :three: 反应。我环顾四周,但没有找到答案。

感谢您的帮助!

【问题讨论】:

    标签: javascript discord discord.js


    【解决方案1】:

    向您的目标发送消息,将消息传递到.then(),机器人将对消息作出反应

    message.member.send(<theMessage>).then(msg => {
       msg.react('<emoji>')
       msg.react('<emoji>')
       msg.react('<emoji>')
    })
    

    【讨论】:

      【解决方案2】:

      Elitezen的回答是正确的,我只是想详细说明他们对&lt;emote&gt;的使用。

      例如,如果将&lt;emote&gt; 的第一次用法替换为:one:,它将无法正常工作。如果是自定义表情符号,则必须输入物理 unicode 表情符号或表情符号 ID

      例如:

      message.member.send(<theMessage>).then(msg => {
         await msg.react('1️⃣') // instead of :one:
         await msg.react('2️⃣') // instead of :two:
         msg.react('3️⃣') // instead of :three:
      })
      

      阅读此discord.js guide on reactions for more information

      【讨论】:

      • 好的,只是确保?
      猜你喜欢
      • 1970-01-01
      • 2018-12-15
      • 2020-11-07
      • 1970-01-01
      • 1970-01-01
      • 2020-07-29
      • 2021-12-31
      • 2020-12-14
      • 2020-11-21
      相关资源
      最近更新 更多