From 13ff55efe079a10cf7e6b10f6234c1ff3b478eef Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Tue, 15 Feb 2022 17:07:03 +0200 Subject: [PATCH] improve regex --- scripts/minecraft.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/minecraft.js b/scripts/minecraft.js index a448c49..b578d7d 100644 --- a/scripts/minecraft.js +++ b/scripts/minecraft.js @@ -22,9 +22,9 @@ const messageTypes = { EVENT: 3 }; -const chatMessageRegex = /^\[(?:.*?)\]: \<(?.*)\> (?.*)/; -const joinNotificationRegex = /^\[(?:.*?)\]: (?.*) joined the game/; -const leaveNotificationRegex = /^\[(?:.*?)\]: (?.*) left the game/; +const chatMessageRegex = /^\[(?:.*?)\]: \<(?[a-zA-Z0-9]+)\> (?.*)/; +const joinNotificationRegex = /^\[(?:.*?)\]: (?[a-zA-Z0-9]+) joined the game/; +const leaveNotificationRegex = /^\[(?:.*?)\]: (?[a-zA-Z0-9]+) left the game/; const rconConnection = new Rcon("localhost", "25575", process.env.RCON_PASSWORD); export default class GatewayClient {