Switch set.py to use delimited events

This commit is contained in:
jesopo 2018-09-09 09:26:56 +01:00
parent 572ea85f1e
commit f2626a829b

View file

@ -5,25 +5,22 @@ class Module(object):
self.bot = bot self.bot = bot
self.exports = exports self.exports = exports
events.on("received").on("command").on("set").hook( events.on("received.command.set").hook(self.set,
self.set, help="Set a specified user setting", usage="<setting> <value>", help="Set a specified user setting")
usage="<setting> <value>") events.on("received.command.get").hook(self.get, min_args=1,
events.on("received").on("command").on("get").hook( usage="<setting>", help="Get a specified user setting")
self.get, help="Get a specified user setting",
usage="<setting>", min_args=1)
events.on("received").on("command").on("channelset" events.on("received.command.channelset").hook(self.channel_set,
).hook(self.channel_set, channel_only=True, channel_only=True, usage="<setting> <value>", require_mode="o",
help="Set a specified setting for the current channel", help="Set a specified setting for the current channel")
usage="<setting> <value>", require_mode="o") events.on("received.command.channelsetoverride").hook(
events.on("received").on("command").on("channelsetoverride" self.channel_set, channel_only=True, usage="<setting> <value>",
).hook(self.channel_set, channel_only=True, permission="channelsetoverride",
help="Set a specified setting for the current channel", help="Set a specified setting for the current channel")
usage="<setting> <value>", permission="channelsetoverride") events.on("received.command.channelget").hook(self.channel_get,
events.on("received").on("command").on("channelget" channel_only=True, usage="<setting>", min_args=1,
).hook(self.channel_get, channel_only=True, require_mode="o", help="Get a specified setting for the current "
help="Get a specified setting for the current channel", "channel")
usage="<setting>", min_args=1, require_mode="o")
def _set(self, settings, event, target): def _set(self, settings, event, target):
settings_dict = dict([(setting["setting"], setting settings_dict = dict([(setting["setting"], setting