From ed8cc905bf83fbf50dc6e2bba5b06a286beccb9b Mon Sep 17 00:00:00 2001 From: Taken Date: Mon, 11 Dec 2023 13:41:19 +0100 Subject: [PATCH] Bug fix for unban Signed-off-by: Taken --- src/commands/unban.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/commands/unban.js b/src/commands/unban.js index 9030451..ae831af 100644 --- a/src/commands/unban.js +++ b/src/commands/unban.js @@ -36,6 +36,7 @@ module.exports = { const reason = interaction.options.getString("reason") || "No reason provided" const mod = interaction.user const embedColor = Number(color.replace("#", "0x")) + let user if (userid === "none") { await interaction.editReply({ @@ -47,7 +48,17 @@ module.exports = { return } - const user = await interaction.client.users.fetch(userid) + try { + user = await interaction.client.users.fetch(userid) + } catch (error) { + await interaction.editReply({ + embeds: [{ + description: "The user you specified is not valid", + color: embedColor + }] + }) + } + await interaction.guild.members.unban(user.id, reason) await interaction.editReply({