ircbot: specify commands after connecting
happens before the sleep and the autojoins
This commit is contained in:
		
							parent
							
								
									f0072fb633
								
							
						
					
					
						commit
						bef66e3427
					
				@ -133,6 +133,7 @@ IRCBOT_IPV6 = False
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# post-connect, pre-autojoin stuff
 | 
					# post-connect, pre-autojoin stuff
 | 
				
			||||||
IRCBOT_SLEEP_BEFORE_AUTOJOIN_SECONDS = 10
 | 
					IRCBOT_SLEEP_BEFORE_AUTOJOIN_SECONDS = 10
 | 
				
			||||||
 | 
					IRCBOT_POST_CONNECT_COMMANDS = [ ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# XML-RPC settings
 | 
					# XML-RPC settings
 | 
				
			||||||
 | 
				
			|||||||
@ -469,6 +469,11 @@ class IRCBot(irc.client.SimpleIRCClient):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        log.debug("welcome: %s", what)
 | 
					        log.debug("welcome: %s", what)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # run automsg commands
 | 
				
			||||||
 | 
					        for cmd in settings.IRCBOT_POST_CONNECT_COMMANDS:
 | 
				
			||||||
 | 
					            # TODO NOTE: if the bot is sending something that changes the vhost
 | 
				
			||||||
 | 
					            # (like 'hostserv on') we don't pick it up
 | 
				
			||||||
 | 
					            self.connection.privmsg(cmd.split(' ')[0], ' '.join(cmd.split(' ')[1:]))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # sleep before doing autojoins
 | 
					        # sleep before doing autojoins
 | 
				
			||||||
        time.sleep(settings.IRCBOT_SLEEP_BEFORE_AUTOJOIN_SECONDS)
 | 
					        time.sleep(settings.IRCBOT_SLEEP_BEFORE_AUTOJOIN_SECONDS)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user