revert PrintJSON to use key data, to match with documented behaviour
This commit is contained in:
		
							parent
							
								
									7871555620
								
							
						
					
					
						commit
						0917f21384
					
				|  | @ -945,7 +945,7 @@ async def process_server_cmd(ctx: Context, args: dict): | ||||||
|         logger.info(args["text"]) |         logger.info(args["text"]) | ||||||
| 
 | 
 | ||||||
|     elif cmd == 'PrintJSON': |     elif cmd == 'PrintJSON': | ||||||
|         logger.info(ctx.jsontotextparser(args["text"])) |         logger.info(ctx.jsontotextparser(args["data"])) | ||||||
| 
 | 
 | ||||||
|     elif cmd == 'InvalidArguments': |     elif cmd == 'InvalidArguments': | ||||||
|         logger.warning(f"Invalid Arguments: {args['text']}") |         logger.warning(f"Invalid Arguments: {args['text']}") | ||||||
|  |  | ||||||
|  | @ -332,14 +332,18 @@ async def server(websocket, path, ctx: Context): | ||||||
|     ctx.endpoints.append(client) |     ctx.endpoints.append(client) | ||||||
| 
 | 
 | ||||||
|     try: |     try: | ||||||
|  |         logging.info("Incoming") | ||||||
|         await on_client_connected(ctx, client) |         await on_client_connected(ctx, client) | ||||||
|  |         logging.info("Sent Room Info") | ||||||
|         async for data in websocket: |         async for data in websocket: | ||||||
|  |             logging.info(data) | ||||||
|             for msg in decode(data): |             for msg in decode(data): | ||||||
|                 await process_client_cmd(ctx, client, msg) |                 await process_client_cmd(ctx, client, msg) | ||||||
|     except Exception as e: |     except Exception as e: | ||||||
|         if not isinstance(e, websockets.WebSocketException): |         if not isinstance(e, websockets.WebSocketException): | ||||||
|             logging.exception(e) |             logging.exception(e) | ||||||
|     finally: |     finally: | ||||||
|  |         logging.info("Disconnected") | ||||||
|         await ctx.disconnect(client) |         await ctx.disconnect(client) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -530,7 +534,7 @@ def json_format_send_event(net_item: NetworkItem, receiving_player: int): | ||||||
|     NetUtils.add_json_text(parts, net_item.location, type=NetUtils.JSONTypes.location_id) |     NetUtils.add_json_text(parts, net_item.location, type=NetUtils.JSONTypes.location_id) | ||||||
|     NetUtils.add_json_text(parts, ")") |     NetUtils.add_json_text(parts, ")") | ||||||
| 
 | 
 | ||||||
|     return {"cmd": "PrintJSON", "text": parts, "type": "ItemSend", |     return {"cmd": "PrintJSON", "data": parts, "type": "ItemSend", | ||||||
|             "receiving": receiving_player, "sending": net_item.player} |             "receiving": receiving_player, "sending": net_item.player} | ||||||
| 
 | 
 | ||||||
| def get_intended_text(input_text: str, possible_answers: typing.Iterable[str]= console_names) -> typing.Tuple[str, bool, str]: | def get_intended_text(input_text: str, possible_answers: typing.Iterable[str]= console_names) -> typing.Tuple[str, bool, str]: | ||||||
|  |  | ||||||
|  | @ -274,4 +274,4 @@ class Hint(typing.NamedTuple): | ||||||
|         else: |         else: | ||||||
|             add_json_text(parts, ".") |             add_json_text(parts, ".") | ||||||
| 
 | 
 | ||||||
|         return {"cmd": "PrintJSON", "text": parts, "type": "hint"} |         return {"cmd": "PrintJSON", "data": parts, "type": "hint"} | ||||||
		Loading…
	
		Reference in New Issue