From 784425b5d13d0c340f40b504bf4cdf3858f0af6f Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Wed, 1 May 2024 17:51:56 +1000 Subject: [PATCH] Tweak some visual stuff --- src/models/punishments.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/models/punishments.ts b/src/models/punishments.ts index 099e088..55b8f8f 100644 --- a/src/models/punishments.ts +++ b/src/models/punishments.ts @@ -162,10 +162,10 @@ export class PunishmentsSvc { if (type === 'mute') millisecondTime = time ? ms(time) : 2419200000; // Timeouts have a maximum duration of 4 weeks (28 days) else millisecondTime = time ? ms(time) : null; - const durText = millisecondTime ? ` for ${Formatters.timeFormat(millisecondTime, 4, {longNames: true, commas: true})}` : ''; + const durText = millisecondTime ? Formatters.timeFormat(millisecondTime, 4, {longNames: true, commas: true}) : ''; if (time) embed.addFields({name: 'Duration', value: durText}); - if (guildUser) await guildUser.send(`You've been ${this.getPastTense(type)} ${inOrFromBoolean} **${guild.name}**${durText}\n\`${reason}\` (Case #${punishment.case_id})`).catch(()=>embed.setFooter({text: 'Unable to DM a member'})); + if (guildUser) await guildUser.send(`You've been ${this.getPastTense(type)} ${inOrFromBoolean} **${guild.name}** for ${durText}\n\`${reason}\` (Case #${punishment.case_id})`).catch(()=>embed.setFooter({text: 'Unable to DM a member'})); switch (type) { case 'ban': @@ -238,10 +238,11 @@ export class PunishmentsSvc { removePunishmentResult = await guild.bans.remove(punishment.member, auditLogReason).catch((err:Error)=>err.message); break; case 'mute': - if (guildUser) { + if (!guildUser) this.model.update({expired: true}, {where: {case_id: caseId}}); + else { removePunishmentResult = await guildUser.timeout(null, auditLogReason).catch((err:Error)=>err.message); - guildUser.send(`You've been unmuted in **${guild.name}**.`).catch(()=>null); - } else this.model.update({expired: true}, {where: {case_id: caseId}}); + guildUser.send(`You've been unmuted in **${guild.name}**.\n\`${reason}\` (Case #${removePunishmentData.case_id})`).catch(()=>null); + } break; default: removePunishmentData.type = 'punishmentOverride';