This commit is contained in:
Louis Mazin 2025-12-09 19:37:16 +01:00
parent 90d2507cd0
commit 7728c35372

View File

@ -31,7 +31,6 @@ const parseLogMessage = (log) => {
needsSteamId: true
};
}
console.log("oui");
console.log(log);
// Détecter les déconnexions: [2025-12-09 18:55:19] [LOG] Nami left the server. (User id: gdk_2535420062888893)
const disconnectRegex = /\[.*?\]\s*\[LOG\]\s*(.+?)\s+left the server\.\s*\(User id:\s*(.+?)\)/i;
@ -236,16 +235,13 @@ const connectWebSocket = async (pterodactylToken, serverId) => {
}
} else if (linkData.type === 'disconnect') {
// Extraire le Steam ID du userId (format: gdk_STEAMID)
const steamIdMatch = linkData.userId.match(/gdk_(\d+)/);
if (steamIdMatch) {
const steamId = steamIdMatch[1];
try {
await updateLastConnection(steamId);
console.log(`✅ Dernière connexion mise à jour pour ${linkData.playerName} (${steamId})`);
await updateLastConnection(linkData.userId);
console.log(`✅ Dernière connexion mise à jour pour ${linkData.playerName} (${linkData.userId})`);
} catch (error) {
console.error('Erreur lors de la mise à jour de la dernière connexion:', error);
}
}
}
}
}