Cleaned up command execution debug logs for better readability

kami_dev
Kami 2025-02-03 23:01:40 +01:00
parent 87d05d961a
commit faea372a56
2 changed files with 6 additions and 2 deletions

View File

@ -52,7 +52,9 @@ class DiscordBot(commands.Bot):
async def on_command(self, ctx):
"""Logs every command execution at DEBUG level."""
self.log(f"Discord Command executed: {ctx.command} by {ctx.author} in #{ctx.channel}: {ctx.message.content}", "DEBUG")
_cmd_args = str(ctx.message.content).split(" ")[1:]
self.log(f"Command '{ctx.command}' (Discord) initiated by {ctx.author} in #{ctx.channel}", "DEBUG")
if len(_cmd_args) > 1: self.log(f"!{ctx.command} arguments: {_cmd_args}", "DEBUG")
async def on_ready(self):
self.log(f"Discord bot is online as {self.user}", "INFO")

View File

@ -48,8 +48,10 @@ class TwitchBot(commands.Bot):
# Log the command if it's a command
if message.content.startswith("!"):
_cmd = message.content[1:] # Remove the leading "!"
_cmd_args = _cmd.split(" ")[1:]
_cmd = _cmd.split(" ", 1)[0]
self.log(f"Twitch Command executed: {_cmd} by {message.author.name} in #{message.channel.name}: {message.content}", "DEBUG")
self.log(f"Command '{_cmd}' (Twitch) initiated by {message.author.name} in #{message.channel.name}", "DEBUG")
if len(_cmd_args) > 1: self.log(f"!{_cmd} arguments: {_cmd_args}", "DEBUG")
# Process the message for command execution
await self.handle_commands(message)