From f9dfc29a8e2a36d8aa564f1b607686189d7834e6 Mon Sep 17 00:00:00 2001 From: phixxy Date: Tue, 5 Nov 2024 17:47:32 -0800 Subject: [PATCH] added debug function and fixed error logging --- cogs/message_xp.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cogs/message_xp.py b/cogs/message_xp.py index 74b5fa8..892f40e 100644 --- a/cogs/message_xp.py +++ b/cogs/message_xp.py @@ -25,6 +25,12 @@ class MessageXP(BotBaseCog): await ctx.send("You have 0 XP") except: await ctx.send("Error getting XP") + + @commands.command() + async def show_json(self, ctx): + with open(self.data_dir + "xp.json", "r") as xp_file: + xp_data = json.load(xp_file) + await ctx.send(xp_data) @commands.Cog.listener() @@ -57,7 +63,7 @@ def create_xp_file(self): try: with open(os.path.join(self.data_dir, "xp.json"), "w") as xp_file: json.dump(xp_data, xp_file) - except: + except Exception as e: self.logger.error(f"Error creating XP file: {e}")