From 245d9a36df27affd8fcbebdbedde39ab424f7349 Mon Sep 17 00:00:00 2001 From: GRZ4NA Date: Mon, 5 Jul 2021 21:37:24 +0200 Subject: [PATCH] added enabled property for every system message --- src/SystemMessage.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/SystemMessage.ts b/src/SystemMessage.ts index ae56a98..781ff62 100644 --- a/src/SystemMessage.ts +++ b/src/SystemMessage.ts @@ -12,6 +12,7 @@ import { Command, PermissionsError } from "./Command.js"; export type MessageType = "PERMISSION" | "ERROR" | "NOT_FOUND"; export interface SystemMessageAppearance { + enabled: boolean; title: string; bottomText?: string; accentColor?: ColorResolvable; @@ -26,15 +27,14 @@ interface SystemMessageData { } export class SystemMessageManager { - enabled: boolean; PERMISSION: SystemMessageAppearance; ERROR: SystemMessageAppearance; NOT_FOUND: SystemMessageAppearance; deleteTimeout: number; constructor(botName?: string) { - this.enabled = true; this.PERMISSION = { + enabled: true, title: "👮‍♂️ Insufficient permissions", bottomText: "You don't have enough permissions to run this command", accentColor: "#1d1dc4", @@ -42,6 +42,7 @@ export class SystemMessageManager { footer: botName, }; this.ERROR = { + enabled: true, title: "❌ An error occurred", bottomText: "Something went wrong while processing your request.", accentColor: "#ff0000", @@ -49,6 +50,7 @@ export class SystemMessageManager { footer: botName, }; this.NOT_FOUND = { + enabled: true, title: "🔍 Command not found", accentColor: "#ff5500", showTimestamp: true, @@ -69,10 +71,10 @@ export class SystemMessageManager { data?: SystemMessageData, channel?: TextChannel | DMChannel | NewsChannel ): Promise { - if (!this.enabled) { - return; - } if (this[type]) { + if (this[type].enabled === false) { + return; + } const embed = new MessageEmbed(); embed.setTitle(this[type].title); if (this[type].bottomText)