Skip to content

Command disabling

v2.9 introduced the ability for commands to be disabled without necessitating the command be removed from EnduraBot's codebase.

How it works

The list disabled_cmds inside of data/variables.json determines which commands to disable, it being a list of key value pairs. The key is the application name of the command and the value is the reason why the command is disabled. How to find the application name for a command is explained at the page going over setting up permissions.

The permissions checker located at utils/permissions_checker.py – which is the code that validates whether a user has permissions to run a particular command – includes a check to see if the command being attempted is in the disabled_cmds list. If so, it immediately returns False – signaling to EnduraBot that command execution should be blocked.

main.py receives the command being blocked as a @bot.tree.error. An appropriate embed is then served based on why the command was blocked. In this case, it sends the embed explaining that the command is disabled and why.