stats channels
diff --git a/src/commands/mod/unmute.ts b/src/commands/mod/unmute.ts
index d5f4205..56a0b56 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -11,14 +11,12 @@
.setName("unmute")
.setDescription("Unmutes a user")
.addUserOption(option => option.setName("user").setDescription("The user to unmute").setRequired(true))
- .addStringOption(option => option.setName("notify").setDescription("If the user should get a message when they are unmuted | Default: No").setRequired(false)
- .addChoices([["Yes", "yes"], ["No", "no"]])
- )
const callback = async (interaction: CommandInteraction): Promise<any> => {
const { log, NucleusColors, renderUser, entry, renderDelta } = client.logger
// TODO:[Modals] Replace this with a modal
let reason = null;
+ let notify = false;
let confirmation;
while (true) {
confirmation = await new confirmationMessage(interaction)
@@ -28,20 +26,23 @@
"user": renderUser(interaction.options.getUser("user")),
"reason": `\n> ${reason ? reason : "*No reason provided*"}`
})
- + `The user **will${interaction.options.getString("notify") === "yes" ? '' : ' not'}** be notified\n\n`
+ + `The user **will${notify ? '' : ' not'}** be notified\n\n`
+ `Are you sure you want to unmute <@!${(interaction.options.getMember("user") as GuildMember).id}>?`)
.setColor("Danger")
.addReasonButton(reason ?? "")
.send(reason !== null)
- reason = reason ?? ""
- if (confirmation.newReason === undefined) break
- reason = confirmation.newReason
+ if (confirmation.success) break
+ if (confirmation.newReason) reason = confirmation.newReason
+ if (confirmation.components) {
+ notify = confirmation.components.notify.active
+ }
}
+ if (confirmation.cancelled) return
if (confirmation.success) {
let dmd = false
let dm;
try {
- if (interaction.options.getString("notify") != "no") {
+ if (notify) {
dm = await (interaction.options.getMember("user") as GuildMember).send({
embeds: [new EmojiEmbed()
.setEmoji("PUNISH.MUTE.GREEN")
@@ -88,7 +89,7 @@
}
}
log(data);
- let failed = (dmd == false && interaction.options.getString("notify") != "no")
+ let failed = (dmd == false && notify)
await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Unmute`)