From 6c16566ee0f9c61cc7d6f822a007dfe666b0e6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Wed, 16 May 2018 22:06:45 +0200 Subject: [PATCH] Allow to join multiple channels --- bot.py | 7 ++++--- settings.cfg.example | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index dc733e1..c6a6ec4 100644 --- a/bot.py +++ b/bot.py @@ -66,7 +66,6 @@ class TwitchBot(irc.bot.SingleServerIRCBot): self.server = config['IRC'].get('server', 'irc.chat.twitch.tv') self.port = config['IRC'].getint('port', 6667) self.nickname = config['IRC'].get('nickname') - self.channel = '#{0}'.format(config['IRC'].get('channel')) self.token = config['Twitch'].get('token') self.master_user_id = config['Twitch'].getint('master_user_id') self.api_url = config['Quotes'].get('api_url') @@ -94,8 +93,10 @@ class TwitchBot(irc.bot.SingleServerIRCBot): connection.cap('REQ', ':twitch.tv/membership') connection.cap('REQ', ':twitch.tv/tags') connection.cap('REQ', ':twitch.tv/commands') - log.info('Joining %s', self.channel) - connection.join(self.channel) + for channel in config['IRC'].get('channels').split(','): + channel = '#{0}'.format(channel) + log.info('Joining %s', channel) + connection.join(channel) def on_join(self, connection, event): log.info('Joined %s', event.target) diff --git a/settings.cfg.example b/settings.cfg.example index c8979c8..9d2b0cc 100644 --- a/settings.cfg.example +++ b/settings.cfg.example @@ -2,7 +2,7 @@ server = irc.chat.twitch.tv port = 6667 nickname = spooky_lurker -channel = lilialil +channels = lilialil [Instagram] username = lilialovesgames