1
0
mirror of https://github.com/MarkParker5/STARK.git synced 2025-11-28 21:39:53 +02:00
Files
STARK/Command/Callback.py
2020-10-31 15:29:58 +02:00

19 lines
485 B
Python

from .Command import Command
import re
class Callback:
def __init__(this, patterns):
this.patterns = patterns
def setStart(this, function):
this.start = function
def start(this, params):
pass
def answer(this, string):
for pattern in this.patterns:
if match := re.search(re.compile(Command.compilePattern(pattern)), string):
return this.start({**match.groupdict(), 'string':string})
return None