mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-11-04 08:57:25 +01:00 
			
		
		
		
	ServiceBot: implement global and per-service spawn_service(s) options (#403)
This commit is contained in:
		
							parent
							
								
									a776aab897
								
							
						
					
					
						commit
						75b5be5baf
					
				@ -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
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								utils.py
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user