diff --git a/mesh_bot.py b/mesh_bot.py index b0c870b..231bfd0 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -579,8 +579,7 @@ def handle_history(message, nodeid, deviceID, isDM, lheard=False): # create the message from the buffer list for i in range(0, len(buffer)): msg += f"{buffer[i][0]}: {buffer[i][1]} :{buffer[i][2]} ago" - if i < len(buffer) - 1: - msg += "\n" + if i < len(buffer) - 1: msg += "\n" # add a new line if not the last line else: # sort the cmdHistory list by time, return the username and time into a new list which used for display for i in range(len(cmdHistory)): @@ -599,10 +598,11 @@ def handle_history(message, nodeid, deviceID, isDM, lheard=False): buffer[j] = (nodeName, prettyTime) # create the message from the buffer list + buffer.reverse() # reverse the list to show the latest first for i in range(0, len(buffer)): msg += f"{buffer[i][0]} seen {buffer[i][1]} ago" - if i < len(buffer) - 1: - msg += "\n" + if i < len(buffer) - 1: msg += "\n" # add a new line if not the last line + if i > 3: break # only return the last 4 nodes return msg def handle_whereami(message_from_id, deviceID, channel_number):