telegram
telegram
¶
TelegramChannel — native Telegram Bot API adapter.
Classes¶
TelegramChannel
¶
TelegramChannel(
bot_token: str = "",
*,
allowed_chat_ids: str = "",
parse_mode: str = "Markdown",
bus: Optional[EventBus] = None,
)
Bases: BaseChannel
Native Telegram channel adapter using the Bot API.
| PARAMETER | DESCRIPTION |
|---|---|
bot_token
|
Telegram Bot API token. Falls back to
TYPE:
|
allowed_chat_ids
|
Comma-separated list of chat IDs allowed to interact.
TYPE:
|
parse_mode
|
Message parse mode (
TYPE:
|
bus
|
Optional event bus for publishing channel events.
TYPE:
|
Source code in src/diapason/channels/telegram.py
Methods:¶
connect
¶
Start listening for incoming messages via long polling.
Source code in src/diapason/channels/telegram.py
disconnect
¶
Stop the listener thread.
Source code in src/diapason/channels/telegram.py
send
¶
send(
channel: str,
content: str,
*,
conversation_id: str = "",
metadata: Dict[str, Any] | None = None,
) -> bool
Send a message to a Telegram chat via the Bot API.
Source code in src/diapason/channels/telegram.py
status
¶
status() -> ChannelStatus