turned goober away from antisemitism
This commit is contained in:
parent
ed7f0cca2d
commit
23b4745c0c
2 changed files with 10 additions and 8 deletions
16
bot.py
16
bot.py
|
@ -357,26 +357,21 @@ async def help(ctx: commands.Context) -> None:
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_message(message: discord.Message) -> None:
|
async def on_message(message: discord.Message) -> None:
|
||||||
global memory, markov_model
|
global memory, markov_model
|
||||||
|
EMOJIS = ["\U0001F604", "\U0001F44D", "\U0001F525", "\U0001F4AF", "\U0001F389", "\U0001F60E"] # originally was emojis but it would probably shit itself on systems without unicode so....
|
||||||
# Ignore bot messages
|
|
||||||
if message.author.bot:
|
if message.author.bot:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Ignore messages from blacklisted users
|
|
||||||
if str(message.author.id) in BLACKLISTED_USERS:
|
if str(message.author.id) in BLACKLISTED_USERS:
|
||||||
return
|
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}")):
|
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)}")
|
print(f"{(_('command_ran')).format(message=message)}")
|
||||||
await bot.process_commands(message)
|
await bot.process_commands(message)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Ignore messages with profanity
|
|
||||||
if profanity.contains_profanity(message.content):
|
if profanity.contains_profanity(message.content):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Add user messages to memory for training if enabled
|
|
||||||
if message.content:
|
if message.content:
|
||||||
if not USERTRAIN_ENABLED:
|
if not USERTRAIN_ENABLED:
|
||||||
return
|
return
|
||||||
|
@ -386,7 +381,14 @@ async def on_message(message: discord.Message) -> None:
|
||||||
memory.append(cleaned_message)
|
memory.append(cleaned_message)
|
||||||
save_memory(memory)
|
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)
|
await bot.process_commands(message)
|
||||||
|
|
||||||
# Event: Called on every interaction (slash command, etc.)
|
# Event: Called on every interaction (slash command, etc.)
|
||||||
|
|
|
@ -29,7 +29,7 @@ def is_positive(sentence):
|
||||||
debug_message = f"{DEBUG}{(_('sentence_positivity'))} {sentiment_score}{RESET}"
|
debug_message = f"{DEBUG}{(_('sentence_positivity'))} {sentiment_score}{RESET}"
|
||||||
print(debug_message)
|
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):
|
async def send_message(ctx, message=None, embed=None, file=None, edit=False, message_reference=None):
|
||||||
if edit and message_reference:
|
if edit and message_reference:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue