diff options
| author | 2018-08-31 12:55:52 +0100 | |
|---|---|---|
| committer | 2018-08-31 12:55:52 +0100 | |
| commit | 9874f79b498e1f8ae5ebec9a240963e908b645b0 (patch) | |
| tree | d5d887ac82f3e50f0ea295953981363c1c5e7c5a /modules/set.py | |
| parent | Merge pull request #7 from dngfx/master (diff) | |
| signature | ||
Give modules event objects with "context"s, to facilitate purging all the event
hooks for a module
Diffstat (limited to 'modules/set.py')
| -rw-r--r-- | modules/set.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/modules/set.py b/modules/set.py index 0f73d70c..23abea9b 100644 --- a/modules/set.py +++ b/modules/set.py @@ -1,31 +1,32 @@ class Module(object): - def __init__(self, bot): + def __init__(self, bot, events): self.bot = bot self.settings = {} self.channel_settings = {} - bot.events.on("postboot").on("configure").on("set").hook( + + events.on("postboot").on("configure").on("set").hook( self.postboot_set, replay=True) - bot.events.on("postboot").on("configure").on("channelset" + events.on("postboot").on("configure").on("channelset" ).hook(self.postboot_channelset, replay=True) - bot.events.on("received").on("command").on("set").hook( + events.on("received").on("command").on("set").hook( self.set, help="Set a specified user setting", usage="<setting> <value>") - bot.events.on("received").on("command").on("get").hook( + events.on("received").on("command").on("get").hook( self.get, help="Get a specified user setting", usage="<setting>", min_args=1) - bot.events.on("received").on("command").on("channelset" + events.on("received").on("command").on("channelset" ).hook(self.channel_set, channel_only=True, help="Set a specified setting for the current channel", usage="<setting> <value>", require_mode="o") - bot.events.on("received").on("command").on("channelsetoverride" + events.on("received").on("command").on("channelsetoverride" ).hook(self.channel_set, channel_only=True, help="Set a specified setting for the current channel", usage="<setting> <value>", permission="channelsetoverride") - bot.events.on("received").on("command").on("channelget" + events.on("received").on("command").on("channelget" ).hook(self.channel_get, channel_only=True, help="Get a specified setting for the current channel", usage="<setting>", min_args=1, require_mode="o") |
