From e53607a9e7cd98a3801a3cbc7f6a976e2592a754 Mon Sep 17 00:00:00 2001 From: Toast <96593068+AnxietyisReal@users.noreply.github.com> Date: Thu, 12 Oct 2023 17:41:52 +1100 Subject: [PATCH] Fix bot not responding to certain triggers properly. --- src/funcs/ResponseModule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/funcs/ResponseModule.ts b/src/funcs/ResponseModule.ts index ea27a31..5b4cbfb 100644 --- a/src/funcs/ResponseModule.ts +++ b/src/funcs/ResponseModule.ts @@ -18,7 +18,7 @@ export default class Response { this.respond(client, message, keyword); } protected static respond(client:TClient, message:Discord.Message, responseKeyword:string) { - if (this.incomingArrays[responseKeyword].some(m=>message.content.toLowerCase().startsWith(m))) return message.reply(`${this.outgoingArrays(client, message)[responseKeyword][Math.floor(Math.random() * this.outgoingArrays(client, message)[responseKeyword].length)]}`) + if (new RegExp(`^(${this.incomingArrays[responseKeyword].join('|')})\\b`, 'i').test(message.content)) return message.reply(`${this.outgoingArrays(client, message)[responseKeyword][Math.floor(Math.random()*this.outgoingArrays(client, message)[responseKeyword].length)]}`) } private static outgoingArrays(client:TClient, message:Discord.Message) { const PersonnyMcPerson = `**${message.member.displayName}**`;