Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

deferredCommandMessage.ts

12 lines698 Bytes

1// SQLite's trim needs the characters JavaScript's String.prototype.trim removes spelled out.
2export const JAVASCRIPT_TRIM_WHITESPACE =
3 " \t\n\r\v\f\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff";
4​
5const text = `json_extract(payload_json, '$.text')`;
6const whitespace = `'${JAVASCRIPT_TRIM_WHITESPACE}'`;
7​
8/**
9 * A user message that may be a slash command, whose turns defer context to the next one. The
10 * partial index on it is only used when the read spells this text the same way.
11 */
12export const DEFERRED_COMMAND_MESSAGE_CONDITION = `role = 'user' AND json_valid(payload_json) AND trim(${text}, ${whitespace}) GLOB '/*'`;