【问题标题】:Send a DM and then reacts to the message once a new user joins发送 DM,然后在新用户加入后对消息做出反应
【发布时间】:2020-07-16 16:05:36
【问题描述】:

所以每次有新用户加入时,我都会使用

向用户发送消息
client.on ("guildMemberAdd", member => {

member.send("WELCOME")})

现在,机器人有什么方法可以对该消息做出反应? 谢谢!

【问题讨论】:

    标签: javascript node.js discord discord.js


    【解决方案1】:

    您需要在变量中包含member.send(),然后对其使用.react() 方法。

    所以你的解决方案是:

    const msg = await member.send("WELCOME")
    await msg.react("?");
    

    【讨论】:

      【解决方案2】:

      与 Syntle 的答案类似,但使用了 Promise。 (我的首选)

         member.send("WELCOME").then(function(msg){
             msg.react("?");
         }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-06-13
        • 2021-04-02
        • 2021-04-11
        • 2020-12-13
        • 1970-01-01
        • 2021-08-28
        • 2021-03-04
        • 2021-05-08
        相关资源
        最近更新 更多