Skip to content

Commit

Permalink
[Security] Prevent commands in DM - Fixes #60
Browse files Browse the repository at this point in the history
  • Loading branch information
gdude2002 committed Aug 30, 2018
1 parent 0ec3d2b commit 1de1e8d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bot/cogs/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 1de1e8d

Please sign in to comment.