diff --git a/extensions/admin.py b/extensions/admin.py index bb3a7a1..096ed50 100644 --- a/extensions/admin.py +++ b/extensions/admin.py @@ -19,9 +19,11 @@ class Admin(commands.Cog): async def kill(self, ctx): "Kills the bot" if ctx.author.id in self.admin_ids: + self.bot.logger.info(f"Kill command ran by {ctx.author.id}") exit() else: await ctx.channel.send("You don't have permission to do that.") + self.bot.logger.info(f"Kill command attempted by {ctx.author.id}") @commands.command( description="Reset", @@ -31,10 +33,12 @@ class Admin(commands.Cog): ) async def reset(self, ctx): if ctx.author.id in self.admin_ids: + self.bot.logger.info(f"Reset command ran by {ctx.author.id}") python = sys.executable os.execl(python, python, *sys.argv) else: await ctx.channel.send("You don't have permission to do that.") + self.bot.logger.info(f"Reset command attempted by {ctx.author.id}") @commands.command( description="Update", @@ -44,6 +48,7 @@ class Admin(commands.Cog): ) async def update(self, ctx): if ctx.author.id in self.admin_ids: + self.bot.logger.info(f"Reset command ran by {ctx.author.id}") output = subprocess.run(["git","pull"],capture_output=True) if output.stderr: await ctx.send("Update Attempted") @@ -52,6 +57,11 @@ class Admin(commands.Cog): await ctx.send(output.stdout.decode('utf-8')) else: await ctx.send("You don't have permission to do this.") + self.bot.logger.info(f"Update command attempted by {ctx.author.id}") async def setup(bot): - await bot.add_cog(Admin(bot)) \ No newline at end of file + try: + bot.logger.info(f"Successfully added Admin cog") + await bot.add_cog(Admin(bot)) + except: + bot.logger.exception(f"Failed to add Admin cog") \ No newline at end of file