This repository has been archived on 2021-03-28. You can view files and clone it, but cannot push or open issues/pull-requests.
frank/frank/module.py

33 lines
649 B
Python

from typing import List, Dict
class Module:
PREFIX = []
NAME = ""
def __init__(self, client: "Frank", config: Dict = None):
self._client = client
self._config = config
async def start(self):
pass
async def command(self, cmd: List[str]):
pass
@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