Skip to content

Commit

Permalink
Make Bingus always react to its emoji (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
ButterscotchV authored Dec 8, 2023
1 parent d9c604c commit 4101c11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bingus-bot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import auth from "../auth.json" assert { type: "json" };
import { EmbedList, REACTION_EMOJIS, SAD_EMOJIS, fetchBingus } from "./util.js";
import { BINGUS_EMOJI, EmbedList, REACTION_EMOJIS, SAD_EMOJIS, fetchBingus } from "./util.js";
import { askCommand } from "./commands/ask.js";
import { shippingCommand } from "./commands/shipping.js";
import winkNLP from "wink-nlp";
Expand Down Expand Up @@ -129,7 +129,11 @@ client.on("messageCreate", async (msg) => {
await msg.fetch();
const lowercase = msg.content.toLowerCase();
// Check if Bingus is being mentioned in some way
if (msg.mentions.users.has(clientId) || /\b(bot|bing\w{0,4})\b/.test(lowercase)) {
if (msg.content.includes(BINGUS_EMOJI.toString())) {
// React back with the emote
await msg.react(BINGUS_EMOJI);
return;
} else if (msg.mentions.users.has(clientId) || /\b(bot|bing\w{0,4})\b/.test(lowercase)) {
// Check if Bingus recently sent a message
const lastMessages = await msg.channel.messages.fetch({
limit: 10,
Expand Down
3 changes: 3 additions & 0 deletions bingus-bot/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ export async function fetchBingusData(): Promise<FaqConfig> {
) as FaqConfig;
}

export const BINGUS_EMOJI: EmojiIdentifierResolvable = "<:bingus:1157717351861596200>";

export const REACTION_EMOJIS: EmojiIdentifierResolvable[] = [
"<:langwidjnom:1055961639842750534>",
"<:Heart:1117832451620868136>",
Expand All @@ -199,6 +201,7 @@ export const REACTION_EMOJIS: EmojiIdentifierResolvable[] = [
"💙",
"✨",
"😻",
BINGUS_EMOJI,
];

export const SAD_EMOJIS: EmojiIdentifierResolvable[] = [
Expand Down

0 comments on commit 4101c11

Please sign in to comment.