Skip to content

Commit

Permalink
Add comebacks for whale insults
Browse files Browse the repository at this point in the history
  • Loading branch information
ttbowen committed Nov 27, 2023
1 parent 4f1e49d commit 6626b2a
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions packages/mrwhale-gamejolt/src/client/managers/reply-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
protected async onMessage(message: Message): Promise<Message> {
if (message.user.id === this.bot.chat.currentUser.id) {
return;
}
Expand All @@ -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);
}
}

Expand Down

0 comments on commit 6626b2a

Please sign in to comment.