如何检查是否在discord.js中发布了反应

时间:2019-11-26 14:08:38

标签: node.js discord.js

我有一个discord.js机器人,我想在其中添加网关条目。当他们对消息的反应做出反应时,他们就可以发挥作用。我怎么能做到这一点?

1 个答案:

答案 0 :(得分:0)

希望您发现这很有用:)

flutter.on('guildMemberAdd', async member => {



  let welcomeRole = member.guild.roles.find(role => {return role.id==="ROLE ID"});

  await member.addRole(welcomeRole);

  Promise.resolve(flutter.channels.get("CHANNEL ID")).then(async welcome => {

  const msg = `Welcome to the community. :emojiName: We are **please** that you have joined us!`; 

  Promise.resolve(welcome.send(msg)).then(async message => {



    flutter.on('messageReactionAdd', async (reaction, user) => {

        if(user === message.author.bot) return;

        if(reaction.emoji.name === "?") {





            let role = member.guild.roles.find(role => {return role.id==="ROLE TO REMOVE ID"});

            await member.removeRole(role);

            let roleTwo = member.guild.roles.find(role => {return role.id==="ROLE TO ADD ID"});

            await member.addRole(roleTwo); 

        }

      });

   });

  });

});

只要看到flutter一词,就用您的漫游器客户端名称进行更改。

Example:

const Discord = require("discord.js");
const client = new Discord.Client();

祝你好运〜