所以下面的代码是我的 Kick.js 但我想要它以便 mod 角色只能使用 kick 命令
module.exports = {
name: 'kick', //command name run : async(client,
message, args) => {
if (!message.guild.me.hasPermission('KICK_MEMBER')) return message.channel.send('I do not have permission to use this command
:joy: ');
// Basically checks if the bot has permission to kick a member or not
//Lets define the guildmember to kick!
const Member = message.mentions.members.first() //checking for member mentions
if (!Member) return message.channel.send('Please specify a member to kick.....');
// if there is no user then it will return with that message
await Member.kick({ reason: args.slice(1).join(" ")})
// args.slice(1).join(" ") means it slices the Member Variable and takes the text after it.
message.channel.send(`${ Member.user.tag}
was kicked from the server!`)
// above message will be sent when the member is kicked from the server.
}
}
答案 0 :(得分:0)
检查消息。成员权限
if(!message.member.hasPermission("KICK_MEMBERS"))
return message.reply("You don't have enough permissions for kick")
如果您想检查特定角色
if(!message.member.roles.cache.has(modRole))
return message.reply("You aren't a Mod")