prolly gonna move command to their own modules soon soo

This commit is contained in:
WhatDidYouExpect 2025-07-18 13:57:58 +02:00
parent 9a4d486e25
commit 8666c83565
3 changed files with 91 additions and 11 deletions

16
bot.py
View file

@ -49,7 +49,7 @@ from modules.version import *
from modules.sentenceprocessing import *
from modules.unhandledexception import handle_exception
from modules.image import gen_meme, gen_demotivator
from modules.minigames import guessthenumber, hangman
sys.excepthook = handle_exception
check_for_update() # Check for updates (from modules/version.py)
@ -64,12 +64,6 @@ currenthash: str = ""
launched: bool = False
slash_commands_enabled: bool = False
# Set up Discord bot intents and create bot instance
intents: discord.Intents = discord.Intents.default()
intents.messages = True
intents.message_content = True
bot: commands.Bot = commands.Bot(command_prefix=PREFIX, intents=intents, allowed_mentions=discord.AllowedMentions(everyone=False, roles=False, users=False, replied_user=True))
# Load memory and Markov model for text generation
memory: List[str] = load_memory()
markov_model: Optional[markovify.Text] = load_markov_model()
@ -419,10 +413,14 @@ async def on_message(message: discord.Message) -> None:
await bot.process_commands(message)
# Event: Called on every interaction (slash command, etc.)
@bot.event
async def on_interaction(interaction: discord.Interaction) -> None:
logger.info(f"{(_('command_ran_s')).format(interaction=interaction)}{interaction.data['name']}")
name = None
if interaction.data.get('name') is None:
name = "Unknown"
else:
name = interaction.data['name']
logger.info(f"{(_('command_ran_s')).format(interaction=interaction)}{name}")
# Global check: Block blacklisted users from running commands
@bot.check