Fix snips should only work if outgoing

This commit is contained in:
Lonami Exo 2018-04-24 10:11:13 +02:00
parent 6a59f1d982
commit 5ade1cf621
1 changed files with 5 additions and 5 deletions

View File

@ -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: