From f651f2e577a6da30bc963644e88bc8e4d455d180 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 18 Sep 2024 01:05:28 -0700 Subject: [PATCH] fix stale players --- README.md | 8 ++++++-- mesh_bot.py | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 40bc52b..556c751 100644 --- a/README.md +++ b/README.md @@ -248,6 +248,10 @@ I used ideas and snippets from other responder bots and want to call them out! - https://github.com/pdxlocations/meshtastic-Python-Examples - https://github.com/geoffwhittington/meshtastic-matrix-relay -GitHub user 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! +Games Ported from.. +- https://github.com/tigerpointe/Lemonade-Stand/ +- https://github.com/Reconfirefly/drugwars + +GitHub user 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/mesh_bot.py b/mesh_bot.py index f879058..9f08384 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -497,6 +497,11 @@ def onReceive(packet, interface): game = "DopeWars" if llm_enabled: logger.debug(f"System: LLM Disabled for {message_from_id} for duration of game") + + #if time exceeds 8 hours reset the player + if dwPlayerTracker[i].get('last_played') < (time.time() - 28800): + dwPlayerTracker.pop(i) + for i in range(0, len(lemonadeTracker)): if lemonadeTracker[i].get('nodeID') == message_from_id: @@ -506,6 +511,10 @@ def onReceive(packet, interface): game = "LemonadeStand" if llm_enabled: logger.debug(f"System: LLM Disabled for {message_from_id} for duration of game") + + #if time exceeds 8 hours reset the player + if lemonadeTracker[i].get('time') < (time.time() - 28800): + lemonadeTracker.pop(i) else: playingGame = False else: