added error logging
This commit is contained in:
parent
ddca750093
commit
487d91ba2e
1 changed files with 19 additions and 16 deletions
|
|
@ -29,6 +29,7 @@ class MessageXP(BotBaseCog):
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_message(self, message: discord.Message):
|
async def on_message(self, message: discord.Message):
|
||||||
|
try:
|
||||||
author_id = message.author.id
|
author_id = message.author.id
|
||||||
if author_id == self.bot_id:
|
if author_id == self.bot_id:
|
||||||
return
|
return
|
||||||
|
|
@ -47,6 +48,8 @@ class MessageXP(BotBaseCog):
|
||||||
|
|
||||||
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 Exception as e:
|
||||||
|
self.logger.error(f"Error adding XP: {e}")
|
||||||
|
|
||||||
def create_xp_file(self):
|
def create_xp_file(self):
|
||||||
with open(self.data_dir + "xp.json", "w") as xp_file:
|
with open(self.data_dir + "xp.json", "w") as xp_file:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue