cogs fuckery (i have zero clue how this is supposed to work you're on your own for this one glitch)

This commit is contained in:
Xargana 2025-05-09 22:23:50 +03:00
parent c3114639a2
commit fbfa27c979
5 changed files with 296 additions and 15 deletions

View file

@ -134,20 +134,22 @@ class MessageHandler:
"""Handle commands issued by the bot user"""
content = message.content
# Check for custom commands first
if content.startswith('.'):
cmd = content.split()[0][1:] # Remove the '.' and get the command name
if hasattr(self.bot, 'loaded_commands') and cmd in self.bot.loaded_commands:
# Execute the custom command
try:
# Extract arguments from the command
args = content.split(' ')[1:] if ' ' in content else []
await self.bot.loaded_commands[cmd](self.bot, message, args)
return
except Exception as e:
print(f"Error executing custom command {cmd}: {e}")
await message.channel.send(f"Error executing command: {e}")
return
# Skip if not a command
if not content.startswith('.'):
return
cmd_parts = content.split()
cmd = cmd_parts[0][1:] # Get command name without the '.'
# Check for custom/loaded commands first
if hasattr(self.bot, 'loaded_commands') and cmd in self.bot.loaded_commands:
try:
await self.bot.loaded_commands[cmd](message)
return
except Exception as e:
print(f"Error executing command {cmd}: {e}")
await message.edit(content=f"❌ Error executing command: {e}")
return
# User Management Commands - only keeping close and block
if content.startswith(".close"):