所以我知道我听起来可能很蠢,并且可能有一个简单的解决方案,但是由于某种原因,当我尝试使用脚踢系统时,它工作正常,但原因不正确。我运行的命令是:“。kick @ MEE6测试踢系统”
// Kick User //
if (message.content.startsWith(prefix + 'kick')) {
const user = message.mentions.users.first();
var reason = ""
if (user) {
const member = message.guild.member(user);
const args = message.content.slice(prefix.length + String('kick').length + member.user.username.length).split(' ');
if (member) {
if (args === "") {
reason = "No Reason Specified"
} else {
reason = args
}
member.kick(reason).then(() => {
const embed = new djs.RichEmbed()
.setColor([52, 235, 64])
.setTitle('__Member Kick__')
.setDescription("")
.addField("Member Kicked:", user.tag + '\n' + user.id, true)
.addField("Moderator:", message.member.user.tag + '\n' + message.member.user.id, true)
.addField("Reason:", reason, false)
.setThumbnail(user.avatarURL)
.setFooter("Jumpstart: A bot by scriptic.xyz")
message.reply(embed)
}).catch(err => {
const embed = new djs.RichEmbed()
.setColor([209, 13, 13])
.setTitle('Error!')
.setDescription("An error has occurred, please see details below.")
.addField("Error Description:", "I was unable to kick " + user.username + "!", false)
.setThumbnail(user.avatarURL)
.addField("Error Type:", err.message)
.setFooter("Jumpstart: A bot by scriptic.xyz")
message.reply(embed)
console.error(err);
});
} else {
const embed = new djs.RichEmbed()
.setColor([209, 13, 13])
.setTitle('Error!')
.setDescription("An error has occurred, please see details below.")
.addField("Error Description:", "That user isn\'t in this server!", false)
.setFooter("Jumpstart: A bot by scriptic.xyz")
message.reply(embed)
}
} else {
const embed = new djs.RichEmbed()
.setColor([209, 13, 13])
.setTitle('Error!')
.setDescription("An error has occurred, please see details below.")
.addField("Error Description:", "You didn\'t mention the user to kick!", false)
.setFooter("Jumpstart: A bot by scriptic.xyz")
message.reply(embed)
}
};
预期结果将是:“原因:测试踢系统”我得到的是:https://gyazo.com/29925d2294f5afcfb251e615730934fd