mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-11-04 00:47:21 +01:00 
			
		
		
		
	service_support: skip dynamic join/part hooks on bot-only servers
This commit is contained in:
		
							parent
							
								
									78d1d20856
								
							
						
					
					
						commit
						0ead868546
					
				@ -131,6 +131,10 @@ utils.add_hook(handle_kill, 'KILL')
 | 
			
		||||
 | 
			
		||||
def handle_join(irc, source, command, args):
 | 
			
		||||
    """Monitors channel joins for dynamic service bot joining."""
 | 
			
		||||
    if irc.has_cap('visible-state-only'):
 | 
			
		||||
        # No-op on bot-only servers.
 | 
			
		||||
        return
 | 
			
		||||
 | 
			
		||||
    channel = args['channel']
 | 
			
		||||
    users = irc.channels[channel].users
 | 
			
		||||
    for servicename, sbot in world.services.items():
 | 
			
		||||
@ -143,6 +147,10 @@ utils.add_hook(handle_join, 'PYLINK_SERVICE_JOIN')
 | 
			
		||||
 | 
			
		||||
def _services_dynamic_part(irc, channel):
 | 
			
		||||
    """Dynamically removes service bots from empty channels."""
 | 
			
		||||
    if irc.has_cap('visible-state-only'):
 | 
			
		||||
        # No-op on bot-only servers.
 | 
			
		||||
        return
 | 
			
		||||
 | 
			
		||||
    # If all remaining users in the channel are service bots, make them all part.
 | 
			
		||||
    if all(irc.is_internal_client(u) for u in irc.channels[channel].users):
 | 
			
		||||
        for u in irc.channels[channel].users.copy():
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user