简体   繁体   English

我需要帮助修复命令(node.js

[英]I need help fixing a command (node.js

I can't get this code to work.我无法让这段代码工作。 I am trying to check if a user has this role and ban them.我正在尝试检查用户是否具有此角色并禁止他们。

You're going about it the wrong way, you don't need to look for the ban role, you just need to check if the GuildMember has a role named ban你走错路了,你不需要寻找ban角色,你只需要检查GuildMember是否有一个名为ban的角色

if (message.member.roles.cache.some(role => role.name === 'ban')) return message.member.ban({ reason: 'Had the ban role' })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM