From 593f0dd4bbaa3b515c76698aabdf4d2ac64be50f Mon Sep 17 00:00:00 2001 From: RadiatedExodus Date: Thu, 25 Apr 2024 21:30:21 +0700 Subject: [PATCH] Int-CI-Moderation-UnBan: Fix relcid get failing and actually unban user --- src/interactions/commands/moderation/unban.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/interactions/commands/moderation/unban.ts b/src/interactions/commands/moderation/unban.ts index b19bbce..98a6bfe 100644 --- a/src/interactions/commands/moderation/unban.ts +++ b/src/interactions/commands/moderation/unban.ts @@ -7,15 +7,15 @@ export const Command: MeteoriumChatCommand = { .setName("unban") .setDescription("Deactivate a ban punishment") .addNumberOption((option) => - option.setName("relcid").setDescription("The ban case id that will be deactivated"), + option.setName("relcid").setDescription("The ban case id that will be deactivated").setRequired(true), ) .addStringOption((option) => - option.setName("reason").setDescription("The reason why this user was pardoned").setRequired(true), + option.setName("reason").setDescription("The reason why this user was unbanned").setRequired(true), ) .addAttachmentOption((option) => option .setName("proof") - .setDescription("The attachment proof on why this user received the pardon") + .setDescription("The attachment proof on why this user got unbanned") .setRequired(false), ) .addStringOption((option) => @@ -28,7 +28,7 @@ export const Command: MeteoriumChatCommand = { .setDMPermission(false), requiredFeature: GuildFeatures.Moderation, async callback(interaction, client) { - const relatedCaseId = interaction.options.getInteger("relcid", true); + const relatedCaseId = interaction.options.getNumber("relcid", true); const reason = interaction.options.getString("reason", true); const proof = interaction.options.getAttachment("proof", false); const moderationNote = interaction.options.getString("modnote", false); @@ -90,6 +90,9 @@ export const Command: MeteoriumChatCommand = { }, }); + // Unban + await interaction.guild.members.unban(banCase.TargetUserId, `Case #${caseId}: ${reason}`); + // Edit reply await interaction.editReply({ content: `Deactivated ban in case #${relatedCaseId}.`,