19 lines
669 B
Python
19 lines
669 B
Python
from app_class import AppClass
|
|
from config import Config, TriggerTuple, MissingConfig
|
|
|
|
class Trigger(AppClass):
|
|
def __init__(self, _config: Config) -> None:
|
|
super().__init__(_config)
|
|
self.name = "name has to be filled in inherited class and this name has to match the name from config file"
|
|
|
|
@property
|
|
def config(self) -> TriggerTuple:
|
|
_config = self._config.get_trigger_by_name(self.name)
|
|
if _config is None:
|
|
raise MissingConfig(f"Trigger {self.name} hasn't been properly configured")
|
|
return _config
|
|
|
|
def run(self) -> bool:
|
|
# return True if Trigger is valid
|
|
return False
|