Let normal snip command also save if not existing

This commit is contained in:
Lonami Exo 2018-04-23 16:17:31 +02:00
parent bdb402e645
commit 6a59f1d982
1 changed files with 3 additions and 1 deletions

View File

@ -20,7 +20,9 @@ snips = storage.snips or {}
@borg.on(events.NewMessage(pattern=r'.snip (\S+)')) @borg.on(events.NewMessage(pattern=r'.snip (\S+)'))
async def on_snip(event): async def on_snip(event):
name = event.pattern_match.group(1) name = event.pattern_match.group(1)
if name in snips: if name not in snips:
await on_snip_save(event)
else:
snip = snips[name] snip = snips[name]
if snip['type'] == TYPE_PHOTO: if snip['type'] == TYPE_PHOTO:
media = types.InputPhoto(snip['id'], snip['hash']) media = types.InputPhoto(snip['id'], snip['hash'])