You've already forked STARK
mirror of
https://github.com/MarkParker5/STARK.git
synced 2025-11-28 21:39:53 +02:00
19 lines
485 B
Python
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
|