From b227581f1a92a399bac09da9e0d844a4b7995c64 Mon Sep 17 00:00:00 2001 From: GRZ4NA Date: Tue, 3 Aug 2021 01:39:55 +0200 Subject: [PATCH] fixed fetching bug + updated warn visual style --- src/Command.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Command.ts b/src/Command.ts index dc81b8e..95a8ffa 100644 --- a/src/Command.ts +++ b/src/Command.ts @@ -230,7 +230,7 @@ export class CommandManager { this.findPhraseOccurrence(a); if (aliasOccurrence) { console.warn( - `WARN! The name "${a}" is already registered as ${aliasOccurrence.type} in the "${aliasOccurrence.command.name}" command. It will be removed from the "${command.name}" command.` + `[⚠ WARN] The name "${a}" is already registered as ${aliasOccurrence.type} in the "${aliasOccurrence.command.name}" command. It will be removed from the "${command.name}" command.` ); ar.splice(i, 1); } @@ -239,7 +239,7 @@ export class CommandManager { command.keywords.map((k, i, a) => { if (c.keywords.indexOf(k) != -1) { console.warn( - `WARN! The name "${k}" is already a registered KEYWORD for the "${c.name}" command. It will be removed from the "${command.name}" command` + `[⚠ WARN] The name "${k}" is already a registered KEYWORD for the "${c.name}" command. It will be removed from the "${command.name}" command` ); a.splice(i, 1); } @@ -260,11 +260,15 @@ export class CommandManager { */ fetch(message: Message): CommandMessageStructure | null { if (!message.author.bot) { - const content = message.content.startsWith(this.prefix) + let prefix = false; + if (message.content.startsWith(this.prefix)) { + prefix = true; + } + const content = prefix ? message.content.replace(this.prefix, "") : message.content; const name = content.split(" ")[0]; - const command = this.get(name, "ALL"); + const command = this.get(name, prefix ? "PREFIX" : "NO_PREFIX"); if (command) { const argumentsText = content.replace(name, ""); const argumentsList = argumentsText