From def5d5d6515ce6df0344fde4e11c8ada8fd89a06 Mon Sep 17 00:00:00 2001 From: EyeZiS Date: Thu, 14 Jun 2018 20:03:14 +0200 Subject: [PATCH] Use literal . in regex for commands --- stdplugins/aesthetics.py | 4 ++-- stdplugins/snip.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/stdplugins/aesthetics.py b/stdplugins/aesthetics.py index 462fc32..0495c5d 100644 --- a/stdplugins/aesthetics.py +++ b/stdplugins/aesthetics.py @@ -17,8 +17,8 @@ def aesthetify(string): yield chr(c) -@borg.on(events.NewMessage(pattern=r'.ae\s+(.+)', outgoing=True)) -@borg.on(events.MessageEdited(pattern=r'.ae\s+(.+)', outgoing=True)) +@borg.on(events.NewMessage(pattern=r'\.ae\s+(.+)', outgoing=True)) +@borg.on(events.MessageEdited(pattern=r'\.ae\s+(.+)', outgoing=True)) async def _(event): text = event.pattern_match.group(1) text = "".join(aesthetify(text)) diff --git a/stdplugins/snip.py b/stdplugins/snip.py index 9668b15..5ec01a9 100644 --- a/stdplugins/snip.py +++ b/stdplugins/snip.py @@ -14,7 +14,7 @@ TYPE_DOCUMENT = 2 snips = storage.snips or {} -@borg.on(events.NewMessage(pattern=r'.snip (\S+)', outgoing=True)) +@borg.on(events.NewMessage(pattern=r'\.snip (\S+)', outgoing=True)) async def on_snip(event): name = event.pattern_match.group(1) if name not in snips: @@ -35,7 +35,7 @@ async def on_snip(event): await event.delete() -@borg.on(events.NewMessage(pattern=r'.snips (\S+)', outgoing=True)) +@borg.on(events.NewMessage(pattern=r'\.snips (\S+)', outgoing=True)) async def on_snip_save(event): name = event.pattern_match.group(1) msg = await event.reply_message @@ -60,20 +60,20 @@ async def on_snip_save(event): await event.delete() -@borg.on(events.NewMessage(pattern=r'.snipl', outgoing=True)) +@borg.on(events.NewMessage(pattern=r'\.snipl', outgoing=True)) async def on_snip_list(event): await event.respond('available snips: ' + ', '.join(snips.keys())) await event.delete() -@borg.on(events.NewMessage(pattern=r'.snipd (\S+)', outgoing=True)) +@borg.on(events.NewMessage(pattern=r'\.snipd (\S+)', outgoing=True)) async def on_snip_delete(event): snips.pop(event.pattern_match.group(1), None) storage.snips = snips await event.delete() -@borg.on(events.NewMessage(pattern=r'.snipr (\S+)\s+(\S+)', outgoing=True)) +@borg.on(events.NewMessage(pattern=r'\.snipr (\S+)\s+(\S+)', outgoing=True)) async def on_snip_rename(event): snip = snips.pop(event.pattern_match.group(1), None) if snip: