forked from uniborg/uniborg
allow "..e" to edit to empty
also clean-up code but no one reads these
This commit is contained in:
parent
926ea5751c
commit
5275a27020
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue