allow "..e" to edit to empty

also clean-up code but no one reads these
This commit is contained in:
udf 2018-12-07 16:25:58 +02:00
parent 926ea5751c
commit 5275a27020
Signed by: kate
GPG Key ID: E40724BAD73AF77B
1 changed files with 4 additions and 5 deletions

View File

@ -23,19 +23,18 @@ async def on_edit_start(event, target):
)) ))
@self_reply_cmd(borg, r'(?ms)^(.+)\n\.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] if text == '.':
if message.strip() == '.': text = ''
message = ''
chat = await event.get_input_chat() chat = await event.get_input_chat()
try: try:
await borg(EditMessageRequest( await borg(EditMessageRequest(
peer=chat, peer=chat,
id=target.id, id=target.id,
no_webpage=not target.media, no_webpage=not target.media,
message=message, message=text,
entities=event.message.entities entities=event.message.entities
)) ))
except MessageEmptyError: except MessageEmptyError: