Modchat for mods to chat secretly across areas.
Called with `/m [message]`.
This commit is contained in:
		
							parent
							
								
									3759131a8f
								
							
						
					
					
						commit
						d444eb6dce
					
				@ -343,6 +343,14 @@ def ooc_cmd_gm(client, arg):
 | 
			
		||||
    client.server.broadcast_global(client, arg, True)
 | 
			
		||||
    logger.log_server('[{}][{}][GLOBAL-MOD]{}.'.format(client.area.id, client.get_char_name(), arg), client)
 | 
			
		||||
    
 | 
			
		||||
def ooc_cmd_m(client, arg):
 | 
			
		||||
    if not client.is_mod:
 | 
			
		||||
        raise ClientError('You must be authorized to do that.')
 | 
			
		||||
    if len(arg) == 0:
 | 
			
		||||
        raise ArgumentError("You can't send an empty message.")
 | 
			
		||||
    client.server.send_modchat(client, arg)
 | 
			
		||||
    logger.log_server('[{}][{}][MODCHAT]{}.'.format(client.area.id, client.get_char_name(), arg), client)
 | 
			
		||||
    
 | 
			
		||||
def ooc_cmd_lm(client, arg):
 | 
			
		||||
    if not client.is_mod:
 | 
			
		||||
        raise ClientError('You must be authorized to do that.')
 | 
			
		||||
 | 
			
		||||
@ -240,6 +240,14 @@ class TsuServer3:
 | 
			
		||||
            self.district_client.send_raw_message(
 | 
			
		||||
                'GLOBAL#{}#{}#{}#{}'.format(int(as_mod), client.area.id, char_name, msg))
 | 
			
		||||
 | 
			
		||||
    def send_modchat(self, client, msg):
 | 
			
		||||
        name = client.name
 | 
			
		||||
        ooc_name = '{}[{}][{}]'.format('<dollar>M', client.area.get_abbreviation(), name)
 | 
			
		||||
        self.send_all_cmd_pred('CT', ooc_name, msg, pred=lambda x: x.is_mod)
 | 
			
		||||
        if self.config['use_district']:
 | 
			
		||||
            self.district_client.send_raw_message(
 | 
			
		||||
                'MODCHAT#{}#{}#{}'.format(client.area.id, char_name, msg))
 | 
			
		||||
 | 
			
		||||
    def broadcast_need(self, client, msg):
 | 
			
		||||
        char_name = client.get_char_name()
 | 
			
		||||
        area_name = client.area.name
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user