forked from kate/uniborg
aesthetics: clean up, fix spaces
This commit is contained in:
parent
85b68dd259
commit
02b1a949b0
|
@ -3,9 +3,8 @@
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
from telethon import events
|
from telethon import events
|
||||||
from telethon.tl.functions.messages import EditMessageRequest
|
|
||||||
|
|
||||||
PRINTABLE_ASCII = range(0x20, 0x7f)
|
PRINTABLE_ASCII = range(0x21, 0x7f)
|
||||||
|
|
||||||
|
|
||||||
def aesthetify(string):
|
def aesthetify(string):
|
||||||
|
@ -13,17 +12,14 @@ def aesthetify(string):
|
||||||
c = ord(c)
|
c = ord(c)
|
||||||
if c in PRINTABLE_ASCII:
|
if c in PRINTABLE_ASCII:
|
||||||
c += 0xFF00 - 0x20
|
c += 0xFF00 - 0x20
|
||||||
|
elif c == ord(" "):
|
||||||
|
c = 0x3000
|
||||||
yield chr(c)
|
yield chr(c)
|
||||||
|
|
||||||
|
|
||||||
@borg.on(events.NewMessage(pattern=r'.ae (\S+)', outgoing=True))
|
@borg.on(events.NewMessage(pattern=r'.ae\s+(.+)', outgoing=True))
|
||||||
async def _(event):
|
async def _(event):
|
||||||
text = event.pattern_match.group(1)
|
text = event.pattern_match.group(1)
|
||||||
text = "".join(aesthetify(text))
|
text = "".join(aesthetify(text))
|
||||||
|
await event.edit(text=text, parse_mode=None, link_preview=False)
|
||||||
await borg(EditMessageRequest(
|
raise events.StopPropagation
|
||||||
peer=await event.input_chat,
|
|
||||||
id=event.message.id,
|
|
||||||
message=text,
|
|
||||||
no_webpage=not bool(event.message.media)
|
|
||||||
))
|
|
||||||
|
|
Loading…
Reference in New Issue