我如何使此命令仅由管理员使用?

问题描述 投票:-1回答:2

这是一个代码,用于删除x个效果很好的邮件,但是如何让只有管理员权限的成员才能使用它呢?

This is the code of the command

discord.js
2个回答
1
投票

您可以使用:

if(!message.member.roles.cache.has('roleID')) return message.channel.send(`your message`)

希望这会有所帮助!


0
投票

如果要检查管理员权限,可以使用

if (!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("You don't have the administrator permission!");
© www.soinside.com 2019 - 2024. All rights reserved.