Fix Terraria log parsing for player leave detection
All checks were successful
Deploy GSM / deploy (push) Successful in 24s
All checks were successful
Deploy GSM / deploy (push) Successful in 24s
Changed detection pattern from "hat das Spiel verlassen" to "ist weg" to match actual Terraria server log format. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -651,13 +651,13 @@ export async function getTerrariaPlayers(server) {
|
||||
|
||||
// Get last 500 lines of PM2 logs
|
||||
const nvmPrefix = "source ~/.nvm/nvm.sh && ";
|
||||
const result = await ssh.execCommand(nvmPrefix + `pm2 logs ${server.serviceName} --lines 500 --nostream 2>/dev/null | grep -E "ist beigetreten|hat das Spiel verlassen|has joined|has left" | tail -100`);
|
||||
const result = await ssh.execCommand(nvmPrefix + `pm2 logs ${server.serviceName} --lines 500 --nostream 2>/dev/null | grep -E "ist beigetreten|ist weg|has joined|has left" | tail -100`);
|
||||
|
||||
const players = new Map(); // PlayerName -> true
|
||||
|
||||
const lines = result.stdout.split('\n').filter(l => l.trim());
|
||||
for (const line of lines) {
|
||||
// German: "Lokführer ist beigetreten." / "Lokführer hat das Spiel verlassen."
|
||||
// German: "Lokführer ist beigetreten." / "Lokführer ist weg."
|
||||
// English: "PlayerName has joined." / "PlayerName has left."
|
||||
|
||||
// Join patterns
|
||||
@@ -674,7 +674,7 @@ export async function getTerrariaPlayers(server) {
|
||||
}
|
||||
|
||||
// Leave patterns
|
||||
const leaveMatchDE = line.match(/^\d+\|[^\|]+\s*\|\s*(.+?)\s+hat das Spiel verlassen\.?$/i);
|
||||
const leaveMatchDE = line.match(/^\d+\|[^\|]+\s*\|\s*(.+?)\s+ist weg\.?$/i);
|
||||
const leaveMatchEN = line.match(/^\d+\|[^\|]+\s*\|\s*(.+?)\s+has left\.?$/i);
|
||||
|
||||
if (leaveMatchDE) {
|
||||
|
||||
Reference in New Issue
Block a user