log misunderstood network commands

This commit is contained in:
Fabian Dill 2021-02-21 23:54:08 +01:00
parent cbbdb2948d
commit fe17fc6320
2 changed files with 14 additions and 4 deletions

View File

@ -11,6 +11,7 @@ import subprocess
import base64
import re
import shutil
from json import loads, dumps
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):
cmd = args["cmd"]
try:
cmd = args["cmd"]
except:
logger.exception(f"Could not get command from {args}")
raise
if cmd == 'RoomInfo':
logger.info('--------------------------------')
logger.info('Room Information:')

View File

@ -498,8 +498,9 @@ def register_location_checks(ctx: Context, team: int, slot: int, locations: typi
recvd_items.append(new_item)
if slot != target_player:
ctx.broadcast_team(team,
[['ItemSent', {"item": new_item,
"receiver" : target_player}]])
[{"cmd": "ItemSent",
"item": new_item,
"receiver" : target_player}])
logging.info('(Team #%d) %s sent %s to %s (%s)' % (
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)))
@ -969,7 +970,11 @@ def get_client_points(ctx: Context, client: Client) -> int:
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:
await ctx.send_msgs(client, [{"cmd": "InvalidCmd", "text": f"Command should be str, got {type(cmd)}"}])