Module: new_sendmsg, embrace one-connection idiom
since we've been saying that the rule is one bot, one connection, we don't need to pass said connections around as much. this new_sendmsg(), which should eventually become sendmsg(), uses that, and leans on irc.server instead
This commit is contained in:
		
							parent
							
								
									77ada246c7
								
							
						
					
					
						commit
						30a395bc05
					
				
							
								
								
									
										17
									
								
								Module.py
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								Module.py
									
									
									
									
									
								
							| @ -140,6 +140,23 @@ class Module(object): | ||||
|                 for line in msgs: | ||||
|                     connection.privmsg(target, line) | ||||
| 
 | ||||
|     def new_sendmsg(self,target, msg): | ||||
|         """Send a privmsg over IRC to target. | ||||
| 
 | ||||
|         This should replace Module.sendmsg() once all code has been converted. | ||||
| 
 | ||||
|         Args: | ||||
|             target      destination on the network | ||||
|             msg         the message to send | ||||
| 
 | ||||
|         """ | ||||
| 
 | ||||
|         if msg is not None: | ||||
|             if target is not None: | ||||
|                 msgs = msg.split('\n') | ||||
|                 for line in msgs: | ||||
|                     self.irc.server.privmsg(target, line) | ||||
| 
 | ||||
|     def save(self): | ||||
|         """Save whatever the module may need to save. Sync files, etc. | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user