From 6626b2ae2babd63eedad07b7067a8e3ba51f7933 Mon Sep 17 00:00:00 2001 From: Thomas Bowen <6600748+ttbowen@users.noreply.github.com> Date: Mon, 27 Nov 2023 22:15:22 +0000 Subject: [PATCH] Add comebacks for whale insults --- .../src/client/managers/reply-manager.ts | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/mrwhale-gamejolt/src/client/managers/reply-manager.ts b/packages/mrwhale-gamejolt/src/client/managers/reply-manager.ts index fe7c65b..f060f19 100644 --- a/packages/mrwhale-gamejolt/src/client/managers/reply-manager.ts +++ b/packages/mrwhale-gamejolt/src/client/managers/reply-manager.ts @@ -24,13 +24,25 @@ const RESPONSES = [ }, ]; +const SHUT_UP_REGEX = /(stfu|shut (the (fuck|hell)\W)?up) (@?Mr\.?\W?whale|whale)/gi; + +const COMEBACKS = [ + "Why don't you shut up.", + "No I don't think I will.", + "No you shut up.", + "Nice. Did they teach you that in Anger Management class?", + "You're not the boss of me.", + "Please lead by example.", + "You know you can just disable levels right? 🙄", +]; + export class ReplyManager { constructor(private bot: GameJoltBotClient) { registerListeners(this.bot.client, this); } @on("message") - protected async onMessage(message: Message): Promise { + protected async onMessage(message: Message): Promise { if (message.user.id === this.bot.chat.currentUser.id) { return; } @@ -44,7 +56,16 @@ export class ReplyManager { } if (message.textContent.match(WHALE_REGEX)) { - message.reply(message.toString().match(WHALE_REGEX)[0]); + return message.reply(message.toString().match(WHALE_REGEX)[0]); + } else if (message.textContent.match(SHUT_UP_REGEX)) { + const content = new Content(); + content.insertText( + `@${message.user.username} ${ + COMEBACKS[Math.floor(Math.random() * COMEBACKS.length)] + }` + ); + + return message.reply(content); } }