From 517a13b7c3fdd8ad6f383852313c362ad2cc801b Mon Sep 17 00:00:00 2001 From: Abigail Gold Date: Fri, 4 Oct 2019 18:26:20 -0400 Subject: [PATCH 1/3] add shutdown command --- cogs/basecog.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cogs/basecog.py b/cogs/basecog.py index d4137ce..262546c 100644 --- a/cogs/basecog.py +++ b/cogs/basecog.py @@ -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)) From 067adb0252eb95783f00de9d625f216ed1615185 Mon Sep 17 00:00:00 2001 From: Abigail Gold Date: Fri, 4 Oct 2019 19:45:59 -0400 Subject: [PATCH 2/3] Ping! Pong! The witch is dead --- cogs/basecog.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cogs/basecog.py b/cogs/basecog.py index 262546c..aa84ebf 100644 --- a/cogs/basecog.py +++ b/cogs/basecog.py @@ -1,5 +1,5 @@ """ -Info cog for qrm +Base cog for qrm --- Copyright (C) 2019 Abigail Gold, 0x5c @@ -64,5 +64,10 @@ class BaseCog(commands.Cog): except: return + @bot.command(name="ping") + async def _ping(self, ctx): + await ctx.send(f'**Pong!** Current ping is {self.bot.latency*1000:.1f} ms') + + def setup(bot): bot.add_cog(BaseCog(bot)) From 9f586242f74d89979553b9dd67446d97735761b4 Mon Sep 17 00:00:00 2001 From: Abigail Gold <5366828+classabbyamp@users.noreply.github.com> Date: Fri, 4 Oct 2019 19:48:58 -0400 Subject: [PATCH 3/3] whoops --- cogs/basecog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/basecog.py b/cogs/basecog.py index aa84ebf..6dbad4d 100644 --- a/cogs/basecog.py +++ b/cogs/basecog.py @@ -64,7 +64,7 @@ class BaseCog(commands.Cog): except: return - @bot.command(name="ping") + @commands.command(name="ping") async def _ping(self, ctx): await ctx.send(f'**Pong!** Current ping is {self.bot.latency*1000:.1f} ms')