通过 Discord 的会员筛选后,如何为会员添加角色? [英] How to add role to a member after he/she passes member screening on Discord?

查看:10
本文介绍了通过 Discord 的会员筛选后,如何为会员添加角色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您在服务器上有任何join-role,则不会进行成员筛选.因为在成员筛选部分中,它声明如果成员被赋予角色,它会绕过筛选.那么筛选后如何赋予join-role呢?我可以使用什么事件以及如何使用?

If you have any join-role on a server, then the member screening won't happen. Since in the members screen section it states that if a member is given a role, it bypasses the screening. So how can the join-role be given after the screening? What event can I use and how?

推荐答案

你可以使用 Client#guildMemberUpdate(),当成员发生任何变化时发出.它传递两个参数,旧成员和新公会成员.然后,您可以检查 GuilMember#pending 如果成员通过了筛选,尽管这只能在 discord.js 主服务器上进行.

You can use the Client#guildMemberUpdate(), which emits when anything about a member changes. It passes two parameters, the old member, and the new guild member. You can then check through GuilMember#pending if the member went through screening, although this is only possible on discord.js master.

client.on('guildMemberUpdate', (oldMember, newMember) => {
  if (oldMember.pending && !newMember.pending) {
    // add the role!
  }
});

这篇关于通过 Discord 的会员筛选后,如何为会员添加角色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆