From 1de1e8d55de639705ef74d2e51c396cc33129aad Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Thu, 30 Aug 2018 11:11:44 +0100 Subject: [Security] Prevent commands in DM - Fixes #60 --- bot/cogs/security.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bot/cogs/security.py b/bot/cogs/security.py index 443dd08e8..f4a843fbf 100644 --- a/bot/cogs/security.py +++ b/bot/cogs/security.py @@ -13,10 +13,14 @@ class Security: def __init__(self, bot: Bot): self.bot = bot self.bot.check(self.check_not_bot) # Global commands check - no bots can run any commands at all + self.bot.check(self.check_on_guild) # Global commands check - commands can't be run in a DM def check_not_bot(self, ctx: Context): return not ctx.author.bot + def check_on_guild(self, ctx: Context): + return ctx.guild is not None + def setup(bot): bot.add_cog(Security(bot)) -- cgit v1.2.3