【问题标题】:Discord.js: Verify channelDiscord.js:验证频道
【发布时间】:2020-10-28 07:40:05
【问题描述】:

我正在尝试为我的服务器制作自己的机器人,现在我专注于验证。通过对复选标记 emoji 采取行动,它会添加经过验证的角色,然后它应该只删除用户的反应,但它会立即删除所有反应

   client.on('messageReactionAdd', async (reactionReaction, user) => {
   
   const message = reactionReaction.message;
   const verifyChannel = message.guild.channels.cache.find(c => c.name === 'approvazione');
   const member = message.guild.members.cache.get(user.id);
   if (member.user.bot) return;
   const verify = message.guild.roles.cache.get('728000975046180988');
   

   if (reactionReaction.emoji.name === '✅' && message.channel.id === verifyChannel.id) {
    member.roles.add(verify).catch(console.error);
   await reactionReaction.remove(member).catch(console.error);
    
} 

here is the message sent by the bot with it's own reaction

and here is the same message after i reacted, and both mine and the bot reaction are removed, i just want my reaction to be removed

【问题讨论】:

    标签: node.js bots discord.js verify


    【解决方案1】:

    如果您查看文档,它不会为用户提供任何参数:

    https://discord.js.org/#/docs/main/stable/class/MessageReaction?scrollTo=remove

    这在v12中有所改变,现在的方法是使用.users.remove

    reactionReaction.users.remove(member);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-31
      • 2021-06-11
      • 2020-11-21
      • 2018-04-25
      • 2021-05-04
      • 2021-04-13
      • 2021-10-12
      • 2019-09-05
      相关资源
      最近更新 更多