Added a way to log execution of app command

This commit is contained in:
2024-10-18 13:46:28 +02:00
parent 8d004f566b
commit 757b9bab21
2 changed files with 48 additions and 37 deletions
+11
View File
@@ -0,0 +1,11 @@
from functools import wraps
import discord
def log_command_execution(func):
"""Wraps an command function to print execution logs to the console"""
@wraps(func)
async def wrapper(self, interaction:discord.Interaction, *args, **kwargs):
self._logger.debug(f"User {interaction.user} in channel {interaction.channel} on guild {interaction.guild} executed the {func.__name__} command")
return await func(self, interaction, *args, **kwargs)
return wrapper