diff options
author | 2020-04-23 15:51:58 +0200 | |
---|---|---|
committer | 2020-04-23 16:15:18 +0200 | |
commit | b20bb7471b8d1d01f217f0620f8597bf1bae4456 (patch) | |
tree | aee2d18da0bf8b2578f46d5bccf0ef4e30217d2a /tests/helpers.py | |
parent | Allow `!eval` in help channel categories (diff) |
Simplify `in_whitelisted_context` decorator API
The API of the `in_whitelisted_context` decorator was a bit clunky:
- The long parameter names frequently required multiline decorators
- Despite `#bot-commands` being the defacto default, it needed to be passed
- The name of the function, `in_whitelisted_context` is fairly long in itself
To shorten the call length of the decorator, the parameter names were shortened by dropping the `whitelisted_` prefix. This means that the parameter names are now just `channels`, `categories`, and `roles`. This already means that all current usages of the decorator are reduced to one line.
In addition, `#bot-commands` has now been made the default redirect channel for the decorator. This means that if no `redirect` was passed, users will be redirected to `bot-commands` to use the command. If needed, `None` (or any falsey value) can be passed to disable redirection. Passing another channel id will trigger that channel to be used as the redirection target instead of bot-commands.
Finally, the name of the decorator was shortened to `in_whitelist`, which already communicates what it is supposed to do.
Diffstat (limited to 'tests/helpers.py')
0 files changed, 0 insertions, 0 deletions