fix: use raw string for _POLL_JS to avoid Python escape warnings
This commit is contained in:
parent
ed3bff76e5
commit
a4727454b9
@ -14,8 +14,9 @@ _START_RE = re.compile(r'^!start(?:\s+(.+))?$', re.IGNORECASE)
|
|||||||
_STOP_RE = re.compile(r'^!stop$', re.IGNORECASE)
|
_STOP_RE = re.compile(r'^!stop$', re.IGNORECASE)
|
||||||
_QUOTE_CHARS = '"“”' # straight, left and right double quote
|
_QUOTE_CHARS = '"“”' # straight, left and right double quote
|
||||||
|
|
||||||
# JavaScript that extracts (sender, text, id) from both channel and meeting chat DOM
|
# JavaScript that extracts (sender, text, id) from both channel and meeting chat DOM.
|
||||||
_POLL_JS = """() => {
|
# Use raw string so \s, \d etc. pass through to JavaScript unchanged.
|
||||||
|
_POLL_JS = r"""() => {
|
||||||
const msgs = [];
|
const msgs = [];
|
||||||
|
|
||||||
// Channel meeting: channel-pane-message contains reply-message-header + message-body siblings
|
// Channel meeting: channel-pane-message contains reply-message-header + message-body siblings
|
||||||
@ -57,7 +58,7 @@ _POLL_JS = """() => {
|
|||||||
const pEls = msg.querySelectorAll('p');
|
const pEls = msg.querySelectorAll('p');
|
||||||
let text;
|
let text;
|
||||||
if (pEls.length > 0) {
|
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 {
|
} else {
|
||||||
// Fallback: strip sender name + timestamp from innerText
|
// Fallback: strip sender name + timestamp from innerText
|
||||||
let raw = msg.innerText.trim();
|
let raw = msg.innerText.trim();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user