forked from uniborg/uniborg
Use literal . in regex for commands
This commit is contained in:
parent
15d8b312f4
commit
def5d5d651
|
@ -17,8 +17,8 @@ def aesthetify(string):
|
||||||
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))
|
||||||
@borg.on(events.MessageEdited(pattern=r'.ae\s+(.+)', outgoing=True))
|
@borg.on(events.MessageEdited(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))
|
||||||
|
|
|
@ -14,7 +14,7 @@ TYPE_DOCUMENT = 2
|
||||||
snips = storage.snips or {}
|
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):
|
async def on_snip(event):
|
||||||
name = event.pattern_match.group(1)
|
name = event.pattern_match.group(1)
|
||||||
if name not in snips:
|
if name not in snips:
|
||||||
|
@ -35,7 +35,7 @@ async def on_snip(event):
|
||||||
await event.delete()
|
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):
|
async def on_snip_save(event):
|
||||||
name = event.pattern_match.group(1)
|
name = event.pattern_match.group(1)
|
||||||
msg = await event.reply_message
|
msg = await event.reply_message
|
||||||
|
@ -60,20 +60,20 @@ async def on_snip_save(event):
|
||||||
await event.delete()
|
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):
|
async def on_snip_list(event):
|
||||||
await event.respond('available snips: ' + ', '.join(snips.keys()))
|
await event.respond('available snips: ' + ', '.join(snips.keys()))
|
||||||
await event.delete()
|
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):
|
async def on_snip_delete(event):
|
||||||
snips.pop(event.pattern_match.group(1), None)
|
snips.pop(event.pattern_match.group(1), None)
|
||||||
storage.snips = snips
|
storage.snips = snips
|
||||||
await event.delete()
|
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):
|
async def on_snip_rename(event):
|
||||||
snip = snips.pop(event.pattern_match.group(1), None)
|
snip = snips.pop(event.pattern_match.group(1), None)
|
||||||
if snip:
|
if snip:
|
||||||
|
|
Loading…
Reference in New Issue