This repository has been archived on 2021-03-28. You can view files and clone it, but cannot push or open issues/pull-requests.
2020-08-08 09:29:32 +02:00
|
|
|
from typing import List, Dict
|
2020-08-08 09:19:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Module:
|
2020-08-09 18:36:13 +02:00
|
|
|
PREFIX = []
|
|
|
|
NAME = ""
|
2020-08-08 09:19:09 +02:00
|
|
|
|
2020-08-08 13:12:09 +02:00
|
|
|
def __init__(self, client: "Frank", config: Dict = None):
|
2020-08-08 09:19:09 +02:00
|
|
|
self._client = client
|
2020-08-08 13:12:09 +02:00
|
|
|
self._config = config
|
2020-08-08 09:19:09 +02:00
|
|
|
|
|
|
|
async def start(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
async def command(self, cmd: List[str]):
|
|
|
|
pass
|
2020-08-09 18:36:13 +02:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def match(cls, s: str) -> bool:
|
|
|
|
"""
|
|
|
|
Checks wether the given string is a prefix in the module.
|
|
|
|
"""
|
|
|
|
|
|
|
|
if cls.PREFIX:
|
|
|
|
if isinstance(cls.PREFIX, list):
|
|
|
|
return s in cls.PREFIX
|
|
|
|
|
|
|
|
else:
|
|
|
|
return s == cls.PREFIX
|
|
|
|
|
|
|
|
else:
|
|
|
|
return False
|