【问题标题】:Adding roles based on reactions根据反应添加角色
【发布时间】:2019-09-07 04:28:12
【问题描述】:

我想制作一个在使用反应时提供角色的机器人,但我真的卡住了,我在文档中找不到任何内容,所以我需要帮助。
我已经这样做了:

if (command == "role")
  message.channel.send("Click on :emoji1: to get role1, :emoji2: to get role2 and :emoji3: to get role3.")
  .then(sentMessage => {
    sentMessage.react(":emoji1:")
    sentMessage.react(":emoji2:")
    sentMessage.react(":emoji3:")
  });

它工作得很好,但我在点击反应时找不到如何添加角色。

【问题讨论】:

    标签: javascript discord discord.js


    【解决方案1】:

    您可以通过使用messageReactionAdd 事件来实现这一点:

    client.on('messageReactionAdd', (reaction, user) => {
      reaction.message.guild.member(user).addRole('yourRole');
    });
    

    【讨论】:

      猜你喜欢
      • 2020-08-30
      • 2021-04-18
      • 2020-10-03
      • 1970-01-01
      • 2021-02-24
      • 1970-01-01
      • 2019-02-12
      • 2021-11-25
      • 2019-09-22
      相关资源
      最近更新 更多