added logging
This commit is contained in:
parent
4f1baaa652
commit
2069fb788d
1 changed files with 11 additions and 1 deletions
|
|
@ -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):
|
||||
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")
|
||||
Loading…
Add table
Add a link
Reference in a new issue