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/openjarvis/channels/telegram.py
Functions¶
connect
¶
Start listening for incoming messages via long polling.
Source code in src/openjarvis/channels/telegram.py
disconnect
¶
Stop the listener thread.
The listener owns every async startup/shutdown phase. disconnect
only publishes a stop request onto that owned loop, which is observed
between initialize, polling startup, and application startup as well
as during steady-state polling. Status is only reported DISCONNECTED
once the thread has actually terminated.
Source code in src/openjarvis/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/openjarvis/channels/telegram.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
status
¶
status() -> ChannelStatus