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

43 lines
940 B
Python
Raw Normal View History

2021-11-12 14:25:53 +00:00
from typing import List
2022-01-27 13:16:53 +00:00
from .component_meta import *
2021-10-24 10:55:45 +00:00
class CommandMatches:
def __init__(self):
self.set: List[CommandMeta] = []
def add(self, meta):
self.set.append(meta)
return self.set
2021-11-19 16:33:53 +00:00
def get(self, targetFrom: str) -> List[CommandMeta]:
metas = []
for meta in self.set:
2022-01-26 13:45:17 +00:00
if targetFrom in meta.exclude_from:
continue
2021-11-19 16:33:53 +00:00
if targetFrom in meta.available_for or '*' in meta.available_for:
metas.append(meta)
return metas
2021-10-24 10:55:45 +00:00
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"]