diff --git a/example-conf.yml b/example-conf.yml index d738085..1d964b3 100644 --- a/example-conf.yml +++ b/example-conf.yml @@ -49,6 +49,11 @@ bot: # even if the command was called in a channel. This defaults to False. #prefer_private_replies: false + # Determines whether spawning additional services for bots (e.g. Automode, Games) should be + # enabled. This defaults to True, unless a network's protocol module doesn't support spawning + # extra service bots. + #spawn_services: true + login: # NOTE: for users migrating from PyLink < 1.1, the old login:user/login:password settings # have been deprecated. We strongly recommend migrating to the new "accounts:" block below, as @@ -575,6 +580,11 @@ automode: # the risk of mode overrides being dropped. joinmodes: 'o' + # Determines whether a separate service bot should be spawned for this plugin. This defaults to + # True, unless a network's protocol module doesn't support spawning extra service bots. + # This option overrides the global "spawn_services" option defined in "bot:". + #spawn_service: true + games: # Sets the nick of the Games service, if you're using it. This defaults to "games" if not defined. nick: Games diff --git a/utils.py b/utils.py index 875832d..01bcab1 100644 --- a/utils.py +++ b/utils.py @@ -487,6 +487,11 @@ def registerService(name, *args, **kwargs): if name in world.services: raise ValueError("Service name %s is already bound!" % name) + # Allow disabling service spawning either globally or by service. + elif name != 'pylink' and not (conf.conf.get(name, {}).get('spawn_service', + conf.conf['bot'].get('spawn_services', True))): + return world.services['pylink'] + world.services[name] = sbot = ServiceBot(name, *args, **kwargs) sbot.spawn() return sbot