Add DISABLED_COMMANDS config var

This commit is contained in:
skizzerz 2017-09-23 18:37:22 -05:00
parent bcedbd4c65
commit 00886f504a
2 changed files with 10 additions and 0 deletions

View File

@ -224,6 +224,10 @@ class command:
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))
@ -350,6 +354,9 @@ class cmd:
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

View File

@ -334,6 +334,9 @@ DISABLED_ROLES = frozenset()
# 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