MessageAdapter (base.py)

ClawSwarm · integration

Base adapter interface for messaging platforms. Each platform (Telegram, Discord, WhatsApp) implements this and returns UnifiedMessage list.

# Source: https://github.com/The-Swarm-Corporation/ClawSwarm | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""
Base adapter interface for messaging platforms.
Each platform (Telegram, Discord, WhatsApp) implements this and returns UnifiedMessage list.
"""

from __future__ import annotations

import asyncio
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from claw_swarm.gateway.schema import UnifiedMessage


class MessageAdapter(ABC):
    """Abstract adapter: fetch new messages and normalize to UnifiedMessage."""

    @property
    @abstractmethod
    def platform_name(self) -> str:
        """e.g. 'telegram', 'discord', 'whatsapp'."""
 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key