From a4727454b9beedfffbd8debfda3d79ef5f42cb87 Mon Sep 17 00:00:00 2001 From: Oliver Hofmann Date: Sun, 17 May 2026 13:36:53 +0200 Subject: [PATCH] fix: use raw string for _POLL_JS to avoid Python escape warnings --- src/teampulse/monitor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/teampulse/monitor.py b/src/teampulse/monitor.py index 6635756..3f2313b 100644 --- a/src/teampulse/monitor.py +++ b/src/teampulse/monitor.py @@ -14,8 +14,9 @@ _START_RE = re.compile(r'^!start(?:\s+(.+))?$', re.IGNORECASE) _STOP_RE = re.compile(r'^!stop$', re.IGNORECASE) _QUOTE_CHARS = '"“”' # straight, left and right double quote -# JavaScript that extracts (sender, text, id) from both channel and meeting chat DOM -_POLL_JS = """() => { +# JavaScript that extracts (sender, text, id) from both channel and meeting chat DOM. +# Use raw string so \s, \d etc. pass through to JavaScript unchanged. +_POLL_JS = r"""() => { const msgs = []; // Channel meeting: channel-pane-message contains reply-message-header + message-body siblings @@ -57,7 +58,7 @@ _POLL_JS = """() => { const pEls = msg.querySelectorAll('p'); let text; if (pEls.length > 0) { - text = Array.from(pEls).map(p => p.innerText.trim()).filter(t => t).join('\\n'); + text = Array.from(pEls).map(p => p.innerText.trim()).filter(t => t).join('\n'); } else { // Fallback: strip sender name + timestamp from innerText let raw = msg.innerText.trim();