From 044874f65b77a9cf3a0063e7986293b8b74d6a44 Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Sun, 4 Feb 2018 23:38:13 +0000 Subject: Security cog; because bots don't let other bots get triggered --- bot/__main__.py | 1 + bot/cogs/security.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 bot/cogs/security.py diff --git a/bot/__main__.py b/bot/__main__.py index 7e5269459..a6f6dce3d 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -7,6 +7,7 @@ bot = AutoShardedBot(command_prefix=when_mentioned_or(">>>", ">>> ")) # Internal/debug bot.load_extension("bot.cogs.logging") +bot.load_extension("bot.cogs.security") # Owner-only bot.load_extension("bot.cogs.eval") diff --git a/bot/cogs/security.py b/bot/cogs/security.py new file mode 100644 index 000000000..c7fa4a686 --- /dev/null +++ b/bot/cogs/security.py @@ -0,0 +1,22 @@ +# coding=utf-8 +from discord.ext.commands import AutoShardedBot, Context + +__author__ = "Gareth Coles" + + +class Security: + """ + Security-related helpers + """ + + def __init__(self, bot: AutoShardedBot): + self.bot = bot + self.bot.check(self.check_not_bot) + + async def check_not_bot(self, ctx: Context): + return not ctx.author.bot + + +def setup(bot): + bot.add_cog(Security(bot)) + print("Cog loaded: Security") -- cgit v1.2.3