support for manipulating the autojoin list
This commit is contained in:
		
							parent
							
								
									c12dd27d81
								
							
						
					
					
						commit
						90df8db714
					
				
							
								
								
									
										16
									
								
								dr.botzo.py
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								dr.botzo.py
									
									
									
									
									
								
							@ -55,6 +55,22 @@ def on_privmsg(connection, event):
 | 
			
		||||
        connection.quit(' '.join(what.split(' ')[1:]))
 | 
			
		||||
        with open('dr.botzo.cfg', 'w') as cfg:
 | 
			
		||||
            config.write(cfg)
 | 
			
		||||
    # add/remove channel to/from autojoin list
 | 
			
		||||
    elif what.split(' ')[0] == 'autojoin' and admin_unlocked:
 | 
			
		||||
        if what.split(' ')[1] == 'add':
 | 
			
		||||
            try:
 | 
			
		||||
                # get existing list
 | 
			
		||||
                channelset = set(config.get('channels', 'autojoin').split(','))
 | 
			
		||||
                channelset.add(what.split(' ')[2])
 | 
			
		||||
                config.set('channels', 'autojoin', ','.join(channelset))
 | 
			
		||||
            except NoOptionError: pass
 | 
			
		||||
        elif what.split(' ')[1] == 'remove':
 | 
			
		||||
            try:
 | 
			
		||||
                # get existing list
 | 
			
		||||
                channelset = set(config.get('channels', 'autojoin').split(','))
 | 
			
		||||
                channelset.discard(what.split(' ')[2])
 | 
			
		||||
                config.set('channels', 'autojoin', ','.join(channelset))
 | 
			
		||||
            except NoOptionError: pass
 | 
			
		||||
 | 
			
		||||
#####
 | 
			
		||||
# init
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user