From b8e9adb223a24adbafd6a0c46ea0c53b4a16648a Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Tue, 7 Oct 2025 13:48:23 -0700 Subject: [PATCH] fixMessagesCommand thanks @mesb1 https://github.com/SpudGunMan/meshing-around/issues/200 --- README.md | 2 +- mesh_bot.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 60fb4d7..1a1a47b 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ git clone https://github.com/spudgunman/meshing-around | Command | Description | | |---------|-------------|- | `askai` and `ask:` | Ask Ollama LLM AI for a response. Example: `askai what temp do I cook chicken` | ✅ | -| `messages` | Replays the last messages heard, like Store and Forward | ✅ | +| `messages` | Replays the last messages heard on device, like Store and Forward, returns the PublicChannel and Current | ✅ | | `readnews` | returns the contents of a file (news.txt, by default) via the chunker on air | ✅ | | `satpass` | returns the pass info from API for defined NORAD ID in config or Example: `satpass 25544,33591`| | | `wiki:` | Searches Wikipedia and returns the first few sentences of the first result if a match. Example: `wiki: lora radio` | diff --git a/mesh_bot.py b/mesh_bot.py index 5951df7..8617770 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -962,6 +962,10 @@ def handle_messages(message, deviceID, channel_number, msg_history, publicChanne else: response = "" for msgH in msg_history: + # number of messages to return + if len(response.split("\n"))/2 >= storeFlimit: + break + # if the message is for this deviceID and channel or publicChannel if msgH[4] == deviceID: if msgH[2] == channel_number or msgH[2] == publicChannel: response += f"\n{msgH[0]}: {msgH[1]}"