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.
38 lines
901 B
Python
38 lines
901 B
Python
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."""
|