From 00886f504aecb72c6d59f42ad8db3acc68d2c8d7 Mon Sep 17 00:00:00 2001 From: skizzerz Date: Sat, 23 Sep 2017 18:37:22 -0500 Subject: [PATCH] Add DISABLED_COMMANDS config var --- src/decorators.py | 7 +++++++ src/settings.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/decorators.py b/src/decorators.py index 8fc0153..92b0529 100644 --- a/src/decorators.py +++ b/src/decorators.py @@ -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 diff --git a/src/settings.py b/src/settings.py index 6f60e2c..5854891 100644 --- a/src/settings.py +++ b/src/settings.py @@ -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