From d9fd9fdaf0a833b8dca5a1d573160a2510bde3e2 Mon Sep 17 00:00:00 2001 From: Joerg Schultze-Lutter Date: Sat, 3 Apr 2021 01:49:58 +0200 Subject: [PATCH] Bug fix for cases where a generic error msg was sent to user --- src/aprs_listener.py | 13 +++++-------- src/input_parser.py | 4 +++- src/parser_test.py | 13 +++++-------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/aprs_listener.py b/src/aprs_listener.py index 4f7034f..8f1faa7 100644 --- a/src/aprs_listener.py +++ b/src/aprs_listener.py @@ -314,21 +314,18 @@ def mycallback(raw_aprs_packet: dict): human_readable_message = response_parameters[ "human_readable_message" ] - output_message = [] # Dump the HRM to the user if we have one if human_readable_message: output_message = make_pretty_aprs_messages( message_to_add=f"{human_readable_message}", - destination_list=output_message, + add_sep=False, ) # If not, just dump the link to the instructions else: - output_message.append( - "Sorry, did not understand your request. Have a look at my command" - ) - output_message.append( - "syntax, see https://github.com/joergschultzelutter/mpad" - ) + output_message = [ + "Sorry, did not understand your request. Have a look at my command", + "syntax, see https://github.com/joergschultzelutter/mpad", + ] logger.info( msg=f"Unable to process APRS packet {raw_aprs_packet}" ) diff --git a/src/input_parser.py b/src/input_parser.py index c70be59..cc5ec3c 100644 --- a/src/input_parser.py +++ b/src/input_parser.py @@ -45,7 +45,9 @@ errmsg_cannot_find_coords_for_user: str = "Cannot find coordinates for callsign" errmsg_invalid_country: str = "Invalid country code (need ISO3166-a2)" errmsg_invalid_state: str = "Invalid US state" -errmsg_invalid_command: str = "Unknown command. Syntax:https://github.com/joergschultzelutter/mpad" +errmsg_invalid_command: str = ( + "Unknown command. See https://github.com/joergschultzelutter/mpad" +) errmsg_no_satellite_specified: str = "No satellite specified" errmsg_no_cwop_specified: str = "No cwop id specified" diff --git a/src/parser_test.py b/src/parser_test.py index b0dc3f9..ae38615 100644 --- a/src/parser_test.py +++ b/src/parser_test.py @@ -56,24 +56,21 @@ def testcall(message_text: str, from_callsign: str): human_readable_message = response_parameters[ "human_readable_message" ] - output_message = [] # Dump the HRM to the user if we have one if human_readable_message: output_message = make_pretty_aprs_messages( message_to_add=f"{human_readable_message}", - destination_list=output_message, + add_sep=False, ) # If not, just dump the link to the instructions else: - output_message.append( - "Sorry, did not understand your request. Have a look at my command" - ) - output_message.append( + output_message = [ + "Sorry, did not understand your request. Have a look at my command", "syntax, see https://github.com/joergschultzelutter/mpad" - ) + ] logger.info(output_message) #logger.info(msg=pformat(response_parameters)) if __name__ == "__main__": - testcall(message_text="whereis vriendschap", from_callsign="ua3mlr-9") + testcall(message_text="fhadsjfhjdsahf", from_callsign="ua3mlr-9")