From 5ade1cf621d94bb54fb14827ab624a5a9a7df357 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 24 Apr 2018 10:11:13 +0200 Subject: [PATCH] Fix snips should only work if outgoing --- stdplugins/snip.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stdplugins/snip.py b/stdplugins/snip.py index f97dbfb..acaac59 100644 --- a/stdplugins/snip.py +++ b/stdplugins/snip.py @@ -17,7 +17,7 @@ TYPE_DOCUMENT = 2 snips = storage.snips or {} -@borg.on(events.NewMessage(pattern=r'.snip (\S+)')) +@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: @@ -38,7 +38,7 @@ async def on_snip(event): await event.delete() -@borg.on(events.NewMessage(pattern=r'.snips (\S+)')) +@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 @@ -63,19 +63,19 @@ async def on_snip_save(event): await event.delete() -@borg.on(events.NewMessage(pattern=r'.snipl')) +@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+)')) +@borg.on(events.NewMessage(pattern=r'.snipd (\S+)', outgoing=True)) async def on_snip_delete(event): snips.pop(event.pattern_match.group(1), None) await event.delete() -@borg.on(events.NewMessage(pattern=r'.snipr (\S+)\s+(\S+)')) +@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: