From 36144372fcb930c752c8aa48624ed877ec4ef4d6 Mon Sep 17 00:00:00 2001 From: aikaterna <20862007+aikaterna@users.noreply.github.com> Date: Wed, 24 Apr 2019 08:08:18 -0700 Subject: [PATCH] Add otherbot remove and fix formatting on watching --- otherbot/otherbot.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/otherbot/otherbot.py b/otherbot/otherbot.py index a747ac4..cd05e28 100644 --- a/otherbot/otherbot.py +++ b/otherbot/otherbot.py @@ -4,6 +4,7 @@ from redbot.core import commands, checks, Config BaseCog = getattr(commands, "Cog", object) + class Otherbot(BaseCog): def __init__(self, bot): self.bot = bot @@ -37,6 +38,14 @@ class Otherbot(BaseCog): pingrole_obj = discord.utils.get(ctx.guild.roles, id=pingrole_id) await ctx.send(f"Ping role set to: {pingrole_obj.name}.") + @otherbot.command() + @checks.admin_or_permissions(manage_roles=True) + async def remove(self, ctx, bot_user: discord.Member = None): + """Remove a bot from the watching list.""" + async with self.config.guild(ctx.guild).watching() as watch_list: + watch_list.remove(bot_user.id) + await ctx.send(f"Not watching {bot_user.mention} any more.") + @otherbot.command() @checks.admin_or_permissions(manage_roles=True) async def watching(self, ctx, bot_user: discord.Member = None): @@ -44,7 +53,7 @@ class Otherbot(BaseCog): data = await self.config.guild(ctx.guild).all() msg = "```Watching these bots:\n" if not data["watching"]: - msg += "None.```" + msg += "None." if not bot_user: for saved_bot_id in data["watching"]: bot_user = await self.bot.get_user_info(saved_bot_id) @@ -71,7 +80,7 @@ class Otherbot(BaseCog): if after.status == discord.Status.offline and (after.id in data["watching"]): channel_object = self.bot.get_channel(data["reporting"]) if not data["ping"]: - await channel_object.send(f'{after.mention} is offline.') + await channel_object.send(f"{after.mention} is offline.") else: await channel_object.send(f'<@&{data["ping"]}>, {after.mention} is offline.') else: