Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/core/elements/module/component_matches.py
2022-01-27 21:16:53 +08:00

42 lines
940 B
Python

from typing import List
from .component_meta import *
class CommandMatches:
def __init__(self):
self.set: List[CommandMeta] = []
def add(self, meta):
self.set.append(meta)
return self.set
def get(self, targetFrom: str) -> List[CommandMeta]:
metas = []
for meta in self.set:
if targetFrom in meta.exclude_from:
continue
if targetFrom in meta.available_for or '*' in meta.available_for:
metas.append(meta)
return metas
class RegexMatches:
def __init__(self):
self.set: List[RegexMeta] = []
def add(self, meta):
self.set.append(meta)
return self.set
class ScheduleMatches:
def __init__(self):
self.set: List[ScheduleMeta] = []
def add(self, meta):
self.set.append(meta)
return self.set
__all__ = ["CommandMatches", "RegexMatches", "ScheduleMatches"]