diff options
| author | 2016-03-29 12:56:58 +0100 | |
|---|---|---|
| committer | 2016-03-29 12:56:58 +0100 | |
| commit | f943d63098a50746f4e470e403a991a4d9713030 (patch) | |
| tree | deeb98058917d0155227211d72576f0cbab28d3f /modules/channel_save.py | |
| parent | Initial commit (diff) | |
first commit.
Diffstat (limited to 'modules/channel_save.py')
| -rw-r--r-- | modules/channel_save.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/channel_save.py b/modules/channel_save.py new file mode 100644 index 00000000..cb950ed2 --- /dev/null +++ b/modules/channel_save.py @@ -0,0 +1,18 @@ + + +class Module(object): + def __init__(self, bot): + bot.events.on("self").on("join").hook(self.on_join) + bot.events.on("received").on("numeric").on("366").hook( + self.on_connect) + + def on_join(self, event): + channels = set(event["server"].get_setting("autojoin", [])) + channels.add(event["channel"].name) + event["server"].set_setting("autojoin", list(channels)) + + def on_connect(self, event): + if event["line_split"][3].lower() == "#bitbot": + channels = event["server"].get_setting("autojoin", []) + for channel in channels: + event["server"].send_join(channel) |
