From c0d108ee77d562ac84f42fb87d6e7336d77d1360 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 18 Sep 2024 16:35:29 -0700 Subject: [PATCH] enhance --- etc/simulator.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/etc/simulator.py b/etc/simulator.py index 290f52c..da4c691 100644 --- a/etc/simulator.py +++ b/etc/simulator.py @@ -41,10 +41,16 @@ if __name__ == '__main__': # represents the bot's main loop projectResponse = "" responseLength = 0 if packet != "": - projectResponse = globals()[projectName](nodeID, packet) # Call the project handler under test - responseLength = len(projectResponse) # Evaluate the response length - logger.info(f"Device:{nodeInt} " + CustomFormatter.red + f"Sending {responseLength} long DM: " +\ + try: + projectResponse = globals()[projectName](nodeID, packet) # Call the project handler under test + except Exception as e: + logger.error(f"System: Handler: {e}") + projectResponse = "Error in handler" + # if responce has value get length + if projectResponse: + responseLength = len(projectResponse) # Evaluate the response length + logger.info(f"Device:{nodeInt} " + CustomFormatter.red + f"Sending {responseLength} long DM: " +\ CustomFormatter.white + projectResponse + CustomFormatter.purple + " To: " + CustomFormatter.white + str(nodeID)) packet = input("CLIENT INPUT: " ) # Emulate the client input - time.sleep(1) + time.sleep(0.5) # # End of launcher