mirror of
https://github.com/maubot/maubot.git
synced 2024-10-01 01:06:10 -04:00
Add temporary request_db_engine() implementation
This commit is contained in:
parent
fd14a38546
commit
485040e687
@ -64,7 +64,7 @@ class ParsedCommand:
|
||||
self.name = command.name
|
||||
self.is_passive = True
|
||||
self.match_against = command.match_against
|
||||
self.matches = re.compile(command.matches)
|
||||
self.matches = re.compile(command.matches, re.UNICODE)
|
||||
self.match_event = command.match_event
|
||||
|
||||
def _init_active(self, command: Command) -> None:
|
||||
@ -90,7 +90,7 @@ class ParsedCommand:
|
||||
sw_builder.append(word)
|
||||
regex_builder.append(re.escape(word))
|
||||
self.starts_with = "!" + " ".join(sw_builder)
|
||||
self.matches = re.compile("^!" + " ".join(regex_builder) + "$")
|
||||
self.matches = re.compile("^!" + " ".join(regex_builder) + "$", re.UNICODE)
|
||||
self.match_against = "body"
|
||||
|
||||
def match(self, evt: MessageEvent) -> bool:
|
||||
|
@ -17,6 +17,9 @@ from typing import Type, Optional, TYPE_CHECKING
|
||||
from logging import Logger
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from sqlalchemy.engine.base import Engine
|
||||
import sqlalchemy as sql
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .client import MaubotMatrixClient
|
||||
from .command_spec import CommandSpec
|
||||
@ -36,6 +39,9 @@ class Plugin(ABC):
|
||||
self.log = log
|
||||
self.config = config
|
||||
|
||||
def request_db_engine(self) -> Engine:
|
||||
return sql.create_engine(f"sqlite:///{self.id}.db")
|
||||
|
||||
def set_command_spec(self, spec: 'CommandSpec') -> None:
|
||||
self.client.set_command_spec(self.id, spec)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user