meshtastic-matrix-relay/plugins/base_plugin.py

25 wiersze
786 B
Python
Czysty Zwykły widok Historia

2023-04-25 21:29:17 +00:00
from abc import ABC, abstractmethod
2023-04-27 23:58:29 +00:00
from log_utils import get_logger
from config import relay_config
2023-04-25 21:29:17 +00:00
class BasePlugin(ABC):
2023-04-27 23:58:29 +00:00
plugin_name = None
def __init__(self) -> None:
super().__init__()
self.logger = get_logger(f"Plugin:{self.plugin_name}")
self.config = {"active": False}
if "plugins" in relay_config and self.plugin_name in relay_config["plugins"]:
self.config = relay_config["plugins"][self.plugin_name]
2023-04-25 21:29:17 +00:00
@abstractmethod
async def handle_meshtastic_message(
packet, formatted_message, longname, meshnet_name
):
print("Base plugin: handling Meshtastic message")
@abstractmethod
async def handle_room_message(room, event, full_message):
print("Base plugin: handling room message")