mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-07-30 05:23:35 +02:00
🕹️📊
This commit is contained in:
+12
-11
@@ -77,20 +77,21 @@ def parse_log_file(file_path):
|
||||
timestamp = datetime.strptime(timestamp_match.group(1), '%Y-%m-%d %H:%M:%S')
|
||||
log_data['hourly_activity'][timestamp.strftime('%Y-%m-%d %H:00:00')] += 1
|
||||
|
||||
if 'Bot detected Commands' in line or 'LLM Query:' in line:
|
||||
if 'Bot detected Commands' in line or 'LLM Query:' in line or 'PlayingGame' in line:
|
||||
# get the command and user from the line
|
||||
command = re.search(r"'cmd': '(\w+)'", line)
|
||||
user = re.search(r"From: (\w+)", line)
|
||||
|
||||
if 'LLM Query:' in line:
|
||||
log_data['command_counts']['LLM Query'] += 1
|
||||
log_data['command_timestamps'].append((timestamp.isoformat(), 'LLM Query'))
|
||||
|
||||
command = re.search(r"'cmd': '(\w+)'", line)
|
||||
user = re.search(r"From: (\w+)", line)
|
||||
if user:
|
||||
user = user.group(1)
|
||||
if command:
|
||||
cmd = command.group(1)
|
||||
log_data['command_counts'][cmd] += 1
|
||||
# include the user who sent the command
|
||||
log_data['command_timestamps'].append((timestamp.isoformat(), cmd + f' from {user}'))
|
||||
|
||||
if 'PlayingGame' in line:
|
||||
#log line looks like this. 2024-10-04 20:24:53,381 | DEBUG | System: 862418040 PlayingGame BlackJack last_cmd: new
|
||||
game = re.search(r'PlayingGame (\w+)', line)
|
||||
user = re.search(r'System: (\d+)', line)
|
||||
log_data['command_counts'][game.group(1)] += 1
|
||||
log_data['command_timestamps'].append((timestamp.isoformat(), game))
|
||||
|
||||
if 'Sending DM:' in line or 'Sending Multi-Chunk DM:' in line or 'SendingChannel:' in line or 'Sending Multi-Chunk Message:' in line:
|
||||
log_data['message_types']['Outgoing DM'] += 1
|
||||
|
||||
@@ -79,13 +79,22 @@ def parse_log_file(file_path):
|
||||
timestamp = datetime.strptime(timestamp_match.group(1), '%Y-%m-%d %H:%M:%S')
|
||||
log_data['hourly_activity'][timestamp.strftime('%Y-%m-%d %H:00:00')] += 1
|
||||
|
||||
if 'Bot detected Commands' in line or 'LLM Query:' in line:
|
||||
if 'Bot detected Commands' in line or 'LLM Query:' in line or 'PlayingGame' in line:
|
||||
# get the command and user from the line
|
||||
command = re.search(r"'cmd': '(\w+)'", line)
|
||||
user = re.search(r"From: (\w+)", line)
|
||||
|
||||
if 'LLM Query:' in line:
|
||||
log_data['command_counts']['LLM Query'] += 1
|
||||
log_data['command_timestamps'].append((timestamp.isoformat(), 'LLM Query'))
|
||||
|
||||
command = re.search(r"'cmd': '(\w+)'", line)
|
||||
user = re.search(r"From: (\w+)", line)
|
||||
|
||||
if 'PlayingGame' in line:
|
||||
#log line looks like this. 2024-10-04 20:24:53,381 | DEBUG | System: 862418040 PlayingGame BlackJack last_cmd: new
|
||||
game = re.search(r'PlayingGame (\w+)', line)
|
||||
user = re.search(r'System: (\d+)', line)
|
||||
log_data['command_counts'][game.group(1)] += 1
|
||||
log_data['command_timestamps'].append((timestamp.isoformat(), game))
|
||||
|
||||
if user:
|
||||
user = user.group(1)
|
||||
if command:
|
||||
|
||||
+11
-3
@@ -337,7 +337,7 @@ def handleDopeWars(nodeID, message, rxNode):
|
||||
msg += 'The High Score is $' + "{:,}".format(high_score.get('cash')) + ' by user ' + get_name_from_number(high_score.get('userID') , 'short', rxNode) +'\n'
|
||||
msg += playDopeWars(nodeID, message)
|
||||
else:
|
||||
logger.debug("System: DopeWars: last_cmd: " + str(last_cmd))
|
||||
logger.debug(f"System: {nodeID} PlayingGame dopewars last_cmd: {last_cmd}")
|
||||
msg = playDopeWars(nodeID, message)
|
||||
# wait a second to keep from message collision
|
||||
time.sleep(1)
|
||||
@@ -376,6 +376,8 @@ def handleLemonade(nodeID, message):
|
||||
for i in range(len(lemonadeTracker)):
|
||||
if lemonadeTracker[i]['nodeID'] == nodeID:
|
||||
last_cmd = lemonadeTracker[i]['cmd']
|
||||
|
||||
logger.debug(f"System: {nodeID} PlayingGame lemonstand last_cmd: {last_cmd}")
|
||||
# create new player if not in tracker
|
||||
if last_cmd == "" and nodeID != 0:
|
||||
create_player(nodeID)
|
||||
@@ -420,7 +422,7 @@ def handleBlackJack(nodeID, message):
|
||||
msg = playBlackJack(nodeID=nodeID, message=message)
|
||||
|
||||
if last_cmd != "" and nodeID != 0:
|
||||
logger.debug(f"System: BlackJack: {nodeID} last command: {last_cmd}")
|
||||
logger.debug(f"System: {nodeID} PlayingGame blackjack last_cmd: {last_cmd}")
|
||||
else:
|
||||
highScore = {'nodeID': 0, 'highScore': 0}
|
||||
highScore = loadHSJack()
|
||||
@@ -467,7 +469,7 @@ def handleVideoPoker(nodeID, message):
|
||||
msg += f" HighScore🥇{nodeName} with {highScore['highScore']} coins. "
|
||||
|
||||
if last_cmd != "" and nodeID != 0:
|
||||
logger.debug(f"System: VideoPoker: {nodeID} last command: {last_cmd}")
|
||||
logger.debug(f"System: {nodeID} PlayingGame videopoker last_cmd: {last_cmd}")
|
||||
time.sleep(1.5) # short answers with long replies can cause message collision added wait
|
||||
return msg
|
||||
|
||||
@@ -493,6 +495,8 @@ def handleMmind(nodeID, deviceID, message):
|
||||
if mindTracker[i]['nodeID'] == nodeID:
|
||||
last_cmd = mindTracker[i]['cmd']
|
||||
|
||||
logger.debug(f"System: {nodeID} PlayingGame mastermind last_cmd: {last_cmd}")
|
||||
|
||||
if last_cmd == "" and nodeID != 0:
|
||||
# create new player
|
||||
logger.debug("System: MasterMind: New Player: " + str(nodeID))
|
||||
@@ -525,6 +529,8 @@ def handleGolf(nodeID, message):
|
||||
golfTracker.pop(i)
|
||||
return msg
|
||||
|
||||
logger.debug(f"System: {nodeID} PlayingGame golfsim last_cmd: {last_cmd}")
|
||||
|
||||
if last_cmd == "" and nodeID != 0:
|
||||
# create new player
|
||||
logger.debug("System: GolfSim: New Player: " + str(nodeID))
|
||||
@@ -547,6 +553,8 @@ def handleUno(nodeID, deviceID, message):
|
||||
if unoTracker[i]['nodeID'] == nodeID:
|
||||
last_cmd = unoTracker[i]['cmd']
|
||||
|
||||
logger.debug(f"System: {nodeID} PlayingGame uno last_cmd: {last_cmd}")
|
||||
|
||||
if last_cmd == "" and nodeID != 0:
|
||||
# create new player
|
||||
logger.debug("System: Uno: New Player: " + str(nodeID) + " " + get_name_from_number(nodeID))
|
||||
|
||||
@@ -236,8 +236,6 @@ def start_lemonade(nodeID, message, celsius=False):
|
||||
score.value = lemonadeScore[i]['value']
|
||||
score.total = lemonadeScore[i]['total']
|
||||
|
||||
logger.debug("System: Lemonade: Last Command: " + last_cmd)
|
||||
|
||||
# Start the main loop
|
||||
if (weeks.current <= weeks.total):
|
||||
|
||||
|
||||
@@ -296,8 +296,6 @@ def start_mMind(nodeID, message):
|
||||
if mindTracker[i]['nodeID'] == nodeID:
|
||||
last_cmd = mindTracker[i]['cmd']
|
||||
|
||||
logger.debug("System: MasterMind: last_cmd: " + str(last_cmd))
|
||||
|
||||
if last_cmd == "new":
|
||||
if message.lower().startswith("n") or message.lower().startswith("h") or message.lower().startswith("x"):
|
||||
diff = message.lower()[0]
|
||||
|
||||
Reference in New Issue
Block a user