From f6215d3563eaa14faae4a9841eeb41365eee72e4 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 02:02:26 +0100 Subject: [PATCH 01/29] Tidied up, added a few help messages. --- config.template | 2 +- mesh_bot.py | 79 +++++++++++++++++++++++++++++------------------ modules/system.py | 2 +- 3 files changed, 51 insertions(+), 32 deletions(-) diff --git a/config.template b/config.template index 0aa9384..8e8ee45 100644 --- a/config.template +++ b/config.template @@ -25,7 +25,7 @@ port = /dev/ttyUSB0 [general] # if False will respond on all channels but the default channel respond_by_dm_only = True -# defaultChannel is the meshtastic default public channel +# defaultChannel is the meshtastic default public channel, e.g. LongFast defaultChannel = 0 # motd is reset to this value on boot motd = Thanks for using MeshBOT! Have a good day! diff --git a/mesh_bot.py b/mesh_bot.py index c09eb71..fd6cf08 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -24,15 +24,15 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n # Command List default_commands = { - "ping": lambda: handle_ping(message, hop, snr, rssi), + "ping": lambda: handle_ping(message, hop, snr, rssi, isDM), "pong": lambda: "🏓PING!!", - "motd": lambda: handle_motd(message, message_from_id), + "motd": lambda: handle_motd(message, message_from_id, isDM), "bbshelp": bbs_help, "wxalert": lambda: handle_wxalert(message_from_id, deviceID, message), "wxa": lambda: handle_wxalert(message_from_id, deviceID, message), "wxc": lambda: handle_wxc(message_from_id, deviceID, 'wxc'), "wx": lambda: handle_wxc(message_from_id, deviceID, 'wx'), - "wiki:": lambda: handle_wiki(message), + "wiki:": lambda: handle_wiki(message, isDM), "games": lambda: gamesCmdList, "dopewars": lambda: handleDopeWars(message_from_id, message, deviceID), "lemonstand": lambda: handleLemonade(message_from_id, message), @@ -46,9 +46,9 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "bbspost": lambda: handle_bbspost(message, message_from_id, deviceID), "bbsread": lambda: handle_bbsread(message), "bbsdelete": lambda: handle_bbsdelete(message, message_from_id), - "messages": lambda: handle_messages(deviceID, channel_number, msg_history, publicChannel), + "messages": lambda: handle_messages(deviceID, channel_number, msg_history, publicChannel, isDM), "cmd": lambda: help_message, - "history": lambda: handle_history(message_from_id, deviceID), + "history": lambda: handle_history(message_from_id, deviceID, isDM), "sun": lambda: handle_sun(message_from_id, deviceID, channel_number), "hfcond": hf_band_conditions, "solar": lambda: drap_xray_conditions() + "\n" + solar_conditions(), @@ -97,8 +97,10 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n return bot_response -def handle_ping(message, hop, snr, rssi): - if "@" in message: +def handle_ping(message, hop, snr, rssi, isDM): + if "?" in message and isDM: + msg = "Ping command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" + elif "@" in message: if hop == "Direct": return "🏓PONG, " + f"SNR:{snr} RSSI:{rssi}" + " at: " + message.split("@")[1] else: @@ -114,7 +116,7 @@ def handle_ping(message, hop, snr, rssi): else: return "🏓PONG, " + hop -def handle_motd(message, message_from_id): +def handle_motd(message, message_from_id, isDM): global MOTD isAdmin = False msg = "" @@ -127,13 +129,18 @@ def handle_motd(message, message_from_id): else: isAdmin = True - if "$" in message and isAdmin: + if "?" in message and isDM and isAdmin: + msg = "Message of the day, set with 'motd $ HelloWorld!'" + elif "?" in message and isDM and not isAdmin: + msg = "Message of the day, set by Admin." + elif "$" in message and isAdmin: motd = message.split("$")[1] MOTD = motd.rstrip() logger.debug(f"System: {message_from_id} changed MOTD: {MOTD}") msg = "MOTD changed to: " + MOTD elif "?" in message: - msg = "Message of the day, set with 'motd $ HelloWorld!'" + logger.debug(f"System: {message_from_id} requested MOTD: {MOTD} isAdmin: {isAdmin}") + msg = "MOTD: " + MOTD else: logger.debug(f"System: {message_from_id} requested MOTD: {MOTD} isAdmin: {isAdmin}") msg = "MOTD: " + MOTD @@ -153,14 +160,17 @@ def handle_wxalert(message_from_id, deviceID, message): return weatherAlert -def handle_wiki(message): +def handle_wiki(message, isDM): # location = get_node_location(message_from_id, deviceID) if "wiki:" in message.lower(): search = message.split(":")[1] search = search.strip() if search: return get_wikipedia_summary(search) - return "Please add a search term example:wiki: travelling gnome" + return "Please add a search term example:wiki: travelling gnome" + elif "?" in message and isDM: + msg = "Wikipedia search function. \n Usage example:wiki: travelling gnome" + return msg # Runtime Variables for LLM llmRunCounter = 0 @@ -472,30 +482,39 @@ def handle_bbsdelete(message, message_from_id): elif not "example:" in message: return "Please add a message number example: bbsdelete #14" -def handle_messages(deviceID, channel_number, msg_history, publicChannel): - response = "" - for msgH in msg_history: - if msgH[4] == deviceID: - if msgH[2] == channel_number or msgH[2] == publicChannel: - response += f"\n{msgH[0]}: {msgH[1]}" - if len(response) > 0: - return "Message History:" + response +def handle_messages(deviceID, channel_number, msg_history, publicChannel, isDM): + if "?" in message and isDM: + msg = "Command returns the last " & list.msg_history.count() & " messages sent on a channel." + return msg else: - return "No messages in history" + response = "" + for msgH in msg_history: + if msgH[4] == deviceID: + if msgH[2] == channel_number or msgH[2] == publicChannel: + response += f"\n{msgH[0]}: {msgH[1]}" + if len(response) > 0: + return "Message History:" + response + else: + return "No messages in history" def handle_sun(message_from_id, deviceID, channel_number): location = get_node_location(message_from_id, deviceID, channel_number) return get_sun(str(location[0]), str(location[1])) -def handle_lheard(nodeid, deviceID): - # display last heard nodes add to response - bot_response = str(get_node_list(1)) - # gather telemetry - chutil1 = round(interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("channelUtilization", 0), 1) - airUtilTx = round(interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("airUtilTx", 0), 1) - uptimeSeconds = interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("uptimeSeconds", 0) - batteryLevel = interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("batteryLevel", 0) - voltage = interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("voltage", 0) +def handle_lheard(nodeid, deviceID, isDM): + if "?" in message and isDM: + msg = "Lists of nodes that this node has heard from recently." + return msg + else: + + # display last heard nodes add to response + bot_response = str(get_node_list(1)) + # gather telemetry + chutil1 = round(interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("channelUtilization", 0), 1) + airUtilTx = round(interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("airUtilTx", 0), 1) + uptimeSeconds = interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("uptimeSeconds", 0) + batteryLevel = interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("batteryLevel", 0) + voltage = interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("voltage", 0) if interface2_enabled: bot_response += "P2:\n" + str(get_node_list(2)) chutil2 = round(interface2.nodes.get(decimal_to_hex(myNodeNum2), {}).get("deviceMetrics", {}).get("channelUtilization", 0), 1) diff --git a/modules/system.py b/modules/system.py index 47be5a6..5af78b6 100644 --- a/modules/system.py +++ b/modules/system.py @@ -79,7 +79,7 @@ # Wikipedia Search Configuration if wikipedia_enabled: import wikipedia # pip install wikipedia - trap_list = trap_list + ("wiki:",) + trap_list = trap_list + ("wiki:", "wiki?",) help_message = help_message + ", wiki:" # LLM Configuration From 7e2be739623daeafca14db3d2a81becbcbb153ee Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Thu, 26 Sep 2024 14:17:29 +0100 Subject: [PATCH 02/29] Update mesh_bot.py --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index fd6cf08..13cbd88 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -52,7 +52,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "sun": lambda: handle_sun(message_from_id, deviceID, channel_number), "hfcond": hf_band_conditions, "solar": lambda: drap_xray_conditions() + "\n" + solar_conditions(), - "lheard": lambda: handle_lheard(message_from_id, deviceID), + "lheard": lambda: handle_lheard(message_from_id, deviceID, isDM), "sitrep": lambda: handle_lheard(message_from_id, deviceID), "whereami": lambda: handle_whereami(message_from_id, deviceID, channel_number), "tide": lambda: handle_tide(message_from_id, deviceID, channel_number), From 2f207dc3d94d6e7a3bdcf8daaafc92f081e8e219 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Thu, 26 Sep 2024 14:18:25 +0100 Subject: [PATCH 03/29] Update mesh_bot.py --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index 13cbd88..2aae071 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -53,7 +53,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "hfcond": hf_band_conditions, "solar": lambda: drap_xray_conditions() + "\n" + solar_conditions(), "lheard": lambda: handle_lheard(message_from_id, deviceID, isDM), - "sitrep": lambda: handle_lheard(message_from_id, deviceID), + "sitrep": lambda: handle_lheard(message_from_id, deviceID, isDM), "whereami": lambda: handle_whereami(message_from_id, deviceID, channel_number), "tide": lambda: handle_tide(message_from_id, deviceID, channel_number), "moon": lambda: handle_moon(message_from_id, deviceID, channel_number), From 7aeb8e851d082fc206038e78041e3fdb10f9a4d1 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Thu, 26 Sep 2024 14:24:27 +0100 Subject: [PATCH 04/29] Update mesh_bot.py --- mesh_bot.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 2aae071..9eee188 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -48,12 +48,12 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "bbsdelete": lambda: handle_bbsdelete(message, message_from_id), "messages": lambda: handle_messages(deviceID, channel_number, msg_history, publicChannel, isDM), "cmd": lambda: help_message, - "history": lambda: handle_history(message_from_id, deviceID, isDM), + "history": lambda: handle_history(message, message_from_id, deviceID, isDM), "sun": lambda: handle_sun(message_from_id, deviceID, channel_number), "hfcond": hf_band_conditions, "solar": lambda: drap_xray_conditions() + "\n" + solar_conditions(), - "lheard": lambda: handle_lheard(message_from_id, deviceID, isDM), - "sitrep": lambda: handle_lheard(message_from_id, deviceID, isDM), + "lheard": lambda: handle_lheard(message, message_from_id, deviceID, isDM), + "sitrep": lambda: handle_lheard(message, message_from_id, deviceID, isDM), "whereami": lambda: handle_whereami(message_from_id, deviceID, channel_number), "tide": lambda: handle_tide(message_from_id, deviceID, channel_number), "moon": lambda: handle_moon(message_from_id, deviceID, channel_number), @@ -501,12 +501,11 @@ def handle_sun(message_from_id, deviceID, channel_number): location = get_node_location(message_from_id, deviceID, channel_number) return get_sun(str(location[0]), str(location[1])) -def handle_lheard(nodeid, deviceID, isDM): +def handle_lheard(message, nodeid, deviceID, isDM): if "?" in message and isDM: msg = "Lists of nodes that this node has heard from recently." return msg else: - # display last heard nodes add to response bot_response = str(get_node_list(1)) # gather telemetry @@ -555,11 +554,15 @@ def handle_lheard(nodeid, deviceID, isDM): bot_response += f'\n{history}' return bot_response -def handle_history(nodeid, deviceID, lheard=False): +def handle_history(message, nodeid, deviceID, isDM, lheard=False): global cmdHistory, lheardCmdIgnoreNode, bbs_admin_list msg = "" buffer = [] + if "?" in message and isDM: + msg = "List of recent commands this node has received." + return msg + else: # show the last commands from the user to the bot if not lheard: for i in range(len(cmdHistory)): From 8540786c2c93e31816ce9a1cc9c0938489e7e21f Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 14:28:49 +0100 Subject: [PATCH 05/29] added help text to history --- mesh_bot.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 9eee188..59f3500 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -562,9 +562,8 @@ def handle_history(message, nodeid, deviceID, isDM, lheard=False): if "?" in message and isDM: msg = "List of recent commands this node has received." return msg - else: - # show the last commands from the user to the bot - if not lheard: + # show the last commands from the user to the bot + elif not lheard: for i in range(len(cmdHistory)): prettyTime = round((time.time() - cmdHistory[i]['time']) / 600) * 5 if prettyTime < 60: From c90172a862aaad84e82aefe4e202bfe6e2fc2fc6 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 14:31:58 +0100 Subject: [PATCH 06/29] fixed it --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index 59f3500..d700322 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -549,7 +549,7 @@ def handle_lheard(message, nodeid, deviceID, isDM): if interface2_enabled and not batteryLevel2 == 101: bot_response += f" P2: Bat: {batteryLevel2}% Volt: {voltage2}" # show last users of the bot with the cmdHistory list - history = handle_history(nodeid, deviceID, lheard=True) + history = handle_history(message, nodeid, deviceID, isDM, lheard=True) if history: bot_response += f'\n{history}' return bot_response From c5dc103ac0d7bf6538c10c373766c4b9b71629d9 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 15:28:48 +0100 Subject: [PATCH 07/29] compressed ping response --- mesh_bot.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index d700322..73d4615 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -57,9 +57,9 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "whereami": lambda: handle_whereami(message_from_id, deviceID, channel_number), "tide": lambda: handle_tide(message_from_id, deviceID, channel_number), "moon": lambda: handle_moon(message_from_id, deviceID, channel_number), - "ack": lambda: handle_ack(hop, snr, rssi), - "testing": lambda: handle_testing(message, hop, snr, rssi), - "test": lambda: handle_testing(message, hop, snr, rssi), + "ack": lambda: handle_ping(hop, snr, rssi), + "testing": lambda: handle_ping(message, hop, snr, rssi), + "test": lambda: handle_ping(message, hop, snr, rssi), "whoami": lambda: handle_whoami(message_from_id, deviceID, hop, snr, rssi, pkiStatus) } @@ -98,23 +98,32 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n return bot_response def handle_ping(message, hop, snr, rssi, isDM): + msg = "" + if "ping" in message: + msg = "🏓PONG, " + elif "test" in message or "testing" in message: + msg = random.choice("🎙Testing 1,2,3 ", "🎙Testing ", "🎙Testing, testing ",\ + "🎙Ah-wun, ah-two...", "🎙Is this thing on?", "🎙Roger that.") + elif "ack" in message: + msg = "✋ACK-ACK! " + if "?" in message and isDM: - msg = "Ping command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" + return "Ping, test, or ack command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" elif "@" in message: if hop == "Direct": - return "🏓PONG, " + f"SNR:{snr} RSSI:{rssi}" + " at: " + message.split("@")[1] + return msg + f"SNR:{snr} RSSI:{rssi}" + " at: " + message.split("@")[1] else: - return "🏓PONG, " + hop + " at: " + message.split("@")[1] + return msg + hop + " at: " + message.split("@")[1] elif "#" in message: if hop == "Direct": - return "🏓PONG, " + f"SNR:{snr} RSSI:{rssi}" + " #" + message.split("#")[1] + return msg + f"SNR:{snr} RSSI:{rssi}" + " #" + message.split("#")[1] else: - return "🏓PONG, " + hop + " #" + message.split("#")[1] + return msg + hop + " #" + message.split("#")[1] else: if hop == "Direct": - return "🏓PONG, " + f"SNR:{snr} RSSI:{rssi}" + return msg + f"SNR:{snr} RSSI:{rssi}" else: - return "🏓PONG, " + hop + return msg + hop def handle_motd(message, message_from_id, isDM): global MOTD From 7eb33a5aefe3dec36f6a595b2dfd5fba43acf29c Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 18:56:36 +0100 Subject: [PATCH 08/29] sdfsdfsdf --- mesh_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 73d4615..59c4440 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -46,7 +46,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "bbspost": lambda: handle_bbspost(message, message_from_id, deviceID), "bbsread": lambda: handle_bbsread(message), "bbsdelete": lambda: handle_bbsdelete(message, message_from_id), - "messages": lambda: handle_messages(deviceID, channel_number, msg_history, publicChannel, isDM), + "messages": lambda: handle_messages(message, deviceID, channel_number, msg_history, publicChannel, isDM), "cmd": lambda: help_message, "history": lambda: handle_history(message, message_from_id, deviceID, isDM), "sun": lambda: handle_sun(message_from_id, deviceID, channel_number), @@ -491,7 +491,7 @@ def handle_bbsdelete(message, message_from_id): elif not "example:" in message: return "Please add a message number example: bbsdelete #14" -def handle_messages(deviceID, channel_number, msg_history, publicChannel, isDM): +def handle_messages(message, deviceID, channel_number, msg_history, publicChannel, isDM): if "?" in message and isDM: msg = "Command returns the last " & list.msg_history.count() & " messages sent on a channel." return msg From d7901ee575c7284802b8d1ae8aa8e2f33071d89f Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 18:57:55 +0100 Subject: [PATCH 09/29] sdfsdfsd --- mesh_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 59c4440..2c2f5e2 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -57,9 +57,9 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "whereami": lambda: handle_whereami(message_from_id, deviceID, channel_number), "tide": lambda: handle_tide(message_from_id, deviceID, channel_number), "moon": lambda: handle_moon(message_from_id, deviceID, channel_number), - "ack": lambda: handle_ping(hop, snr, rssi), - "testing": lambda: handle_ping(message, hop, snr, rssi), - "test": lambda: handle_ping(message, hop, snr, rssi), + "ack": lambda: handle_ping(message, hop, snr, rssi, isDM), + "testing": lambda: handle_ping(message, hop, snr, rssi, isDM), + "test": lambda: handle_ping(message, hop, snr, rssi, isDM), "whoami": lambda: handle_whoami(message_from_id, deviceID, hop, snr, rssi, pkiStatus) } From 9290fac899e3e8aaf1c2241e1f49033aa464cae9 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 21:03:43 +0100 Subject: [PATCH 10/29] I think I consolidated the pings... --- mesh_bot.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 2c2f5e2..1d37d52 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -25,7 +25,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n # Command List default_commands = { "ping": lambda: handle_ping(message, hop, snr, rssi, isDM), - "pong": lambda: "🏓PING!!", + "pong": lambda: " PING!! 🏓", "motd": lambda: handle_motd(message, message_from_id, isDM), "bbshelp": bbs_help, "wxalert": lambda: handle_wxalert(message_from_id, deviceID, message), @@ -59,7 +59,8 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "moon": lambda: handle_moon(message_from_id, deviceID, channel_number), "ack": lambda: handle_ping(message, hop, snr, rssi, isDM), "testing": lambda: handle_ping(message, hop, snr, rssi, isDM), - "test": lambda: handle_ping(message, hop, snr, rssi, isDM), + "test": lambda: + .(message, hop, snr, rssi, isDM), "whoami": lambda: handle_whoami(message_from_id, deviceID, hop, snr, rssi, pkiStatus) } @@ -98,32 +99,31 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n return bot_response def handle_ping(message, hop, snr, rssi, isDM): + if "?" in message and isDM: + return message.split("?")[0].title() + " command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" + msg = "" if "ping" in message: - msg = "🏓PONG, " + msg = "🏓PONG\n" elif "test" in message or "testing" in message: - msg = random.choice("🎙Testing 1,2,3 ", "🎙Testing ", "🎙Testing, testing ",\ - "🎙Ah-wun, ah-two...", "🎙Is this thing on?", "🎙Roger that.") + msg = random.choice(["🎙Testing 1,2,3\n", "🎙Testing\n",\ + "🎙Testing, testing\n",\ + "🎙Ah-wun, ah-two...\n", "🎙Is this thing on?\n",\ + "🎙Roger that.\n", "Ack to you!\n"]) elif "ack" in message: - msg = "✋ACK-ACK! " + msg = "✋ACK-ACK!\n" + + if hop == "Direct": + msg = msg + f"SNR:{snr} RSSI:{rssi}" + else: + msg = msg + hop - if "?" in message and isDM: - return "Ping, test, or ack command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" - elif "@" in message: - if hop == "Direct": - return msg + f"SNR:{snr} RSSI:{rssi}" + " at: " + message.split("@")[1] - else: - return msg + hop + " at: " + message.split("@")[1] + if "@" in message: + return msg + "@" + message.split("@")[1] elif "#" in message: - if hop == "Direct": - return msg + f"SNR:{snr} RSSI:{rssi}" + " #" + message.split("#")[1] - else: - return msg + hop + " #" + message.split("#")[1] + return msg + "#" + message.split("#")[1] else: - if hop == "Direct": - return msg + f"SNR:{snr} RSSI:{rssi}" - else: - return msg + hop + return msg def handle_motd(message, message_from_id, isDM): global MOTD From b6084822200223a8120a4b5ed9dc4b00a03b9c18 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 21:05:11 +0100 Subject: [PATCH 11/29] typo --- mesh_bot.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 1d37d52..c642c1c 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -59,9 +59,8 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "moon": lambda: handle_moon(message_from_id, deviceID, channel_number), "ack": lambda: handle_ping(message, hop, snr, rssi, isDM), "testing": lambda: handle_ping(message, hop, snr, rssi, isDM), - "test": lambda: - .(message, hop, snr, rssi, isDM), - "whoami": lambda: handle_whoami(message_from_id, deviceID, hop, snr, rssi, pkiStatus) + "test": lambda: handle_ping(message, hop, snr, rssi, isDM), + "whoami": lambda: handle_whoami(message_from_id, deviceID, hop, snr, rssi, pkiStatus), } # set the command handler From 2c9b37a0cc40a16f7ea4bca40a06195b7578b624 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 21:09:53 +0100 Subject: [PATCH 12/29] sdfsdfsdf --- mesh_bot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index c642c1c..b84a778 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -25,7 +25,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n # Command List default_commands = { "ping": lambda: handle_ping(message, hop, snr, rssi, isDM), - "pong": lambda: " PING!! 🏓", + "pong": lambda: "/n PING!! 🏓", "motd": lambda: handle_motd(message, message_from_id, isDM), "bbshelp": bbs_help, "wxalert": lambda: handle_wxalert(message_from_id, deviceID, message), @@ -103,14 +103,14 @@ def handle_ping(message, hop, snr, rssi, isDM): msg = "" if "ping" in message: - msg = "🏓PONG\n" + msg = msg + "🏓PONG\n" elif "test" in message or "testing" in message: - msg = random.choice(["🎙Testing 1,2,3\n", "🎙Testing\n",\ + msg = msg + random.choice(["🎙Testing 1,2,3\n", "🎙Testing\n",\ "🎙Testing, testing\n",\ "🎙Ah-wun, ah-two...\n", "🎙Is this thing on?\n",\ "🎙Roger that.\n", "Ack to you!\n"]) elif "ack" in message: - msg = "✋ACK-ACK!\n" + msg = msg + "✋ACK-ACK!\n" if hop == "Direct": msg = msg + f"SNR:{snr} RSSI:{rssi}" From e5045a0984ac3f7b10027e546670907ebe308887 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 21:14:29 +0100 Subject: [PATCH 13/29] drfgdf --- mesh_bot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index b84a778..6c82018 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -118,11 +118,11 @@ def handle_ping(message, hop, snr, rssi, isDM): msg = msg + hop if "@" in message: - return msg + "@" + message.split("@")[1] + msg = msg + "@" + message.split("@")[1] elif "#" in message: - return msg + "#" + message.split("#")[1] - else: - return msg + msg = msg + "#" + message.split("#")[1] + + return msg def handle_motd(message, message_from_id, isDM): global MOTD From 8dc4371beb17aaa7d904d0142d1e0bc2df45cb3e Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 21:14:29 +0100 Subject: [PATCH 14/29] deghdfgdrfgdf --- mesh_bot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index b84a778..c5fd203 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -98,10 +98,10 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n return bot_response def handle_ping(message, hop, snr, rssi, isDM): + msg = "" if "?" in message and isDM: return message.split("?")[0].title() + " command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" - msg = "" if "ping" in message: msg = msg + "🏓PONG\n" elif "test" in message or "testing" in message: @@ -118,11 +118,11 @@ def handle_ping(message, hop, snr, rssi, isDM): msg = msg + hop if "@" in message: - return msg + "@" + message.split("@")[1] + msg = msg + "@" + message.split("@")[1] elif "#" in message: - return msg + "#" + message.split("#")[1] - else: - return msg + msg = msg + "#" + message.split("#")[1] + + return msg def handle_motd(message, message_from_id, isDM): global MOTD From 0be7202144cc849d41df3debb6186ae5e0e97a6d Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 21:18:49 +0100 Subject: [PATCH 15/29] dsfrg --- mesh_bot.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index c5fd203..6ea9dc9 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -103,14 +103,14 @@ def handle_ping(message, hop, snr, rssi, isDM): return message.split("?")[0].title() + " command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" if "ping" in message: - msg = msg + "🏓PONG\n" + msg = msg + "🏓PONG \n" elif "test" in message or "testing" in message: - msg = msg + random.choice(["🎙Testing 1,2,3\n", "🎙Testing\n",\ - "🎙Testing, testing\n",\ - "🎙Ah-wun, ah-two...\n", "🎙Is this thing on?\n",\ - "🎙Roger that.\n", "Ack to you!\n"]) + msg = msg + random.choice(["🎙Testing 1,2,3 \n", "🎙Testing \n",\ + "🎙Testing, testing \n",\ + "🎙Ah-wun, ah-two... \n", "🎙Is this thing on?\ n",\ + "🎙Roger that. \n", "Ack to you! \n"]) elif "ack" in message: - msg = msg + "✋ACK-ACK!\n" + msg = msg + "✋ACK-ACK! \n" if hop == "Direct": msg = msg + f"SNR:{snr} RSSI:{rssi}" @@ -118,9 +118,9 @@ def handle_ping(message, hop, snr, rssi, isDM): msg = msg + hop if "@" in message: - msg = msg + "@" + message.split("@")[1] + msg = msg + " @" + message.split("@")[1] elif "#" in message: - msg = msg + "#" + message.split("#")[1] + msg = msg + " #" + message.split("#")[1] return msg From 7aba1096f9053a7bd2b59caef93d1c6c4049ea97 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 21:20:30 +0100 Subject: [PATCH 16/29] szd --- mesh_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 6ea9dc9..4cc12f6 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -103,14 +103,14 @@ def handle_ping(message, hop, snr, rssi, isDM): return message.split("?")[0].title() + " command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" if "ping" in message: - msg = msg + "🏓PONG \n" + msg = msg + "🏓PONG \\n" elif "test" in message or "testing" in message: msg = msg + random.choice(["🎙Testing 1,2,3 \n", "🎙Testing \n",\ "🎙Testing, testing \n",\ - "🎙Ah-wun, ah-two... \n", "🎙Is this thing on?\ n",\ + "🎙Ah-wun, ah-two... \n", "🎙Is this thing on? \n",\ "🎙Roger that. \n", "Ack to you! \n"]) elif "ack" in message: - msg = msg + "✋ACK-ACK! \n" + msg = msg + "✋ACK-ACK! \\n" if hop == "Direct": msg = msg + f"SNR:{snr} RSSI:{rssi}" From 7acc018fd256e5a09f006be1e702762119bef040 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 21:30:35 +0100 Subject: [PATCH 17/29] sdfsd --- mesh_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 4cc12f6..4c78552 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -103,14 +103,14 @@ def handle_ping(message, hop, snr, rssi, isDM): return message.split("?")[0].title() + " command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" if "ping" in message: - msg = msg + "🏓PONG \\n" + msg = msg + "🏓PONG, " elif "test" in message or "testing" in message: msg = msg + random.choice(["🎙Testing 1,2,3 \n", "🎙Testing \n",\ "🎙Testing, testing \n",\ "🎙Ah-wun, ah-two... \n", "🎙Is this thing on? \n",\ "🎙Roger that. \n", "Ack to you! \n"]) elif "ack" in message: - msg = msg + "✋ACK-ACK! \\n" + msg = msg + "✋ACK-ACK!, n" if hop == "Direct": msg = msg + f"SNR:{snr} RSSI:{rssi}" From b288aaea90a767beb0f1876d92a0132e90a8d525 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 21:32:25 +0100 Subject: [PATCH 18/29] szadsad --- mesh_bot.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mesh_bot.py b/mesh_bot.py index 4c78552..2d43a30 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -104,6 +104,7 @@ def handle_ping(message, hop, snr, rssi, isDM): if "ping" in message: msg = msg + "🏓PONG, " + logger.debug(msg) elif "test" in message or "testing" in message: msg = msg + random.choice(["🎙Testing 1,2,3 \n", "🎙Testing \n",\ "🎙Testing, testing \n",\ @@ -112,16 +113,22 @@ def handle_ping(message, hop, snr, rssi, isDM): elif "ack" in message: msg = msg + "✋ACK-ACK!, n" + logger.debug(msg) + if hop == "Direct": msg = msg + f"SNR:{snr} RSSI:{rssi}" else: msg = msg + hop + logger.debug(msg) + if "@" in message: msg = msg + " @" + message.split("@")[1] elif "#" in message: msg = msg + " #" + message.split("#")[1] + logger.debug(msg) + return msg def handle_motd(message, message_from_id, isDM): From 11eee911ca7dba00450b28c53ffd1e5be0eceb2b Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 21:54:47 +0100 Subject: [PATCH 19/29] sdfsdf --- mesh_bot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 2d43a30..a8528d6 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -98,20 +98,20 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n return bot_response def handle_ping(message, hop, snr, rssi, isDM): - msg = "" if "?" in message and isDM: return message.split("?")[0].title() + " command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" - + if "ping" in message: - msg = msg + "🏓PONG, " - logger.debug(msg) + msg = "🏓PONG, " elif "test" in message or "testing" in message: msg = msg + random.choice(["🎙Testing 1,2,3 \n", "🎙Testing \n",\ "🎙Testing, testing \n",\ "🎙Ah-wun, ah-two... \n", "🎙Is this thing on? \n",\ "🎙Roger that. \n", "Ack to you! \n"]) elif "ack" in message: - msg = msg + "✋ACK-ACK!, n" + msg += "✋ACK-ACK!, n" + else: + msg = "" logger.debug(msg) From 713b750f4aa80591630e4467d57a28af7914a576 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 21:56:41 +0100 Subject: [PATCH 20/29] sdfsd --- mesh_bot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index a8528d6..28ebdcb 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -100,7 +100,9 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n def handle_ping(message, hop, snr, rssi, isDM): if "?" in message and isDM: return message.split("?")[0].title() + " command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" - + + msg = "" + if "ping" in message: msg = "🏓PONG, " elif "test" in message or "testing" in message: From 74bd3f681fc201a2e79f8403305c6f1b31b1aa0e Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 22:05:31 +0100 Subject: [PATCH 21/29] dssdf --- mesh_bot.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 28ebdcb..0a19591 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -25,7 +25,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n # Command List default_commands = { "ping": lambda: handle_ping(message, hop, snr, rssi, isDM), - "pong": lambda: "/n PING!! 🏓", + "pong": lambda: "\n PING!! 🏓", "motd": lambda: handle_motd(message, message_from_id, isDM), "bbshelp": bbs_help, "wxalert": lambda: handle_wxalert(message_from_id, deviceID, message), @@ -102,35 +102,29 @@ def handle_ping(message, hop, snr, rssi, isDM): return message.split("?")[0].title() + " command returns SNR and RSSI, or hopcount from your message. Try adding e.g. @place or #1/3 to your message" msg = "" - - if "ping" in message: - msg = "🏓PONG, " - elif "test" in message or "testing" in message: - msg = msg + random.choice(["🎙Testing 1,2,3 \n", "🎙Testing \n",\ + + if "ping" in message.lower(): + msg = "🏓PONG \n" + elif "test" in message.lower() or "testing" in message.lower(): + msg = random.choice(["🎙Testing 1,2,3 \n", "🎙Testing \n",\ "🎙Testing, testing \n",\ "🎙Ah-wun, ah-two... \n", "🎙Is this thing on? \n",\ "🎙Roger that. \n", "Ack to you! \n"]) - elif "ack" in message: - msg += "✋ACK-ACK!, n" + elif "ack" in message.lower(): + msg = "✋ACK-ACK!, n" else: msg = "" - - logger.debug(msg) if hop == "Direct": msg = msg + f"SNR:{snr} RSSI:{rssi}" else: msg = msg + hop - logger.debug(msg) - if "@" in message: msg = msg + " @" + message.split("@")[1] elif "#" in message: msg = msg + " #" + message.split("#")[1] - logger.debug(msg) - return msg def handle_motd(message, message_from_id, isDM): From 0baec883219657cd42be51b43751a63caf8c0560 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 22:12:10 +0100 Subject: [PATCH 22/29] Removed handle_testing & handle_ack, now in handle_ping --- mesh_bot.py | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 0a19591..6a3a404 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -25,7 +25,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n # Command List default_commands = { "ping": lambda: handle_ping(message, hop, snr, rssi, isDM), - "pong": lambda: "\n PING!! 🏓", + "pong": lambda: "\n PING!! 🏓", "motd": lambda: handle_motd(message, message_from_id, isDM), "bbshelp": bbs_help, "wxalert": lambda: handle_wxalert(message_from_id, deviceID, message), @@ -104,14 +104,14 @@ def handle_ping(message, hop, snr, rssi, isDM): msg = "" if "ping" in message.lower(): - msg = "🏓PONG \n" + msg = "🏓 PONG \n" elif "test" in message.lower() or "testing" in message.lower(): msg = random.choice(["🎙Testing 1,2,3 \n", "🎙Testing \n",\ "🎙Testing, testing \n",\ "🎙Ah-wun, ah-two... \n", "🎙Is this thing on? \n",\ - "🎙Roger that. \n", "Ack to you! \n"]) + "🎙Roger that. \n",]) elif "ack" in message.lower(): - msg = "✋ACK-ACK!, n" + msg = random.choice(["✋ACK-ACK!\n", "Ack to you!\n"]) else: msg = "" @@ -640,28 +640,6 @@ def handle_moon(message_from_id, deviceID, channel_number): location = get_node_location(message_from_id, deviceID, channel_number) return get_moon(str(location[0]), str(location[1])) -def handle_ack(hop, snr, rssi): - if hop == "Direct": - return "✋ACK-ACK! " + f"SNR:{snr} RSSI:{rssi}" - else: - return "✋ACK-ACK! " + hop - -def handle_testing(message, hop, snr, rssi): - if "@" in message: - if hop == "Direct": - return "🎙Testing, " + f"SNR:{snr} RSSI:{rssi}" + " at: " + message.split("@")[1] - else: - return "🎙Testing, " + hop + " at: " + message.split("@")[1] - elif "#" in message: - if hop == "Direct": - return "🎙Testing " + f"SNR:{snr} RSSI:{rssi}" + " #" + message.split("#")[1] - else: - return "🎙Testing " + hop + " #" + message.split("#")[1] - else: - if hop == "Direct": - return "🎙Testing 1,2,3 " + f"SNR:{snr} RSSI:{rssi}" - else: - return "🎙Testing 1,2,3 " + hop def handle_whoami(message_from_id, deviceID, hop, snr, rssi, pkiStatus): loc = [] From d8cc953fe71f9bf0ba9203aa48c527ebedda8896 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 22:12:10 +0100 Subject: [PATCH 23/29] Removed handle_testing & handle_ack, now in handle_ping --- mesh_bot.py | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 0a19591..1d3f772 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -25,7 +25,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n # Command List default_commands = { "ping": lambda: handle_ping(message, hop, snr, rssi, isDM), - "pong": lambda: "\n PING!! 🏓", + "pong": lambda: "\n PING!! 🏓", "motd": lambda: handle_motd(message, message_from_id, isDM), "bbshelp": bbs_help, "wxalert": lambda: handle_wxalert(message_from_id, deviceID, message), @@ -104,14 +104,14 @@ def handle_ping(message, hop, snr, rssi, isDM): msg = "" if "ping" in message.lower(): - msg = "🏓PONG \n" + msg = "🏓 PONG \n" elif "test" in message.lower() or "testing" in message.lower(): msg = random.choice(["🎙Testing 1,2,3 \n", "🎙Testing \n",\ - "🎙Testing, testing \n",\ - "🎙Ah-wun, ah-two... \n", "🎙Is this thing on? \n",\ - "🎙Roger that. \n", "Ack to you! \n"]) + "🎙Testing, testing \n",\ + "🎙Ah-wun, ah-two... \n", "🎙Is this thing on? \n",\ + "🎙Roger that. \n",]) elif "ack" in message.lower(): - msg = "✋ACK-ACK!, n" + msg = random.choice(["✋ACK-ACK!\n", "Ack to you!\n"]) else: msg = "" @@ -640,28 +640,6 @@ def handle_moon(message_from_id, deviceID, channel_number): location = get_node_location(message_from_id, deviceID, channel_number) return get_moon(str(location[0]), str(location[1])) -def handle_ack(hop, snr, rssi): - if hop == "Direct": - return "✋ACK-ACK! " + f"SNR:{snr} RSSI:{rssi}" - else: - return "✋ACK-ACK! " + hop - -def handle_testing(message, hop, snr, rssi): - if "@" in message: - if hop == "Direct": - return "🎙Testing, " + f"SNR:{snr} RSSI:{rssi}" + " at: " + message.split("@")[1] - else: - return "🎙Testing, " + hop + " at: " + message.split("@")[1] - elif "#" in message: - if hop == "Direct": - return "🎙Testing " + f"SNR:{snr} RSSI:{rssi}" + " #" + message.split("#")[1] - else: - return "🎙Testing " + hop + " #" + message.split("#")[1] - else: - if hop == "Direct": - return "🎙Testing 1,2,3 " + f"SNR:{snr} RSSI:{rssi}" - else: - return "🎙Testing 1,2,3 " + hop def handle_whoami(message_from_id, deviceID, hop, snr, rssi, pkiStatus): loc = [] From ceef493b01d62a4490c91b391b35faa3ef6905a5 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 22:17:38 +0100 Subject: [PATCH 24/29] dfgdf --- mesh_bot.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 7571cbd..1d3f772 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -107,15 +107,9 @@ def handle_ping(message, hop, snr, rssi, isDM): msg = "🏓 PONG \n" elif "test" in message.lower() or "testing" in message.lower(): msg = random.choice(["🎙Testing 1,2,3 \n", "🎙Testing \n",\ -<<<<<<< HEAD "🎙Testing, testing \n",\ "🎙Ah-wun, ah-two... \n", "🎙Is this thing on? \n",\ "🎙Roger that. \n",]) -======= - "🎙Testing, testing \n",\ - "🎙Ah-wun, ah-two... \n", "🎙Is this thing on? \n",\ - "🎙Roger that. \n",]) ->>>>>>> 0baec883219657cd42be51b43751a63caf8c0560 elif "ack" in message.lower(): msg = random.choice(["✋ACK-ACK!\n", "Ack to you!\n"]) else: From cd3ac201f8b1f20ce2e36fff6bad9d071b956716 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 22:23:15 +0100 Subject: [PATCH 25/29] general tidy up, done --- mesh_bot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 1d3f772..8fbf7a7 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -106,10 +106,10 @@ def handle_ping(message, hop, snr, rssi, isDM): if "ping" in message.lower(): msg = "🏓 PONG \n" elif "test" in message.lower() or "testing" in message.lower(): - msg = random.choice(["🎙Testing 1,2,3 \n", "🎙Testing \n",\ - "🎙Testing, testing \n",\ - "🎙Ah-wun, ah-two... \n", "🎙Is this thing on? \n",\ - "🎙Roger that. \n",]) + msg = random.choice(["🎙 Testing 1,2,3\n", "🎙 Testing\n",\ + "🎙 Testing, testing\n",\ + "🎙 Ah-wun, ah-two...\n", "🎙 Is this thing on?\n",\ + "🎙 Roger that\n",]) elif "ack" in message.lower(): msg = random.choice(["✋ACK-ACK!\n", "Ack to you!\n"]) else: From d14f1df82360bbb5ce30cfccc8de23372d779479 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 22:49:20 +0100 Subject: [PATCH 26/29] tweak some help messages --- mesh_bot.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 35db035..26d8762 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -33,6 +33,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "wxc": lambda: handle_wxc(message_from_id, deviceID, 'wxc'), "wx": lambda: handle_wxc(message_from_id, deviceID, 'wx'), "wiki:": lambda: handle_wiki(message, isDM), + "wiki?": lambda: handle_wiki(message, isDM), "games": lambda: gamesCmdList, "dopewars": lambda: handleDopeWars(message_from_id, message, deviceID), "lemonstand": lambda: handleLemonade(message_from_id, message), @@ -140,8 +141,10 @@ def handle_motd(message, message_from_id, isDM): else: isAdmin = True + # admin help via DM if "?" in message and isDM and isAdmin: msg = "Message of the day, set with 'motd $ HelloWorld!'" + # non-admin help via DM elif "?" in message and isDM and not isAdmin: msg = "Message of the day, set by Admin." elif "$" in message and isAdmin: @@ -149,6 +152,7 @@ def handle_motd(message, message_from_id, isDM): MOTD = motd.rstrip() logger.debug(f"System: {message_from_id} changed MOTD: {MOTD}") msg = "MOTD changed to: " + MOTD + # just return the MOTD for non-DM elif "?" in message: logger.debug(f"System: {message_from_id} requested MOTD: {MOTD} isAdmin: {isAdmin}") msg = "MOTD: " + MOTD @@ -180,7 +184,7 @@ def handle_wiki(message, isDM): return get_wikipedia_summary(search) return "Please add a search term example:wiki: travelling gnome" elif "?" in message and isDM: - msg = "Wikipedia search function. \n Usage example:wiki: travelling gnome" + msg = "Wikipedia search function. \nUsage example:wiki: travelling gnome" return msg # Runtime Variables for LLM @@ -503,7 +507,7 @@ def handle_bbsdelete(message, message_from_id): def handle_messages(message, deviceID, channel_number, msg_history, publicChannel, isDM): if "?" in message and isDM: - msg = "Command returns the last " & list.msg_history.count() & " messages sent on a channel." + msg = "Command returns the last " & storeFlimit & " messages sent on a channel." return msg else: response = "" @@ -522,8 +526,8 @@ def handle_sun(message_from_id, deviceID, channel_number): def handle_lheard(message, nodeid, deviceID, isDM): if "?" in message and isDM: - msg = "Lists of nodes that this node has heard from recently." - return msg + return message.split("?")[0].title() + " command returns a list of nodes that have been heard recently" + else: # display last heard nodes add to response bot_response = str(get_node_list(1)) @@ -579,8 +583,8 @@ def handle_history(message, nodeid, deviceID, isDM, lheard=False): buffer = [] if "?" in message and isDM: - msg = "List of recent commands this node has received." - return msg + return message.split("?")[0].title() + " command returns a list of commands received." + # show the last commands from the user to the bot elif not lheard: for i in range(len(cmdHistory)): From d321a958f0501b88d3255bdd40cda2b5c539757a Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 22:50:45 +0100 Subject: [PATCH 27/29] more tidying --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index 26d8762..1e76231 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -507,7 +507,7 @@ def handle_bbsdelete(message, message_from_id): def handle_messages(message, deviceID, channel_number, msg_history, publicChannel, isDM): if "?" in message and isDM: - msg = "Command returns the last " & storeFlimit & " messages sent on a channel." + msg = "Command returns the last " + str(storeFlimit) + " messages sent on a channel." return msg else: response = "" From 477f2141d7c56ed61ea841d0acdce5e8384134e3 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 22:57:20 +0100 Subject: [PATCH 28/29] sdfsdf --- mesh_bot.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 1e76231..283d864 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -507,8 +507,7 @@ def handle_bbsdelete(message, message_from_id): def handle_messages(message, deviceID, channel_number, msg_history, publicChannel, isDM): if "?" in message and isDM: - msg = "Command returns the last " + str(storeFlimit) + " messages sent on a channel." - return msg + return message.split("?")[0].title() + " command returns the last " + str(storeFlimit) + " messages sent on a channel." else: response = "" for msgH in msg_history: @@ -526,7 +525,7 @@ def handle_sun(message_from_id, deviceID, channel_number): def handle_lheard(message, nodeid, deviceID, isDM): if "?" in message and isDM: - return message.split("?")[0].title() + " command returns a list of nodes that have been heard recently" + return message.split("?")[0].title() + " command returns a list of the last " + storeFlimit + " nodes that have been heard recently" else: # display last heard nodes add to response From ed958302bd45ae391c8179d1531fda08d1fc56e6 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Thu, 26 Sep 2024 23:07:19 +0100 Subject: [PATCH 29/29] sdfsdfsdf --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index 283d864..81e2ac1 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -525,7 +525,7 @@ def handle_sun(message_from_id, deviceID, channel_number): def handle_lheard(message, nodeid, deviceID, isDM): if "?" in message and isDM: - return message.split("?")[0].title() + " command returns a list of the last " + storeFlimit + " nodes that have been heard recently" + return message.split("?")[0].title() + " command returns a list of the nodes that have been heard recently" else: # display last heard nodes add to response