From af98f87f530b98534e267e03a6014922007e9a1c Mon Sep 17 00:00:00 2001 From: Tristan Gosselin-Hane Date: Sat, 27 Oct 2018 20:34:22 -0400 Subject: [PATCH] Fix the join/leave regex unintentionally letting people fake join/leave events with chat messages --- webhook-bridge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webhook-bridge.py b/webhook-bridge.py index e8be260..9d9c470 100755 --- a/webhook-bridge.py +++ b/webhook-bridge.py @@ -238,7 +238,7 @@ def main(): chat_string += chat_component["text"] # Handle join/leave - regexp_match = re.match("^(.*) (joined|left) the game", chat_string, re.M|re.I) + regexp_match = re.match("^([A-Za-z0-9_]*) (joined|left) the game", chat_string, re.M|re.I) if regexp_match: logging.info("Username: {} Status: {} the game".format(regexp_match.group(1), regexp_match.group(2))) username = regexp_match.group(1)