added debug function and fixed error logging
This commit is contained in:
parent
658cff47c9
commit
f9dfc29a8e
1 changed files with 7 additions and 1 deletions
|
|
@ -26,6 +26,12 @@ class MessageXP(BotBaseCog):
|
||||||
except:
|
except:
|
||||||
await ctx.send("Error getting XP")
|
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()
|
@commands.Cog.listener()
|
||||||
async def on_message(self, message: discord.Message):
|
async def on_message(self, message: discord.Message):
|
||||||
|
|
@ -57,7 +63,7 @@ def create_xp_file(self):
|
||||||
try:
|
try:
|
||||||
with open(os.path.join(self.data_dir, "xp.json"), "w") as xp_file:
|
with open(os.path.join(self.data_dir, "xp.json"), "w") as xp_file:
|
||||||
json.dump(xp_data, xp_file)
|
json.dump(xp_data, xp_file)
|
||||||
except:
|
except Exception as e:
|
||||||
self.logger.error(f"Error creating XP file: {e}")
|
self.logger.error(f"Error creating XP file: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue