Skip to content

Commit

Permalink
Add DISABLED_COMMANDS config var
Browse files Browse the repository at this point in the history
  • Loading branch information
skizzerz committed Sep 23, 2017
1 parent 473b556 commit 8d7672f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ def __init__(self, *commands, flag=None, owner_only=False, chan=True, pm=False,

alias = False
self.aliases = []

if var.DISABLED_COMMANDS.intersection(commands):
return # command is disabled, do not add to COMMANDS

for name in commands:
if exclusive and name in COMMANDS:
raise ValueError("exclusive command already exists for {0}".format(name))
Expand Down Expand Up @@ -350,6 +354,9 @@ def __init__(self, *cmds, raw_nick=False, flag=None, owner_only=False,

alias = False
self.aliases = []
if var.DISABLED_COMMANDS.intersection(cmds):
return # command is disabled, do not add to COMMANDS

for name in cmds:
for func in COMMANDS[name]:
if (func.owner_only != owner_only or
Expand Down
3 changes: 3 additions & 0 deletions src/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@
# Game modes that cannot be randomly picked or voted for
DISABLED_GAMEMODES = frozenset()

# Commands listed here cannot be used by anyone (even admins/owners)
DISABLED_COMMANDS = frozenset()

# Roles which have a command equivalent to the role name need to implement special handling for being
# passed their command again as a prefix and strip it out. For example, both !clone foo and !clone clone foo
# should be valid. Failure to add such a command to this set will result in the bot not starting
Expand Down

0 comments on commit 8d7672f

Please sign in to comment.