log misunderstood network commands
This commit is contained in:
		
							parent
							
								
									cbbdb2948d
								
							
						
					
					
						commit
						fe17fc6320
					
				| 
						 | 
					@ -11,6 +11,7 @@ import subprocess
 | 
				
			||||||
import base64
 | 
					import base64
 | 
				
			||||||
import re
 | 
					import re
 | 
				
			||||||
import shutil
 | 
					import shutil
 | 
				
			||||||
 | 
					from json import loads, dumps
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from random import randrange
 | 
					from random import randrange
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -808,7 +809,11 @@ def convert_unknown_missing(missing_items: list) -> list:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async def process_server_cmd(ctx: Context, args: dict):
 | 
					async def process_server_cmd(ctx: Context, args: dict):
 | 
				
			||||||
    cmd = args["cmd"]
 | 
					    try:
 | 
				
			||||||
 | 
					        cmd = args["cmd"]
 | 
				
			||||||
 | 
					    except:
 | 
				
			||||||
 | 
					        logger.exception(f"Could not get command from {args}")
 | 
				
			||||||
 | 
					        raise
 | 
				
			||||||
    if cmd == 'RoomInfo':
 | 
					    if cmd == 'RoomInfo':
 | 
				
			||||||
        logger.info('--------------------------------')
 | 
					        logger.info('--------------------------------')
 | 
				
			||||||
        logger.info('Room Information:')
 | 
					        logger.info('Room Information:')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -498,8 +498,9 @@ def register_location_checks(ctx: Context, team: int, slot: int, locations: typi
 | 
				
			||||||
                        recvd_items.append(new_item)
 | 
					                        recvd_items.append(new_item)
 | 
				
			||||||
                        if slot != target_player:
 | 
					                        if slot != target_player:
 | 
				
			||||||
                            ctx.broadcast_team(team,
 | 
					                            ctx.broadcast_team(team,
 | 
				
			||||||
                                               [['ItemSent', {"item": new_item,
 | 
					                                               [{"cmd": "ItemSent",
 | 
				
			||||||
                                                              "receiver" : target_player}]])
 | 
					                                                 "item": new_item,
 | 
				
			||||||
 | 
					                                                 "receiver" : target_player}])
 | 
				
			||||||
                    logging.info('(Team #%d) %s sent %s to %s (%s)' % (
 | 
					                    logging.info('(Team #%d) %s sent %s to %s (%s)' % (
 | 
				
			||||||
                    team + 1, ctx.player_names[(team, slot)], get_item_name_from_id(target_item),
 | 
					                    team + 1, ctx.player_names[(team, slot)], get_item_name_from_id(target_item),
 | 
				
			||||||
                    ctx.player_names[(team, target_player)], get_location_name_from_address(location)))
 | 
					                    ctx.player_names[(team, target_player)], get_location_name_from_address(location)))
 | 
				
			||||||
| 
						 | 
					@ -969,7 +970,11 @@ def get_client_points(ctx: Context, client: Client) -> int:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async def process_client_cmd(ctx: Context, client: Client, args: dict):
 | 
					async def process_client_cmd(ctx: Context, client: Client, args: dict):
 | 
				
			||||||
    cmd: str = args["cmd"]
 | 
					    try:
 | 
				
			||||||
 | 
					        cmd:str = args["cmd"]
 | 
				
			||||||
 | 
					    except:
 | 
				
			||||||
 | 
					        logging.exception(f"Could not get command from {args}")
 | 
				
			||||||
 | 
					        raise
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if type(cmd) is not str:
 | 
					    if type(cmd) is not str:
 | 
				
			||||||
        await ctx.send_msgs(client, [{"cmd": "InvalidCmd", "text": f"Command should be str, got {type(cmd)}"}])
 | 
					        await ctx.send_msgs(client, [{"cmd": "InvalidCmd", "text": f"Command should be str, got {type(cmd)}"}])
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue