title: Discord Bot - limit to one reaction
body: <p>I am currently working on discord bot and faced a problem where I need to limit reactions. I am trying to achieve the following goal - if the user selects reaction it should be replaced with the newest reaction. Can someone advise on how to do it?</p>
  
  <p>Here is my <a href="https://i.stack.imgur.com/meMkT.png" rel="nofollow noreferrer">screenshot</a> and code of what I have at this moment.</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>client.on('raw', event =&gt; {
    console.log(event);
    const eventName = event.t;
    if(eventName === 'MESSAGE_REACTION_ADD') {
      if(event.d.message_id === '70цw3748527414706191') {
        var reactionChannel = client.channels.get(event.d.channel_id);
        if(reactionChannel.messages.has(event.d.message_id))
        return;
        else {
          reactionChannel.fetchMessage(event.d.message_id)
          .then(msg =&gt; {
            var msgReaction = msg.reactions.get(event.d.emoji.name + ":" + event.d.emoji.id);
            var user = client.users.get(event.d.user_id);
            client.emit('messageReactionAdd', msgReation, user);
          })
          .catch(err =&gt; console.log(err));
        }
      }
    }
    else if(eventName === 'MESSAGE_REACTION_ADD') {
      if(event.d.message_id === '703748527414706191') {
        var reactionChannel = client.channels.get(event.d.channel_id);
        if(reactionChannel.messages.has(event.d.message_id))
        return;
        else {
          reactionChannel.fetchMessage(event.d.message_id)
          .then(msg =&gt; {
            var msgReaction = msg.reactions.get(event.d.emoji.name + ":" + event.d.emoji.id);
            var user = client.users.get(event.d.user_id);
            client.emit('messageReactionRemove', msgReation, user);
          })
          .catch(err =&gt; console.log(err));
        }
      }
    }
  });
  
  client.on('messageReactionAdd', (messageReaction, user) =&gt; {
  
    var roleName = messageReaction.emoji.name;
    console.log(roleName);
    var role = messageReaction.message.guild.roles.find(role =&gt; role.name.toLowerCase() ===
    roleName.toLowerCase());
  
    if(role) {
      var member = messageReaction.message.guild.members.find(member =&gt; member.id === user.id);
      if(member) {
        member.addRole(role.id);
        console.log("Success");
      }
    }
  });
  
  client.on('messageReactionRemove', (messageReaction, user) =&gt; {
    var roleName = messageReaction.emoji.name;
    var role = messageReaction.message.guild.roles.find(role =&gt; role.name.toLowerCase() ===
    roleName.toLowerCase());
  
    if(role) {
      var member = messageReaction.message.guild.members.find(member =&gt; member.id === user.id);
      if(member) {
        member.removeRole(role.id);
        console.log("Success");
      }
    }
  });
  </code></pre>
  
  <p>Thank you for your guidance!</p>