From 23b4745c0c99138ad4e8c44c8f5d2c6c4acfef79 Mon Sep 17 00:00:00 2001 From: WhatDidYouExpect <89535984+WhatDidYouExpect@users.noreply.github.com> Date: Sun, 6 Jul 2025 23:31:07 +0200 Subject: [PATCH] turned goober away from antisemitism --- bot.py | 16 +++++++++------- modules/sentenceprocessing.py | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/bot.py b/bot.py index ee82cb9..63b2b20 100644 --- a/bot.py +++ b/bot.py @@ -357,26 +357,21 @@ async def help(ctx: commands.Context) -> None: @bot.event async def on_message(message: discord.Message) -> None: global memory, markov_model - - # Ignore bot messages + EMOJIS = ["\U0001F604", "\U0001F44D", "\U0001F525", "\U0001F4AF", "\U0001F389", "\U0001F60E"] # originally was emojis but it would probably shit itself on systems without unicode so.... if message.author.bot: return - # Ignore messages from blacklisted users if str(message.author.id) in BLACKLISTED_USERS: return - # Process commands if message starts with a command prefix if message.content.startswith((f"{PREFIX}talk", f"{PREFIX}mem", f"{PREFIX}help", f"{PREFIX}stats", f"{PREFIX}")): print(f"{(_('command_ran')).format(message=message)}") await bot.process_commands(message) return - # Ignore messages with profanity if profanity.contains_profanity(message.content): return - # Add user messages to memory for training if enabled if message.content: if not USERTRAIN_ENABLED: return @@ -386,7 +381,14 @@ async def on_message(message: discord.Message) -> None: memory.append(cleaned_message) save_memory(memory) - # Process any commands in the message + sentiment_score = is_positive(message.content) # doesnt work but im scared to change the logic now please ignore + if sentiment_score > 0.8: + emoji = random.choice(EMOJIS) + try: + await message.add_reaction(emoji) + except Exception as e: + print(f"Failed to react with emoji: {e}") + await bot.process_commands(message) # Event: Called on every interaction (slash command, etc.) diff --git a/modules/sentenceprocessing.py b/modules/sentenceprocessing.py index 375dc9b..f073210 100644 --- a/modules/sentenceprocessing.py +++ b/modules/sentenceprocessing.py @@ -29,7 +29,7 @@ def is_positive(sentence): debug_message = f"{DEBUG}{(_('sentence_positivity'))} {sentiment_score}{RESET}" print(debug_message) - return sentiment_score > 0.1 + return sentiment_score > 0.6 # had to raise the bar because it kept saying "death to jews" was fine and it kept reacting to them async def send_message(ctx, message=None, embed=None, file=None, edit=False, message_reference=None): if edit and message_reference: