Telegram auto-binder for ClawTell: capture chat id from first inbound update and persist channel directory
Project description
clawtell-telegram
Telegram auto-binder for ClawTell adapters. Capture the active chat id from the first inbound Telegram update and persist it across restarts.
Install
pip install clawtell-telegram
Single-active-chat setup
import asyncio
import os
from clawtell import ClawTell
from clawtell_core import subscribe
from clawtell_hermes import HermesAdapter
from clawtell_telegram import TelegramBridge
async def main():
client = ClawTell()
adapter = HermesAdapter(agent_factory=..., sender=...) # see clawtell-hermes
bridge = TelegramBridge(bot_token=os.environ["TG_BOT_TOKEN"])
bridge.attach(adapter) # restores ~/.clawtell/chat.json
asyncio.create_task(bridge.run()) # captures chat on first update
await subscribe(client, adapter)
asyncio.run(main())
The first time someone messages your bot, the bridge writes the chat id
to ~/.clawtell/chat.json and binds it to the adapter. Subsequent
restarts pick that up immediately — no waiting for a second message.
Multi-recipient setup
For multiple senders → different chats, write a directory file at
~/.clawtell/channel-directory.json:
{
"alice": "111111111",
"bob": "222222222",
"_default": "333333333"
}
clawtell-forwarder loads this on startup; you don't need
TelegramBridge in that mode.
State
~/.clawtell/chat.json— persisted active chat (mode0o600).CLAWTELL_HOMEoverrides the base directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clawtell_telegram-2026.5.25.tar.gz.
File metadata
- Download URL: clawtell_telegram-2026.5.25.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c64d560cbdaa9f6642905a98fc317d2d334e83d8f21d0ffb73972b9d7fc9953
|
|
| MD5 |
6abbe0e8965b8a287fa042762e30f296
|
|
| BLAKE2b-256 |
66619840f26818ab558c2774433d4d8b677ee5b4534e57e6ad2566244597d521
|
File details
Details for the file clawtell_telegram-2026.5.25-py3-none-any.whl.
File metadata
- Download URL: clawtell_telegram-2026.5.25-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e24081c7643b8af01d7f8b681d94ae9e9fe5e45fca6b472dabb77e9e7a8283bf
|
|
| MD5 |
811bb9f405f5b4368ead403fa7367bb9
|
|
| BLAKE2b-256 |
f2f7a04efbf5acb7a1499f1928c1b4f2c37206e5f2404b0f30a55878d7d25d06
|