fix(arabot): add catch if user is not banned

This commit is contained in:
smyalygames 2022-10-28 02:38:58 +01:00
parent d42c4ce1cb
commit 722f0a53f1

View File

@ -65,7 +65,16 @@ class UnbanCommand extends Command {
}
// Unban the user
await guild.members.unban(user);
try {
await guild.members.unban(user);
} catch {
await interaction.reply({
content: `${user} is not banned.`,
ephemeral: true,
fetchReply: true,
});
return;
}
await interaction.reply({
content: `${user} has been unbanned.`,
@ -119,7 +128,15 @@ class UnbanCommand extends Command {
}
// Unban the user
await guild.members.unban(user);
try {
await guild.members.unban(user);
} catch {
await message.react('❌');
await message.reply({
content: `${user} is not banned.`,
});
return;
}
await message.react('✅');