【发布时间】:2021-08-19 07:10:55
【问题描述】:
我正在使用“禁止”命令 (discord.js) 制作一个不和谐机器人,但我一直收到此错误.... [解析错误意外令牌案例]
脚本:
case 'ban': {
if (!isMod)
return;
let userID = args.includes('<@!') ? args.replace('<@!', '').replace('>', '')
: args.includes('<@') ? args.replace('<@', '').replace('<', '') : '';
if (userID == '') {
message.reply('Invalid user ID or mention.');
return;
}
message.guild.fetchMember(userID).then(member => {
member.kick("Banned by " + message.author.tag).then(m => {
message.channel.send('???? Banned <@' + userID + '>.');
}).catch(() => {
console.error;
message.reply('Could not ban the specified member.');
});
};
break;
});
User.ban({reason: banReason})
【问题讨论】:
-
您是否在
switch中使用case语句?