add shutdown command

This commit is contained in:
Abigail Gold 2019-10-04 18:26:20 -04:00
parent 2baff301de
commit 517a13b7c3
No known key found for this signature in database
GPG Key ID: 80A676456AB6B045
1 changed files with 12 additions and 0 deletions

View File

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
import discord
import discord.ext.commands as commands
import os
class BaseCog(commands.Cog):
def __init__(self, bot):
@ -51,6 +52,17 @@ class BaseCog(commands.Cog):
except:
return
@commands.command(name="shutdown")
async def _shutdown_bot(self, ctx):
"""Shuts down the bot."""
if ctx.author.id in self.gs.opt.owners_uids:
await ctx.message.add_reaction("")
os._exit(42)
else:
try:
await ctx.message.add_reaction("")
except:
return
def setup(bot):
bot.add_cog(BaseCog(bot))