Skip to content

Commit

Permalink
Change sad message reactions to love reacts (#814)
Browse files Browse the repository at this point in the history
* change sad reacts to love reacts

* refactor(messageCommands): change function name

---------

Co-authored-by: LunaUrsa <[email protected]>
  • Loading branch information
theimperious1 and LunaUrsa authored Jul 30, 2024
1 parent 52a831e commit a930dd4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/discord/utils/messageCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const tripsitChannels = [
env.CHANNEL_WEBTRIPSIT2,
];

/*
const sadStuff = [
'sadface',
':(',
Expand Down Expand Up @@ -56,13 +57,14 @@ const sadStuff = [
'😐',
'πŸ˜‘',
];
*/

const heartEmojis = [
'❀', '🧑', 'πŸ’›', 'πŸ’š', 'πŸ’™', 'πŸ’œ', 'πŸ’', 'πŸ’–', 'πŸ’—', 'πŸ’˜', 'πŸ’•', 'πŸ’ž', 'πŸ’“', 'πŸ’Ÿ', '❣', 'πŸ«‚',
];

async function isSadMessage(message: Message): Promise<boolean> {
return sadStuff.some(word => (message.cleanContent.includes(word)
async function messageContainsHearts(message: Message): Promise<boolean> {
return heartEmojis.some(word => (message.cleanContent.includes(word)
&& !(message.cleanContent.substring(message.cleanContent.indexOf(':') + 1).includes(':'))));
}

Expand Down Expand Up @@ -383,10 +385,10 @@ give people a chance to answer πŸ˜„ If no one answers in 5 minutes you can try a
}
}
}
} else if (await isSadMessage(message)) {
} else if (await messageContainsHearts(message)) {
if (message.author.bot) return;
if (message.guild.id !== env.DISCORD_GUILD_ID) return;
// log.debug(F, 'Sad stuff detected');
// log.debug(F, 'Sad/lovey stuff detected');
await message.react(heartEmojis[Math.floor(Math.random() * heartEmojis.length)]);
}

Expand Down

0 comments on commit a930dd4

Please sign in to comment.