msg = await read_msg()
id_ = msg.id
cts = msg.contentThe quick brown fox jumps over the lazy dog. Jackdaws love my big sphinx of quartz. Pack my box with five dozen liquor jugs. How vexingly quick daft zebras jump! The five boxing wizards jump quickly. Sphinx of black quartz, judge my vow. Two driven jocks help fax my big quiz. Bright vixens jump; dozy fowl quack.
msg_lnhashview
async def msg_lnhashview(
id:str, # id of message to view
dname:str='', # Dialog containing message; defaults to current dialog
start_line:int=None, # Starting line (1-based) to view (defaults to 1st line if None)
end_line:int=None, # End line (defaults to last line if None)
)->str:Show lnhash-addressed lines of a message
await msg_lnhashview(id_, end=4)1|da2a|The quick brown fox jumps over the lazy dog.
2|32e4|Jackdaws love my big sphinx of quartz.
3|04e4|Pack my box with five dozen liquor jugs.
4|025f|How vexingly quick daft zebras jump!
msg_exhash
async def msg_exhash(
id:str, # id of message to edit
cmds:list, # List of exhash command tuples to apply
dname:str='', # Dialog containing message; defaults to current dialog
)->str:Verified line-addressed editor. Apply command tuples to msg id contents, return lnhash diff. NB: every command is a tuple whose first element is an address string. NB: hashes are checked against the current text immediately before each command runs; order commands last->first.
Use msg_lnhashview(id) to get hash-verified addresses before first use.
Address strings: Single: 12|a3f2| Range: 12|a3f2|,15|b1c3| Last: $ (last line) Whole: % (whole file, same as 1,$) Special: 0|0000| targets before line 1 (only with a or i)
Command tuples: (addr, “s”, pattern, replacement[, flags]) Substitute (Rust regex syntax). Replacement supports $1, $0, ${name}. Flags: g=all, i=case-insensitive. args may contain literal / & newlines (addr, “d”) Delete line(s) (addr, “a”, text) Append payload after line (addr, “i”, text) Insert payload before line (addr, “c”, text) Change/replace with payload (addr, “j”) Join with next line; with range, joins all (addr, “m”, dest) Move line(s) after dest address (addr, “t”, dest) Copy line(s) after dest address (addr, “>”, n) Indent n levels (default 1, 4 spaces each) (addr, “<”, n) Dedent n levels (default 1) (addr, “sort”) Sort lines alphabetically (addr, “p”) Print (include in output without changing) (addr, “g”, payload), (addr, “g!”, payload), (addr, “v”, payload) Global commands; payload uses compact ex syntax such as /pattern/d (addr, “y”, payload) Transliterate; payload uses compact ex syntax such as /abc/ABC/
cmds is a required list of command tuples. Text fields may contain newlines, including multiline a/i/c payloads and s pattern/replacement fields; payloads are inserted literally. Do NOT add a trailing . line — the string boundary ends the block. A trailing . will be inserted literally (with a warning).