如何解决我正在处理我的踢命令,我想出了这个错误:
你好,我正在处理我的踢命令,我想出了这个错误:
(node:2559) UnhandledPromiseRejectionWarning: RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.
at Function.resolve (/rbd/pnpm-volume/cad5e42d-dfa3-46df-b985-a6e43aa649d2/node_modules/.registry.npmjs.org/discord.js/12.5.3/node_modules/discord.js/src/util/BitField.js:150:19)
at Permissions.has (/rbd/pnpm-volume/cad5e42d-dfa3-46df-b985-a6e43aa649d2/node_modules/.registry.npmjs.org/discord.js/12.5.3/node_modules/discord.js/src/util/BitField.js:45:28)
at Permissions.has (/rbd/pnpm-volume/cad5e42d-dfa3-46df-b985-a6e43aa649d2/node_modules/.registry.npmjs.org/discord.js/12.5.3/node_modules/discord.js/src/util/Permissions.js:45:85)
我想为我的静音命令设置一个静音角色,这里是我的命令:
const discord = require('discord.js')
exports.run = async (bot,message,args) => {
//console.log(message.member)
const permissions = message.channel.permissionsFor(message.client.user);
let perm=message.channel.permissionsFor(message.member)//perm.has()
if(!permissions.has("KICK_MEMBERS")) return message.noMentionReply(`${process.env.EMOTE_NO || '<:tairitsuno:869919370208509962>'}`+" | I don't have permission to kick!!!");
if (!perm.has("KICK_MEMBERS")&&!perm.has("MANAGE_GUILD")&&!perm.has("MANAGE_MEMBERS")&&!perm.has("ADMINISTRATOR"))
return message.mentionReply(`${process.env.EMOTE_NO || '<:tairitsuno:869919370208509962>'}`+" | You don't have permission to kick!!!");
if (!args[0]) {
return message.mentinReply(
`${process.env.EMOTE_NO || '<:tairitsuno:869919370208509962>'}`+" |Please mention or give the id of the person who you want to kick"
);
}
let target = await message.guild.members.fetch(args[0].replace("<@!","").replace("<@","").replace(">","")).catch(err => { return message.mentionReply(`${process.env.EMOTE_NO || '<:tairitsuno:869919370208509962>'}`+" | Unable to find this Person") });
if (target === !args[0]) {
return message.mentionReply(
`${process.env.EMOTE_NO || '<:tairitsuno:869919370208509962>'}`+" | Please mention or give the id of the person who you want to kick"
);
}
if (target.id === message.author.id) {
return message.mentionReply(`${process.env.EMOTE_NO || '<:tairitsuno:869919370208509962>'}`+" | You can not kick yourself");
}
let tar=message.channel.permissionsFor(target)//perm.has()
if (tar.has("ADMINISTRATOR")){
return message.mentionReply(`${process.env.EMOTE_NO || '<:tairitsuno:869919370208509962>'}`+" | The user you want to kick is a moderator/administrator I can't do that,try to kick him/her/them yourself..");
}
let BotRole = message.guild.member(message.guild.me).roles.highest.position;
let Role = target.roles.highest.position;
let UserRole = message.member.roles.highest.position;
if (UserRole <= Role) return message.mentionReply(`${process.env.EMOTE_NO || '<:tairitsuno:869919370208509962>'}`+' | You can\'t kick that user because that user has a role position which is higher than yours,or has a same role position as you!');
let reason = args.slice(1).join(" ");
if (!reason) reason = "-";
message.noMentionReply("kicking...")
.then(msg => {
let reasonb = args.slice(1).join(" ");
target.kick({reason: reason+` || by ${message.member.user.tag}`});
if(!reasonb){
msg.edit(`${process.env.EMOTE_OK || '<:hikariok:869920204786925608>'} | Kicked sucessfully`)
};
if(reasonb) {
msg.edit(`${process.env.EMOTE_OK || '<:hikariok:869920204786925608>'} | Kicked sucessfully **|** ${reason}`);}
});
}
exports.info = {
name: 'kick',aliases:[],usage: "<user_id_or_mention>",description: "kicks a member"
}//checked
exports.conf={
cooldown: 0,dm: "no"
}
我不太清楚如何解决它,请帮助我
解决方法
请参阅 here 了解所有有效的权限标志 - 请注意,MANAGE_MEMBERS
不是其中之一。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。