aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-08-30 11:11:44 +0100
committerGravatar Gareth Coles <[email protected]>2018-08-30 11:11:44 +0100
commit1de1e8d55de639705ef74d2e51c396cc33129aad (patch)
tree61a7789f17ca617aaa9ea5dc01d881298ce98b95
parent[Config] Remove invites from un-partnered servers (diff)
[Security] Prevent commands in DM - Fixes #60
-rw-r--r--bot/cogs/security.py4
1 files changed, 4 insertions, 0 deletions
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))