fix: use raw string for _POLL_JS to avoid Python escape warnings

This commit is contained in:
Oliver Hofmann 2026-05-17 13:36:53 +02:00
parent ed3bff76e5
commit a4727454b9

View File

@ -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();