diff --git a/coremods/service_support.py b/coremods/service_support.py index 32e6075..93ec013 100644 --- a/coremods/service_support.py +++ b/coremods/service_support.py @@ -50,7 +50,9 @@ def spawn_service(irc, source, command, args): # TODO: channels should be tracked in a central database, not hardcoded # in conf. - for chan in irc.serverdata['channels']: + channels = set(irc.serverdata.get('channels', [])) | sbot.extra_channels + + for chan in channels: irc.proto.join(u, chan) utils.add_hook(spawn_service, 'PYLINK_NEW_SERVICE') diff --git a/utils.py b/utils.py index 664db5b..632ed20 100644 --- a/utils.py +++ b/utils.py @@ -148,7 +148,7 @@ def getDatabaseName(dbname): class ServiceBot(): def __init__(self, name, default_help=True, default_request=False, default_list=True, - nick=None, ident=None, manipulatable=False): + nick=None, ident=None, manipulatable=False, extra_channels=set()): # Service name self.name = name @@ -168,6 +168,10 @@ class ServiceBot(): # spawned. self.uids = {} + # Track what channels other than those defined in the config + # that the bot should join by default. + self.extra_channels = extra_channels + if default_help: self.add_cmd(self.help)