2018-08-31 09:51:47 +00:00
|
|
|
|
|
|
|
|
2016-04-18 15:50:19 +00:00
|
|
|
class Module(object):
|
2018-08-31 11:55:52 +00:00
|
|
|
def __init__(self, bot, events):
|
2016-04-18 15:50:19 +00:00
|
|
|
self.bot = bot
|
2018-08-31 11:55:52 +00:00
|
|
|
events.on("preprocess").on("command").hook(self.preprocess_command)
|
2016-04-18 15:50:19 +00:00
|
|
|
|
|
|
|
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]
|
2018-07-02 15:15:26 +00:00
|
|
|
if not event["target"].mode_or_above(event["user"],
|
2018-08-31 09:51:47 +00:00
|
|
|
required_mode):
|
2016-04-18 15:50:19 +00:00
|
|
|
return "You do not have permission to do this"
|