我在我的机器人中添加了审核命令,但我不希望人们能够踢管理员,所以我添加了一些代码,但效果不佳,当我执行 ,kick
时它告诉我请指定一个成员踢,完美,当我执行 ,kick @[user]
时它踢用户,但是当我尝试踢管理员时,它给我一条错误消息说 Cannot read property 'has' of undefined
这里是代码
module.exports = {
name: 'kick',
description: '[DESCRIPTION]',
async execute(Client, message, args, Discord) {
const member = message.mentions.users.first();
if(message.member.permissions.has("ADMINISTRATOR") || message.member.permissions.has("KICK_MEMBERS") || Client.users.cache.find(u => u.tag === 'Mr Tophat#3864').id){
if(!member){
message.channel.send("Please specify a member to kick");
}
else if(member.permissions.has("ADMINISTRATOR")){
message.channel.send("You can't an admin");
}
else{
if(member){
const memberTarget = message.guild.members.cache.get(member.id);
memberTarget.kick();
message.channel.send("User has been kicked!");
}
}
}
}
}
答案 0 :(得分:2)
您收到此错误是因为您试图访问 import pandas as pd
cluster_global = 0
cluster_relativo = 0
cluster_index = []
for index, row in df.iterrows():
if row['cluster'] == cluster_relativo:
cluster_index.append(cluster_global)
elif row['cluster'] == (cluster_relativo + 1):
cluster_global += 1
cluster_relativo += 1
cluster_index.append(cluster_global)
elif row['cluster'] == 0:
cluster_global += 1
cluster_relativo = 0
cluster_index.append(cluster_global)
的 permissions
而不是 user
。像这样声明您的 guildMember
:
member
区别在于,const member = message.mentions.members.first();
是全局不和谐user
,user
是特定{{1}上的guildMember
}}