diff options
| author | 2016-04-18 16:50:19 +0100 | |
|---|---|---|
| committer | 2016-04-18 16:50:19 +0100 | |
| commit | 1127682872c6c6f7a914b53a15b2f99816ee959f (patch) | |
| tree | f835aff6f9e8ffbbe3807c77369d9c23002940b7 /modules/check_mode.py | |
| parent | added some code to the nickname_aliases module, I do not trust this module ye... (diff) | |
added a way for a command callback to neatly ask to only be available for people with a rank or above, added a channel_op module to utilise this.
Diffstat (limited to 'modules/check_mode.py')
| -rw-r--r-- | modules/check_mode.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/check_mode.py b/modules/check_mode.py new file mode 100644 index 00000000..97da52d7 --- /dev/null +++ b/modules/check_mode.py @@ -0,0 +1,15 @@ + + +class Module(object): + def __init__(self, bot): + self.bot = bot + bot.events.on("preprocess").on("command").hook( + self.preprocess_command) + + def preprocess_command(self, event): + if event["is_channel"] and event["hook"].kwargs.get( + "require_mode"): + required_mode = event["hook"].kwargs.get("require_mode")[0] + if not event["target"].mode_or_above(event["user"].nickname, + required_mode): + return "You do not have permission to do this" |
