Remove delay before making draft and only fire on \n.e

This commit is contained in:
udf 2018-11-28 15:09:29 +02:00
parent e43d3b29bf
commit 7426cea6d2
Signed by: kate
GPG Key ID: E40724BAD73AF77B
1 changed files with 1 additions and 2 deletions

View File

@ -14,7 +14,6 @@ from stdplugins.kbass_core import self_reply_cmd
@self_reply_cmd(borg, r"^\.e$") @self_reply_cmd(borg, r"^\.e$")
async def on_edit_start(event, target): async def on_edit_start(event, target):
await asyncio.sleep(3) # tdesktop doesn't sync drafts when the window is active
await borg(SaveDraftRequest( await borg(SaveDraftRequest(
peer=await event.get_input_chat(), peer=await event.get_input_chat(),
message=(target.message or '.') + '\n.e', message=(target.message or '.') + '\n.e',
@ -24,7 +23,7 @@ async def on_edit_start(event, target):
)) ))
@self_reply_cmd(borg, r'(?ms)^(.+)\.e$') @self_reply_cmd(borg, r'(?ms)^(.+)\n\.e$')
async def on_edit_end(event, target): async def on_edit_end(event, target):
text = event.pattern_match.group(1) text = event.pattern_match.group(1)
message = event.message.message[:-2] message = event.message.message[:-2]