diff --git a/cogs/EventCog.py b/cogs/EventCog.py index 337e09e..6fb85ed 100644 --- a/cogs/EventCog.py +++ b/cogs/EventCog.py @@ -13,8 +13,7 @@ class EventCog(commands.Cog): # Logs when user sends a command @commands.Cog.listener() async def on_slash_command(self, ctx): - logMessage = f"{ctx.author.display_name} ran /{ctx.name}" - self.bot.log(logMessage, str(ctx.channel_id), level = 25) + await self.bot.eventHandler.on_slash_command(ctx) # Logs if a command experiences an error @commands.Cog.listener() diff --git a/utils/eventHandlers.py b/utils/eventHandlers.py index 2115524..b7c6872 100644 --- a/utils/eventHandlers.py +++ b/utils/eventHandlers.py @@ -5,6 +5,16 @@ class EventHandler(): def __init__(self, bot): self.bot = bot + async def on_slash_command(self, ctx): + if ctx.subcommand_name is not None: + subcommand = f" {ctx.subcommand_name} " + else: + subcommand = " " + args = " ".join([str(i) for i in ctx.args]) + fullCommand = f"/{ctx.command}{subcommand}{args}" + logMessage = f"{ctx.author.display_name} ran {fullCommand}" + self.bot.log(logMessage, str(ctx.channel_id), level = 25) + async def on_ready(self): await self.bot.databaseFuncs.syncCommands() self.bot.log("Logged in as "+self.bot.user.name+", "+str(self.bot.user.id), level = 25)