From 65baaef5691b03c7bd42da63a05943e7041ceb92 Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:01:01 +1100 Subject: [PATCH] Refactor the BKL channel selection for a reliable system. --- src/models/punishments.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/models/punishments.ts b/src/models/punishments.ts index 2779aeb..85d2dcc 100644 --- a/src/models/punishments.ts +++ b/src/models/punishments.ts @@ -110,7 +110,17 @@ export class PunishmentsSvc { return result; } async createModlog(punishment:Punishment) { - const channel = ['kick', 'ban'].includes(punishment.type) ? this.client.config.dcServer.channels.bankick_log : this.client.config.dcServer.channels.logs; + let channel:Discord.TextChannelResolvable; + switch (punishment.type) { + case 'kick': + case 'ban': + channel = this.client.config.dcServer.channels.bankick_log; + break; + default: + channel = this.client.config.dcServer.channels.logs; + console.log('[Punishment] BKL channel doesn\'t seem to exist anymore, falling back to #bot-log.') + break; + } const embed = new this.client.embed() .setColor(this.client.config.embedColor) .setTitle(`${punishment.type[0].toUpperCase() + punishment.type.slice(1)} | Case #${punishment.case_id}`)