mirror of https://github.com/miaowware/qrm2.git
add shutdown command
This commit is contained in:
parent
2baff301de
commit
517a13b7c3
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
import discord
|
import discord
|
||||||
import discord.ext.commands as commands
|
import discord.ext.commands as commands
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
class BaseCog(commands.Cog):
|
class BaseCog(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
|
@ -51,6 +52,17 @@ class BaseCog(commands.Cog):
|
||||||
except:
|
except:
|
||||||
return
|
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):
|
def setup(bot):
|
||||||
bot.add_cog(BaseCog(bot))
|
bot.add_cog(BaseCog(bot))
|
||||||
|
|
Loading…
Reference in New Issue