Bot compatibility: - Clients send plaintext bot_message to bot aliases (no E2E encryption) - Numeric chat_id: fp_to_numeric_id() deterministic hash, accept string/number - Webhook delivery: POST updates to bot's webhook URL (async, fire-and-forget) - getUpdates timeout raised to 50s (was 30, TG uses 50) - parse_mode HTML rendered in web client - E2E bot registration: optional seed + bundle for encrypted bot sessions BotFather + instance control: - --enable-bots CLI flag (default: disabled) - BotFather auto-created on first start (@botfather alias) - Bot ownership: owner fingerprint stored in bot_info - All bot endpoints return 403 when disabled Bot Bridge: - tools/bot-bridge.py: TG-compatible proxy for unmodified TG bots - Translates chat_id int↔string, proxies getUpdates/sendMessage - README with python-telegram-bot and Telegraf examples Test fixes: - Updated tests for ETH address display in header/messages Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1.2 KiB
1.2 KiB
featherChat Bot Tools
bot-bridge.py
Proxy server that makes featherChat compatible with Telegram bot libraries.
Quick Start
# 1. Register a bot on featherChat
curl -X POST http://server:7700/v1/bot/register \
-H 'Content-Type: application/json' \
-d '{"name":"MyBot","fingerprint":"aabbccddaabbccddaabbccddaabbccdd"}'
# 2. Start the bridge
python3 tools/bot-bridge.py --server http://server:7700 --token YOUR_TOKEN --port 8081
# 3. Point your TG bot at the bridge
# Python (python-telegram-bot):
# bot = Bot(token="TOKEN", base_url="http://localhost:8081/botTOKEN")
# Node (Telegraf):
# const bot = new Telegraf("TOKEN", { telegram: { apiRoot: "http://localhost:8081" } })
What it does
- Translates Telegram API calls to featherChat Bot API
- Converts numeric chat_id <-> fingerprint hex strings
- Proxies getUpdates long-polling
- Passes through sendMessage, editMessageText, etc.
Future: E2E Mode
When E2E bot support is complete, the bridge will:
- Hold the bot's seed/keypair
- Decrypt incoming E2E messages before forwarding to the TG bot
- Encrypt outgoing messages with the user's ratchet session
- The TG bot sees plaintext; the server sees only ciphertext