From 6e7e89c2d0060763bcb6a0e436639564d507da59 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:31:46 +0100 Subject: [PATCH 01/46] Update pong_bot.py --- pong_bot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pong_bot.py b/pong_bot.py index c932e7c..fcd0d72 100755 --- a/pong_bot.py +++ b/pong_bot.py @@ -75,15 +75,15 @@ def handle_lheard(interface1, interface2_enabled, myNodeNum1, myNodeNum2): def handle_ack(hop, snr, rssi): if hop == "Direct": - return "🏓ACK-ACK! " + f"SNR:{snr} RSSI:{rssi}" + return "✋ACK-ACK! " + f"SNR:{snr} RSSI:{rssi}" else: - return "🏓ACK-ACK! " + hop + return "✋ACK-ACK! " + hop def handle_testing(hop, snr, rssi): if hop == "Direct": - return "🏓Testing 1,2,3 " + f"SNR:{snr} RSSI:{rssi}" + return "🎙Testing 1,2,3 " + f"SNR:{snr} RSSI:{rssi}" else: - return "🏓Testing 1,2,3 " + hop + return "🎙Testing 1,2,3 " + hop def onDisconnect(interface): global retry_int1, retry_int2 From 14aa127f31b61dcbc467cdfb8f501d598f972e3b Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:33:30 +0100 Subject: [PATCH 02/46] Update mesh_bot.py --- mesh_bot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index aad1a71..ea3b515 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -263,15 +263,15 @@ def handle_moon(message_from_id, deviceID, channel_number): def handle_ack(hop, snr, rssi): if hop == "Direct": - return "🏓ACK-ACK! " + f"SNR:{snr} RSSI:{rssi}" + return "✋ACK-ACK! " + f"SNR:{snr} RSSI:{rssi}" else: - return "🏓ACK-ACK! " + hop + return "✋ACK-ACK! " + hop def handle_testing(hop, snr, rssi): if hop == "Direct": - return "🏓Testing 1,2,3 " + f"SNR:{snr} RSSI:{rssi}" + return "🎙Testing 1,2,3 " + f"SNR:{snr} RSSI:{rssi}" else: - return "🏓Testing 1,2,3 " + hop + return "🎙Testing 1,2,3 " + hop def onDisconnect(interface): global retry_int1, retry_int2 From 394c3ef4f676980606b4633f70083081fadbc143 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:16:42 +0100 Subject: [PATCH 03/46] update ping messages --- mesh_bot.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 71cf0b5..3823b01 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -67,9 +67,14 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi def handle_ping(message, hop, snr, rssi): if "@" in message: if hop == "Direct": - return "🏓PONG, " + f"SNR:{snr} RSSI:{rssi}" + " and copy: " + message.split("@")[1] + return "🏓PONG, " + f"SNR:{snr} RSSI:{rssi}" + " at: " + message.split("@")[1] else: - return "🏓PONG, " + hop + " and copy: " + message.split("@")[1] + return "🏓PONG, " + hop + " at: " + message.split("@")[1] + elif "#" in message: + if hop == "Direct": + return "🏓PONG, " + f"SNR:{snr} RSSI:{rssi}" + " #" + message.split("#")[1] + else: + return "🏓PONG, " + hop + " #" + message.split("#")[1] else: if hop == "Direct": return "🏓PONG, " + f"SNR:{snr} RSSI:{rssi}" @@ -293,10 +298,21 @@ def handle_ack(hop, snr, rssi): return "✋ACK-ACK! " + hop def handle_testing(hop, snr, rssi): - if hop == "Direct": - return "🎙Testing 1,2,3 " + f"SNR:{snr} RSSI:{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: - return "🎙Testing 1,2,3 " + hop + if hop == "Direct": + return "🎙Testing 1,2,3 " + f"SNR:{snr} RSSI:{rssi}" + else: + return "🎙Testing 1,2,3 " + hop def onDisconnect(interface): global retry_int1, retry_int2 From b7df9d05a700b2204bbf9a3c2939ef3e9c35eefb Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:42:59 +0100 Subject: [PATCH 04/46] Add time.sleep(splitDelay) between split messages --- modules/system.py | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/system.py b/modules/system.py index b3cda18..6aa3cc3 100644 --- a/modules/system.py +++ b/modules/system.py @@ -472,6 +472,7 @@ def send_message(message, ch, nodeid=0, nodeInt=1): interface1.sendText(text=m, channelIndex=ch, destinationId=nodeid) if nodeInt == 2: interface2.sendText(text=m, channelIndex=ch, destinationId=nodeid) + time.sleep(splitDelay) # wait an amout of time between sending each split message else: # message is less than MESSAGE_CHUNK_SIZE characters if nodeid == 0: # Send to channel From 1046daaf167323a9b89badfd110b3867b9c61fc0 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:43:50 +0100 Subject: [PATCH 05/46] remove responseDelay from here, moved to settings.ini --- mesh_bot.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 3823b01..cd50d51 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -8,8 +8,6 @@ from pubsub import pub # pip install pubsub from modules.log import * from modules.system import * -responseDelay = 0.7 # delay in seconds for response to avoid message collision - def auto_response(message, snr, rssi, hop, message_from_id, channel_number, deviceID): #Auto response to messages message_lower = message.lower() From 4f4dbfbc6f5d6819ba25349ef83273874a3aa1fd Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:44:17 +0100 Subject: [PATCH 06/46] add messagingSettings --- modules/settings.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/settings.py b/modules/settings.py index 4bd7c63..ecb54a8 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -10,7 +10,6 @@ MOTD = 'Thanks for using MeshBOT! Have a good day!' NO_ALERTS = "No weather alerts found." # setup the global variables -MESSAGE_CHUNK_SIZE = 160 # message chunk size for sending at high success rate SITREP_NODE_COUNT = 3 # number of nodes to report in the sitrep msg_history = [] # message history for the store and forward feature bbs_ban_list = [] # list of banned users, imported from config @@ -134,6 +133,11 @@ try: signalCooldown = config['radioMon'].getint('signalCooldown', 5) # default 1 second signalCycleLimit = config['radioMon'].getint('signalCycleLimit', 5) # default 5 cycles, used with SIGNAL_COOLDOWN +messagingSettings + responseDelay = config['messagingSettings'].getint('responseDelay', 0.7) # default 0.7 + splitDelay = config['messagingSettings'].getint('splitDelay', 0) # default 0 + MESSAGE_CHUNK_SIZE = config['messagingSettings'].getint('MESSAGE_CHUNK_SIZE', 160) # default 160 + except KeyError as e: print(f"System: Error reading config file: {e}") print(f"System: Check the config.ini against config.template file for missing sections or values.") From 286db4fbeaa81ac816f491ced646d1853effd6e9 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:44:46 +0100 Subject: [PATCH 07/46] add messagingSettings --- config.template | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config.template b/config.template index 1d4c769..1fc8005 100644 --- a/config.template +++ b/config.template @@ -106,4 +106,9 @@ signalDetectionThreshold = -10 signalHoldTime = 10 # the following are combined to reset the monitor signalCooldown = 5 -signalCycleLimit = 5 \ No newline at end of file +signalCycleLimit = 5 + +[messagingSettings] +responseDelay = 0.7 # delay in seconds for response to avoid message collision +splitDelay = 0.7 # delay in seconds for splits in messages to avoid message collision +MESSAGE_CHUNK_SIZE = 160 # message chunk size for sending at high success rate From bf34661e42370c943e5318d9f93fbc191e84ca27 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:19:06 +0100 Subject: [PATCH 08/46] Update settings.py --- modules/settings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/settings.py b/modules/settings.py index ecb54a8..8bf4ae6 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -133,7 +133,6 @@ try: signalCooldown = config['radioMon'].getint('signalCooldown', 5) # default 1 second signalCycleLimit = config['radioMon'].getint('signalCycleLimit', 5) # default 5 cycles, used with SIGNAL_COOLDOWN -messagingSettings responseDelay = config['messagingSettings'].getint('responseDelay', 0.7) # default 0.7 splitDelay = config['messagingSettings'].getint('splitDelay', 0) # default 0 MESSAGE_CHUNK_SIZE = config['messagingSettings'].getint('MESSAGE_CHUNK_SIZE', 160) # default 160 From ef9231f51f98504a9cc066b73e2e68882da0bf84 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:20:11 +0100 Subject: [PATCH 09/46] Update settings.py --- modules/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/settings.py b/modules/settings.py index 8bf4ae6..3366d82 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -133,8 +133,8 @@ try: signalCooldown = config['radioMon'].getint('signalCooldown', 5) # default 1 second signalCycleLimit = config['radioMon'].getint('signalCycleLimit', 5) # default 5 cycles, used with SIGNAL_COOLDOWN - responseDelay = config['messagingSettings'].getint('responseDelay', 0.7) # default 0.7 - splitDelay = config['messagingSettings'].getint('splitDelay', 0) # default 0 + responseDelay = config['messagingSettings'].getfloat('responseDelay', 0.7) # default 0.7 + splitDelay = config['messagingSettings'].getfloat('splitDelay', 0) # default 0 MESSAGE_CHUNK_SIZE = config['messagingSettings'].getint('MESSAGE_CHUNK_SIZE', 160) # default 160 except KeyError as e: From ad5e086eb55822f0df13a4882168a4c3ffed4a22 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:22:17 +0100 Subject: [PATCH 10/46] Update mesh_bot.py handle_testing --- mesh_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index cd50d51..916aef6 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -42,8 +42,8 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi "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(hop, snr, rssi), - "test": lambda: handle_testing(hop, snr, rssi), + "testing": lambda: handle_testing(message, hop, snr, rssi), + "test": lambda: handle_testing(message, hop, snr, rssi), } cmds = [] # list to hold the commands found in the message for key in command_handler: From 5fd326f2e8780502417c3ac6556496bd29f5545b Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:41:43 +0100 Subject: [PATCH 11/46] Update mesh_bot.py add nodeID check to MOTD change --- mesh_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 916aef6..3f8035f 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -16,7 +16,7 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi command_handler = { "ping": lambda: handle_ping(message, hop, snr, rssi), "pong": lambda: "🏓PING!!", - "motd": lambda: handle_motd(message), + "motd": lambda: handle_motd(message, deviceID), "bbshelp": bbs_help, "wxalert": lambda: handle_wxalert(message_from_id, deviceID, message), "wxa": lambda: handle_wxalert(message_from_id, deviceID, message), @@ -81,7 +81,7 @@ def handle_ping(message, hop, snr, rssi): def handle_motd(message): global MOTD - if "$" in message: + if "$" in message and str(fromNode) in bbs_admin_list: motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD From 46c17c84704d5f13835b4db3282fa108c97f3b1e Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:54:38 +0100 Subject: [PATCH 12/46] Update mesh_bot.py --- mesh_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 3f8035f..b8e60d3 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -79,7 +79,7 @@ def handle_ping(message, hop, snr, rssi): else: return "🏓PONG, " + hop -def handle_motd(message): +def handle_motd(message, deviceID): global MOTD if "$" in message and str(fromNode) in bbs_admin_list: motd = message.split("$")[1] @@ -295,7 +295,7 @@ def handle_ack(hop, snr, rssi): else: return "✋ACK-ACK! " + hop -def handle_testing(hop, snr, rssi): +def handle_testing(message, hop, snr, rssi): if "@" in message: if hop == "Direct": return "🎙Testing, " + f"SNR:{snr} RSSI:{rssi}" + " at: " + message.split("@")[1] From e85982e17c8a30c16c78ebb14b57db7450dea801 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:00:04 +0100 Subject: [PATCH 13/46] Update mesh_bot.py --- mesh_bot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index b8e60d3..6a08211 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -81,10 +81,12 @@ def handle_ping(message, hop, snr, rssi): def handle_motd(message, deviceID): global MOTD - if "$" in message and str(fromNode) in bbs_admin_list: + if "$" in message and str(deviceID) in bbs_admin_list: motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD + elif "$" in message and str(deviceID) not in bbs_admin_list: + return "I can't do that for you" else: return MOTD From 3831998add00c46db7a25ea05d57ec52174d1cad Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:12:13 +0100 Subject: [PATCH 14/46] Update mesh_bot.py --- mesh_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 6a08211..fdae5c4 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -16,7 +16,7 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi command_handler = { "ping": lambda: handle_ping(message, hop, snr, rssi), "pong": lambda: "🏓PING!!", - "motd": lambda: handle_motd(message, deviceID), + "motd": lambda: handle_motd(message, message_from_id), "bbshelp": bbs_help, "wxalert": lambda: handle_wxalert(message_from_id, deviceID, message), "wxa": lambda: handle_wxalert(message_from_id, deviceID, message), @@ -81,11 +81,11 @@ def handle_ping(message, hop, snr, rssi): def handle_motd(message, deviceID): global MOTD - if "$" in message and str(deviceID) in bbs_admin_list: + if "$" in message and str(message_from_id) in bbs_admin_list: motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD - elif "$" in message and str(deviceID) not in bbs_admin_list: + elif "$" in message and str(message_from_id) not in bbs_admin_list: return "I can't do that for you" else: return MOTD From 5d2f7dbe8aeeccba21acb65b2ee483d2a696a93d Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:13:10 +0100 Subject: [PATCH 15/46] 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 fdae5c4..383cd06 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -79,7 +79,7 @@ def handle_ping(message, hop, snr, rssi): else: return "🏓PONG, " + hop -def handle_motd(message, deviceID): +def handle_motd(message, message_from_id): global MOTD if "$" in message and str(message_from_id) in bbs_admin_list: motd = message.split("$")[1] From deb5ee83748921d11d934c3cbbb0917724448a12 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:29:34 +0100 Subject: [PATCH 16/46] Update mesh_bot.py --- mesh_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 383cd06..32efd1c 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -16,7 +16,7 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi command_handler = { "ping": lambda: handle_ping(message, hop, snr, rssi), "pong": lambda: "🏓PING!!", - "motd": lambda: handle_motd(message, message_from_id), + "motd": lambda: handle_motd(message, deviceID), "bbshelp": bbs_help, "wxalert": lambda: handle_wxalert(message_from_id, deviceID, message), "wxa": lambda: handle_wxalert(message_from_id, deviceID, message), @@ -81,11 +81,11 @@ def handle_ping(message, hop, snr, rssi): def handle_motd(message, message_from_id): global MOTD - if "$" in message and str(message_from_id) in bbs_admin_list: + if "$" in message and str(deviceID) in bbs_admin_list: motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD - elif "$" in message and str(message_from_id) not in bbs_admin_list: + elif "$" in message and not str(deviceID) in bbs_admin_list: return "I can't do that for you" else: return MOTD From 453cfbb306a63e8d1b0eff0717f541fd93a02a0d Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:30:22 +0100 Subject: [PATCH 17/46] 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 32efd1c..8477bc4 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -79,7 +79,7 @@ def handle_ping(message, hop, snr, rssi): else: return "🏓PONG, " + hop -def handle_motd(message, message_from_id): +def handle_motd(message, deviceID): global MOTD if "$" in message and str(deviceID) in bbs_admin_list: motd = message.split("$")[1] From c03375c7f0d8cb46136a51c99230983b849ad69f Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:04:28 +0100 Subject: [PATCH 18/46] Update mesh_bot.py --- mesh_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 8477bc4..348c378 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -79,13 +79,13 @@ def handle_ping(message, hop, snr, rssi): else: return "🏓PONG, " + hop -def handle_motd(message, deviceID): +def handle_motd(message, message_from_id): global MOTD - if "$" in message and str(deviceID) in bbs_admin_list: + if "$" in message and str(message_from_id) in bbs_admin_list: motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD - elif "$" in message and not str(deviceID) in bbs_admin_list: + elif "$" in message and not str(message_from_id) in bbs_admin_list: return "I can't do that for you" else: return MOTD From c0e7f4c0fad62b1d2e66a3b8aff786c49abc9273 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:04:38 +0100 Subject: [PATCH 19/46] 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 348c378..527b7b6 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -16,7 +16,7 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi command_handler = { "ping": lambda: handle_ping(message, hop, snr, rssi), "pong": lambda: "🏓PING!!", - "motd": lambda: handle_motd(message, deviceID), + "motd": lambda: handle_motd(message, message_from_id), "bbshelp": bbs_help, "wxalert": lambda: handle_wxalert(message_from_id, deviceID, message), "wxa": lambda: handle_wxalert(message_from_id, deviceID, message), From a414a994fb5f3d6f7b9bd8c4dc43967305bb5984 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:42:57 +0100 Subject: [PATCH 20/46] Update mesh_bot.py --- mesh_bot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index 527b7b6..40076cf 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -85,8 +85,9 @@ def handle_motd(message, message_from_id): motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD - elif "$" in message and not str(message_from_id) in bbs_admin_list: + elif "$" in message: return "I can't do that for you" + logger.debug(f"System: {message_from_id} tried to change MOTD") else: return MOTD From e0d85a65f91f41263c3a196f2e8529f8d03479f3 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:56:03 +0100 Subject: [PATCH 21/46] Update mesh_bot.py --- mesh_bot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index 40076cf..f89e3ad 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -85,9 +85,10 @@ def handle_motd(message, message_from_id): motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD + logger.debug(f"System: node changed MOTD: " {message_from_id}) elif "$" in message: return "I can't do that for you" - logger.debug(f"System: {message_from_id} tried to change MOTD") + logger.debug(f"System: node tried to change MOTD: " {message_from_id}) else: return MOTD From 50245e618b7b8af6a459f8bf0070de8fa2e15508 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:56:48 +0100 Subject: [PATCH 22/46] Update mesh_bot.py --- mesh_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index f89e3ad..a44c4fe 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -85,10 +85,10 @@ def handle_motd(message, message_from_id): motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD - logger.debug(f"System: node changed MOTD: " {message_from_id}) + logger.debug(f"System: node changed MOTD: ", {message_from_id}) elif "$" in message: return "I can't do that for you" - logger.debug(f"System: node tried to change MOTD: " {message_from_id}) + logger.debug(f"System: node tried to change MOTD: ", {message_from_id}) else: return MOTD From be68cece478b116e31f4d5c5d910408b84e55702 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:11:24 +0100 Subject: [PATCH 23/46] Update mesh_bot.py --- mesh_bot.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mesh_bot.py b/mesh_bot.py index a44c4fe..206c231 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -44,6 +44,7 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi "ack": lambda: handle_ack(hop, snr, rssi), "testing": lambda: handle_testing(message, hop, snr, rssi), "test": lambda: handle_testing(message, hop, snr, rssi), + "whoami": lambda: handle_whoami(message_from_id, deviceID, channel_number), } cmds = [] # list to hold the commands found in the message for key in command_handler: @@ -316,6 +317,9 @@ def handle_testing(message, hop, snr, rssi): else: return "🎙Testing 1,2,3 " + hop +def handle_whoami(message_from_id, deviceID, channel_number) + return "You are " + message_from_id + " on " + channel_number + "being received by " + deviceID + def onDisconnect(interface): global retry_int1, retry_int2 rxType = type(interface).__name__ From fa5fd85b5d593dc96ea110757fdc80feb69f6138 Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:12:17 +0100 Subject: [PATCH 24/46] 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 206c231..a184bb1 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -317,7 +317,7 @@ def handle_testing(message, hop, snr, rssi): else: return "🎙Testing 1,2,3 " + hop -def handle_whoami(message_from_id, deviceID, channel_number) +def handle_whoami(message_from_id, deviceID, channel_number): return "You are " + message_from_id + " on " + channel_number + "being received by " + deviceID def onDisconnect(interface): From b043541dca5ba261a2dd2fa3abca5b079dc7c49b Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 10:17:09 +0100 Subject: [PATCH 25/46] traplist updated --- modules/system.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system.py b/modules/system.py index 6aa3cc3..62923b5 100644 --- a/modules/system.py +++ b/modules/system.py @@ -10,7 +10,7 @@ import contextlib # for suppressing output on watchdog from modules.log import * # Global Variables -trap_list = ("cmd","cmd?") # default trap list +trap_list = ("cmd","cmd?","whoami") # default trap list help_message = "CMD?:" asyncLoop = asyncio.new_event_loop() From 575dd08b74b88d38b69d20db1acaaafd59417740 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 10:20:25 +0100 Subject: [PATCH 26/46] strings --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index a184bb1..ca460fc 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -318,7 +318,7 @@ def handle_testing(message, hop, snr, rssi): return "🎙Testing 1,2,3 " + hop def handle_whoami(message_from_id, deviceID, channel_number): - return "You are " + message_from_id + " on " + channel_number + "being received by " + deviceID + return "You are " + str(message_from_id) + " on " + str(channel_number) + "being received by " + str(deviceID) def onDisconnect(interface): global retry_int1, retry_int2 From b5d7107760001377d0bd9cb59881b4938b618f43 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 10:26:14 +0100 Subject: [PATCH 27/46] sdfsdf --- mesh_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index ca460fc..0b64dda 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -88,7 +88,7 @@ def handle_motd(message, message_from_id): return "MOTD Set to: " + MOTD logger.debug(f"System: node changed MOTD: ", {message_from_id}) elif "$" in message: - return "I can't do that for you" + return "I can't do that for you " + bbs_admin_list logger.debug(f"System: node tried to change MOTD: ", {message_from_id}) else: return MOTD @@ -318,7 +318,7 @@ def handle_testing(message, hop, snr, rssi): return "🎙Testing 1,2,3 " + hop def handle_whoami(message_from_id, deviceID, channel_number): - return "You are " + str(message_from_id) + " on " + str(channel_number) + "being received by " + str(deviceID) + return "You are " + str(message_from_id) + " on " + str(channel_number) + " being received by " + str(deviceID) def onDisconnect(interface): global retry_int1, retry_int2 From 2d6e9393063dd4f2545d5431acc6278f55005019 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 10:27:56 +0100 Subject: [PATCH 28/46] sdfsdf --- mesh_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 0b64dda..0f79547 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -82,13 +82,13 @@ def handle_ping(message, hop, snr, rssi): def handle_motd(message, message_from_id): global MOTD - if "$" in message and str(message_from_id) in bbs_admin_list: + if "$" in message and str(message_from_id) in str(bbs_admin_list): motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD logger.debug(f"System: node changed MOTD: ", {message_from_id}) elif "$" in message: - return "I can't do that for you " + bbs_admin_list + return "I can't do that for you " + str(bbs_admin_list) logger.debug(f"System: node tried to change MOTD: ", {message_from_id}) else: return MOTD From 0a2e385f41d0adf38b4a991e5635b441e4e39a73 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 10:43:58 +0100 Subject: [PATCH 29/46] see if this works --- mesh_bot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 0f79547..a0a35f5 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -82,13 +82,19 @@ def handle_ping(message, hop, snr, rssi): def handle_motd(message, message_from_id): global MOTD - if "$" in message and str(message_from_id) in str(bbs_admin_list): + if "?" in message and not "$": #basic help message + return "Message of the day, set with 'motd $ motd'" + elif "$" in message and str(message_from_id) in str(bbs_admin_list): #access control via bbs admin list motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD logger.debug(f"System: node changed MOTD: ", {message_from_id}) + elif "$" in message and not (bbs_admin_list): #no names in bbs admin list + motd = message.split("$")[1] + MOTD = motd.rstrip() + return "MOTD Set to: " + MOTD elif "$" in message: - return "I can't do that for you " + str(bbs_admin_list) + return "I can't do that for you" logger.debug(f"System: node tried to change MOTD: ", {message_from_id}) else: return MOTD From fa4e254ba43cea5739c1536fcbf76fbaa689fdb9 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:09:06 +0100 Subject: [PATCH 30/46] sfsdf --- mesh_bot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index a0a35f5..e87aa81 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -44,7 +44,7 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi "ack": lambda: handle_ack(hop, snr, rssi), "testing": lambda: handle_testing(message, hop, snr, rssi), "test": lambda: handle_testing(message, hop, snr, rssi), - "whoami": lambda: handle_whoami(message_from_id, deviceID, channel_number), + "whoami": lambda: handle_whoami(message_from_id, short_name), } cmds = [] # list to hold the commands found in the message for key in command_handler: @@ -87,15 +87,15 @@ def handle_motd(message, message_from_id): elif "$" in message and str(message_from_id) in str(bbs_admin_list): #access control via bbs admin list motd = message.split("$")[1] MOTD = motd.rstrip() - return "MOTD Set to: " + MOTD logger.debug(f"System: node changed MOTD: ", {message_from_id}) + return "MOTD Set to: " + MOTD elif "$" in message and not (bbs_admin_list): #no names in bbs admin list motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD elif "$" in message: - return "I can't do that for you" logger.debug(f"System: node tried to change MOTD: ", {message_from_id}) + return "I can't do that for you" else: return MOTD @@ -323,8 +323,8 @@ def handle_testing(message, hop, snr, rssi): else: return "🎙Testing 1,2,3 " + hop -def handle_whoami(message_from_id, deviceID, channel_number): - return "You are " + str(message_from_id) + " on " + str(channel_number) + " being received by " + str(deviceID) +def handle_whoami(message_from_id, short_name): + return "You are " + str(message_from_id) + " AKA " + str({get_name_from_number(nodeid, 'long', nodeInt)}) def onDisconnect(interface): global retry_int1, retry_int2 From 746db62fdb02b6b112a944df8d26b23ea5017367 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:12:32 +0100 Subject: [PATCH 31/46] sdfsdf --- mesh_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index e87aa81..fab664b 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -44,7 +44,7 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi "ack": lambda: handle_ack(hop, snr, rssi), "testing": lambda: handle_testing(message, hop, snr, rssi), "test": lambda: handle_testing(message, hop, snr, rssi), - "whoami": lambda: handle_whoami(message_from_id, short_name), + "whoami": lambda: handle_whoami(message_from_id, deviceID), } cmds = [] # list to hold the commands found in the message for key in command_handler: @@ -323,8 +323,8 @@ def handle_testing(message, hop, snr, rssi): else: return "🎙Testing 1,2,3 " + hop -def handle_whoami(message_from_id, short_name): - return "You are " + str(message_from_id) + " AKA " + str({get_name_from_number(nodeid, 'long', nodeInt)}) +def handle_whoami(message_from_id, deviceID): + return "You are " + str(message_from_id) + " AKA " + str({get_name_from_number(message_from_id, 'long', deviceID)}) def onDisconnect(interface): global retry_int1, retry_int2 From 6f8a8b4264523c6e4005c3d9b4c7dbe0db5989df Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:13:13 +0100 Subject: [PATCH 32/46] sdfsdf --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index fab664b..f61fed2 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -324,7 +324,7 @@ def handle_testing(message, hop, snr, rssi): return "🎙Testing 1,2,3 " + hop def handle_whoami(message_from_id, deviceID): - return "You are " + str(message_from_id) + " AKA " + str({get_name_from_number(message_from_id, 'long', deviceID)}) + return "You are " + str(message_from_id) + " AKA " + {get_name_from_number(message_from_id, 'long', deviceID)} def onDisconnect(interface): global retry_int1, retry_int2 From cf0072fce49c3e53ed1a8b96829a87427eab33b2 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:14:37 +0100 Subject: [PATCH 33/46] asdasd --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index f61fed2..df6b0e6 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -324,7 +324,7 @@ def handle_testing(message, hop, snr, rssi): return "🎙Testing 1,2,3 " + hop def handle_whoami(message_from_id, deviceID): - return "You are " + str(message_from_id) + " AKA " + {get_name_from_number(message_from_id, 'long', deviceID)} + return "You are " + str(message_from_id) + " AKA " + str(get_name_from_number(message_from_id, 'long', deviceID)) def onDisconnect(interface): global retry_int1, retry_int2 From e77c7935de88e3c617934b32354b4bd385a8c89e Mon Sep 17 00:00:00 2001 From: Nestpebble <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:21:58 +0100 Subject: [PATCH 34/46] 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 df6b0e6..bb71440 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -89,7 +89,7 @@ def handle_motd(message, message_from_id): MOTD = motd.rstrip() logger.debug(f"System: node changed MOTD: ", {message_from_id}) return "MOTD Set to: " + MOTD - elif "$" in message and not (bbs_admin_list): #no names in bbs admin list + elif "$" in message and not str(bbs_admin_list): #no names in bbs admin list motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD From fd68007c41845bf0763aec35dc53bb2e594ee185 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:31:46 +0100 Subject: [PATCH 35/46] sedfsedf --- mesh_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index bb71440..5718667 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -89,11 +89,11 @@ def handle_motd(message, message_from_id): MOTD = motd.rstrip() logger.debug(f"System: node changed MOTD: ", {message_from_id}) return "MOTD Set to: " + MOTD - elif "$" in message and not str(bbs_admin_list): #no names in bbs admin list + elif "$" in message and not str(bbs_admin_list).strip(): #no names in bbs admin list motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD - elif "$" in message: + elif "$" in message and str(bbs_admin_list).strip(): logger.debug(f"System: node tried to change MOTD: ", {message_from_id}) return "I can't do that for you" else: From 7224da9c7afab2543aa5183f2638c1594bf8f55a Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:41:54 +0100 Subject: [PATCH 36/46] dfsdf --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index 5718667..b60ef24 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -95,7 +95,7 @@ def handle_motd(message, message_from_id): return "MOTD Set to: " + MOTD elif "$" in message and str(bbs_admin_list).strip(): logger.debug(f"System: node tried to change MOTD: ", {message_from_id}) - return "I can't do that for you" + return "I can't do that for you" + str(bbs_admin_list).strip() else: return MOTD From be67b33f9935727b81325362a40dc34a5ced5d91 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:45:20 +0100 Subject: [PATCH 37/46] dsasd --- mesh_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index b60ef24..b9592d2 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -94,8 +94,8 @@ def handle_motd(message, message_from_id): MOTD = motd.rstrip() return "MOTD Set to: " + MOTD elif "$" in message and str(bbs_admin_list).strip(): - logger.debug(f"System: node tried to change MOTD: ", {message_from_id}) - return "I can't do that for you" + str(bbs_admin_list).strip() + logger.debug(f"System: node tried to change MOTD: " + {message_from_id} + f", admin list is: " + {bbs_admin_list}) + return "I can't do that for you" else: return MOTD From e2105e1fa365416bde0a9b59fff02f9b06547e3b Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:46:21 +0100 Subject: [PATCH 38/46] zdzsdf --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index b9592d2..73e5400 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -94,7 +94,7 @@ def handle_motd(message, message_from_id): MOTD = motd.rstrip() return "MOTD Set to: " + MOTD elif "$" in message and str(bbs_admin_list).strip(): - logger.debug(f"System: node tried to change MOTD: " + {message_from_id} + f", admin list is: " + {bbs_admin_list}) + logger.debug(f"System: node tried to change MOTD: " + str({message_from_id}) + f", admin list is: " + str({bbs_admin_list})) return "I can't do that for you" else: return MOTD From 037024395d86e2a515d893e7d3f22891725229a3 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:49:07 +0100 Subject: [PATCH 39/46] asdasd --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index 73e5400..b171ada 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -94,7 +94,7 @@ def handle_motd(message, message_from_id): MOTD = motd.rstrip() return "MOTD Set to: " + MOTD elif "$" in message and str(bbs_admin_list).strip(): - logger.debug(f"System: node tried to change MOTD: " + str({message_from_id}) + f", admin list is: " + str({bbs_admin_list})) + logger.debug(f"System: node tried to change MOTD: ", str({message_from_id}), f", admin list is: ", str({bbs_admin_list})) return "I can't do that for you" else: return MOTD From 62a932b9ed26ab21ac0a3c87c167de15a5492624 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:51:16 +0100 Subject: [PATCH 40/46] sdfsdf --- mesh_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index b171ada..1484f34 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -84,7 +84,7 @@ def handle_motd(message, message_from_id): global MOTD if "?" in message and not "$": #basic help message return "Message of the day, set with 'motd $ motd'" - elif "$" in message and str(message_from_id) in str(bbs_admin_list): #access control via bbs admin list + elif "$" in message and str(message_from_id) in bbs_admin_list.strip(): #access control via bbs admin list motd = message.split("$")[1] MOTD = motd.rstrip() logger.debug(f"System: node changed MOTD: ", {message_from_id}) @@ -93,8 +93,8 @@ def handle_motd(message, message_from_id): motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD - elif "$" in message and str(bbs_admin_list).strip(): - logger.debug(f"System: node tried to change MOTD: ", str({message_from_id}), f", admin list is: ", str({bbs_admin_list})) + elif "$" in message and bbs_admin_list.strip(): + logger.debug(f"System: node tried to change MOTD: ", str({message_from_id}), f", admin list is: ", str(bbs_admin_list)) return "I can't do that for you" else: return MOTD From add6c73af72595e972a9f4a543b3f6ec7346bd6d Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:54:44 +0100 Subject: [PATCH 41/46] asdasd --- mesh_bot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 1484f34..a28d800 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -84,7 +84,7 @@ def handle_motd(message, message_from_id): global MOTD if "?" in message and not "$": #basic help message return "Message of the day, set with 'motd $ motd'" - elif "$" in message and str(message_from_id) in bbs_admin_list.strip(): #access control via bbs admin list + elif "$" in message and str(message_from_id) in str(bbs_admin_list).strip(): #access control via bbs admin list motd = message.split("$")[1] MOTD = motd.rstrip() logger.debug(f"System: node changed MOTD: ", {message_from_id}) @@ -93,9 +93,9 @@ def handle_motd(message, message_from_id): motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD - elif "$" in message and bbs_admin_list.strip(): - logger.debug(f"System: node tried to change MOTD: ", str({message_from_id}), f", admin list is: ", str(bbs_admin_list)) - return "I can't do that for you" + elif "$" in message and str(bbs_admin_list).strip(): + logger.debug(f"System: node tried to change MOTD: ", str({message_from_id})) + return "I can't do that for you " + str(bbs_admin_list).strip() else: return MOTD From 55e09938bb9be28ade1b726932f78b9e2a5f3567 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 11:55:44 +0100 Subject: [PATCH 42/46] sdrfsdf --- mesh_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index a28d800..abbb5f7 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -89,13 +89,13 @@ def handle_motd(message, message_from_id): MOTD = motd.rstrip() logger.debug(f"System: node changed MOTD: ", {message_from_id}) return "MOTD Set to: " + MOTD - elif "$" in message and not str(bbs_admin_list).strip(): #no names in bbs admin list + elif "$" in message and not str(bbs_admin_list).strip(''): #no names in bbs admin list motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD - elif "$" in message and str(bbs_admin_list).strip(): + elif "$" in message and str(bbs_admin_list).strip(''): logger.debug(f"System: node tried to change MOTD: ", str({message_from_id})) - return "I can't do that for you " + str(bbs_admin_list).strip() + return "I can't do that for you " + str(bbs_admin_list).strip('') else: return MOTD From 88282db0e4cab0909c112147ddfe234fce75ba10 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Mon, 16 Sep 2024 12:08:33 +0100 Subject: [PATCH 43/46] put everything where it should be... --- mesh_bot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index abbb5f7..dbb8646 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -82,20 +82,20 @@ def handle_ping(message, hop, snr, rssi): def handle_motd(message, message_from_id): global MOTD - if "?" in message and not "$": #basic help message + if "?" in message and not "$": #basic help message - borked return "Message of the day, set with 'motd $ motd'" - elif "$" in message and str(message_from_id) in str(bbs_admin_list).strip(): #access control via bbs admin list + elif "$" in message and str(message_from_id) in str(bbs_admin_list): #access control via bbs admin list - works motd = message.split("$")[1] MOTD = motd.rstrip() logger.debug(f"System: node changed MOTD: ", {message_from_id}) return "MOTD Set to: " + MOTD - elif "$" in message and not str(bbs_admin_list).strip(''): #no names in bbs admin list + elif "$" in message and not str(bbs_admin_list).strip(): #no names in bbs admin list - borked motd = message.split("$")[1] MOTD = motd.rstrip() return "MOTD Set to: " + MOTD elif "$" in message and str(bbs_admin_list).strip(''): logger.debug(f"System: node tried to change MOTD: ", str({message_from_id})) - return "I can't do that for you " + str(bbs_admin_list).strip('') + return "I can't do that for you " else: return MOTD From 113bde4babeaf3f980af4b37b4f577e963cbcb05 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Fri, 20 Sep 2024 21:30:18 -0700 Subject: [PATCH 44/46] Nestpebble Ideas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Nestpebble here is the changes I did to bring this in thank you for the ideas and enhancements!! 🥔 * whoami new command * enhancing MOTD * new and better icons --- README.md | 3 ++- config.template | 2 ++ mesh_bot.py | 49 ++++++++++++++++++++++++++++++--------------- modules/settings.py | 2 ++ modules/system.py | 8 +++++++- 5 files changed, 46 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 17c0d9a..4072695 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Any messages that are over 160 characters are chunked into 160 message bytes to - `bbsdelete` delete a message example use: `bbsdelete #4` - Other functions - `whereami` returns the address of location of sender if known + - `whoami` returns some details of the node asking - `tide` returns the local tides, NOAA data source - `wx` and `wxc` returns local weather forecast, (wxc is metric value), NOAA or Open Meteo for weather forecasting. - `wxa` and `wxalert` return NOAA alerts. Short title or expanded details @@ -256,6 +257,6 @@ Games Ported from.. - https://github.com/Himan10/BlackJack - https://github.com/devtronvarma/Video-Poker-Terminal-Game -GitHub user mrpatrick1991 For Docker configs, PiDiBi looking at test functions and other suggestions like wxc, CPU use, and alerting ideas +GitHub user Nestpebble, for new ideas and enhancments, mrpatrick1991 For Docker configs, PiDiBi looking at test functions and other suggestions like wxc, CPU use, and alerting ideas Discord and Mesh user Cisien, and github Hailo1999, for testing and ideas! Lots of individuals on the Meshtastic discord who have tossed out ideas and tested code! diff --git a/config.template b/config.template index 7fe60d6..35c7c8f 100644 --- a/config.template +++ b/config.template @@ -30,6 +30,8 @@ defaultChannel = 0 # motd is reset to this value on boot motd = Thanks for using MeshBOT! Have a good day! welcome_message = MeshBot, here for you like a friend who is not. Try sending: ping @foo or, cmd +# whoami +whoami = True # enable or disable the Joke module DadJokes = True # enable or disable the Solar module diff --git a/mesh_bot.py b/mesh_bot.py index 17f9cdb..b8b1c17 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -88,22 +88,29 @@ def handle_ping(message, hop, snr, rssi): def handle_motd(message, message_from_id): global MOTD - if "?" in message and not "$": #basic help message - borked - return "Message of the day, set with 'motd $ motd'" - elif "$" in message and str(message_from_id) in str(bbs_admin_list): #access control via bbs admin list - works - motd = message.split("$")[1] - MOTD = motd.rstrip() - logger.debug(f"System: node changed MOTD: ", {message_from_id}) - return "MOTD Set to: " + MOTD - elif "$" in message and not str(bbs_admin_list).strip(): #no names in bbs admin list - borked - motd = message.split("$")[1] - MOTD = motd.rstrip() - return "MOTD Set to: " + MOTD - elif "$" in message and str(bbs_admin_list).strip(''): - logger.debug(f"System: node tried to change MOTD: ", str({message_from_id})) - return "I can't do that for you " + isAdmin = False + msg = "" + # check if the message_from_id is in the bbs_admin_list + if bbs_admin_list != ['']: + for admin in bbs_admin_list: + if str(message_from_id) == admin: + isAdmin = True + break else: - return MOTD + isAdmin = True + + if "$" 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!'" + else: + logger.debug(f"System: {message_from_id} requested MOTD: {MOTD} isAdmin: {isAdmin}") + msg = "MOTD: " + MOTD + + return msg def handle_wxalert(message_from_id, deviceID, message): if use_meteo_wxApi: @@ -482,7 +489,17 @@ def handle_testing(message, hop, snr, rssi): return "🎙Testing 1,2,3 " + hop def handle_whoami(message_from_id, deviceID): - return "You are " + str(message_from_id) + " AKA " + str(get_name_from_number(message_from_id, 'long', deviceID)) + loc = [] + msg = "You are " + str(message_from_id) + " AKA " +\ + str(get_name_from_number(message_from_id, 'long', deviceID) + " AKA " +\ + str(get_name_from_number(message_from_id, 'short', deviceID)) + " AKA " +\ + str(decimal_to_hex(message_from_id)) + " AKA " +\ + str(message_from_id) + f"\n") + loc = get_node_location(message_from_id, deviceID) + if loc != [latitudeValue,longitudeValue]: + msg += f"You are at: lat:{loc[0]} lon:{loc[1]}\n" + return msg + def onDisconnect(interface): global retry_int1, retry_int2 diff --git a/modules/settings.py b/modules/settings.py index d8312f7..9bb4b6f 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -96,6 +96,7 @@ try: welcome_message = (f"{welcome_message}").replace('\\n', '\n') # allow for newlines in the welcome message motd_enabled = config['general'].getboolean('motdEnabled', True) MOTD = config['general'].get('motd', MOTD) + whoami_enabled = config['general'].getboolean('whoami', True) dad_jokes_enabled = config['general'].getboolean('DadJokes', False) solar_conditions_enabled = config['general'].getboolean('spaceWeather', True) wikipedia_enabled = config['general'].getboolean('wikipedia', False) @@ -144,6 +145,7 @@ try: blackjack_enabled = config['games'].getboolean('blackjack', True) videoPoker_enabled = config['games'].getboolean('videoPoker', True) + # messaging settings responseDelay = config['messagingSettings'].getfloat('responseDelay', 0.7) # default 0.7 splitDelay = config['messagingSettings'].getfloat('splitDelay', 0) # default 0 MESSAGE_CHUNK_SIZE = config['messagingSettings'].getint('MESSAGE_CHUNK_SIZE', 160) # default 160 diff --git a/modules/system.py b/modules/system.py index 0934571..42ea652 100644 --- a/modules/system.py +++ b/modules/system.py @@ -10,7 +10,7 @@ import contextlib # for suppressing output on watchdog from modules.log import * # Global Variables -trap_list = ("cmd","cmd?","whoami") # default trap list +trap_list = ("cmd","cmd?",) # default trap list help_message = "CMD?:" asyncLoop = asyncio.new_event_loop() games_enabled = False @@ -34,6 +34,12 @@ if motd_enabled: trap_list = trap_list + trap_list_motd help_message = help_message + ", motd" +# whoami Configuration +if whoami_enabled: + trap_list_whoami = ("whoami",) + trap_list = trap_list + trap_list_whoami + help_message = help_message + ", whoami" + # Solar Conditions Configuration if solar_conditions_enabled: from modules.solarconditions import * # from the spudgunman/meshing-around repo From d6a0713f52f9aadf1081f454db94ec771e90b88b Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Fri, 20 Sep 2024 21:33:11 -0700 Subject: [PATCH 45/46] Update settings.py --- modules/settings.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/settings.py b/modules/settings.py index 9bb4b6f..83f3063 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -65,6 +65,14 @@ if 'radioMon' not in config: config['radioMon'] = {'enabled': 'False', 'rigControlServerAddress': 'localhost:4532', 'sigWatchBrodcastCh': '2', 'signalDetectionThreshold': '-10', 'signalHoldTime': '10', 'signalCooldown': '5', 'signalCycleLimit': '5'} config.write(open(config_file, 'w')) +if 'games' not in config: + config['games'] = {'dopeWars': 'True', 'lemonade': 'True', 'blackjack': 'True', 'videoPoker': 'True'} + config.write(open(config_file, 'w')) + +if 'messagingSettings' not in config: + config['messagingSettings'] = {'responseDelay': '0.7', 'splitDelay': '0', 'MESSAGE_CHUNK_SIZE': '160'} + config.write(open(config_file, 'w')) + # interface1 settings interface1_type = config['interface'].get('type', 'serial') port1 = config['interface'].get('port', '') From 8d1e366e103408c4409854182c4e89ad17fc40c3 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Fri, 20 Sep 2024 21:34:16 -0700 Subject: [PATCH 46/46] Update system.py --- modules/system.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system.py b/modules/system.py index 42ea652..9603b39 100644 --- a/modules/system.py +++ b/modules/system.py @@ -10,7 +10,7 @@ import contextlib # for suppressing output on watchdog from modules.log import * # Global Variables -trap_list = ("cmd","cmd?",) # default trap list +trap_list = ("cmd","cmd?") # default trap list help_message = "CMD?:" asyncLoop = asyncio.new_event_loop() games_enabled = False