Initial MCM project: FastAPI + Textual TUI unified messenger
MultiCustomerMessenger supporting Telegram (python-telegram-bot), WhatsApp (Green API) and SMS (python-gsmmodem-new). REST API with Bearer-token auth, SQLAlchemy models for MariaDB, APScheduler for background polling, and Textual TUI running in same asyncio event-loop. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
37
channels/base.py
Normal file
37
channels/base.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any
|
||||
|
||||
|
||||
class BaseChannel(ABC):
|
||||
"""Abstrakte Basisklasse für alle Messaging-Kanäle."""
|
||||
|
||||
@abstractmethod
|
||||
async def send_message(
|
||||
self,
|
||||
recipient: str,
|
||||
text: str,
|
||||
reply_to_id: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Nachricht senden.
|
||||
|
||||
Returns:
|
||||
{"success": bool, "channel_message_id": str | None, "error": str | None}
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def check_connection(self) -> tuple[bool, str]:
|
||||
"""Verbindung prüfen.
|
||||
|
||||
Returns:
|
||||
(connected: bool, detail: str)
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def start(self) -> None:
|
||||
"""Kanal starten (Webhook registrieren, Polling starten, …)."""
|
||||
|
||||
@abstractmethod
|
||||
async def stop(self) -> None:
|
||||
"""Kanal sauber beenden."""
|
||||
Reference in New Issue
Block a user