📝 Better logging of on_slash_command
Logs the entire command now
This commit is contained in:
@ -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()
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user