teli — Telegram bot toolkit
teli is a Python library and CLI for managing Telegram bots and personal Telegram accounts: named connections, async long-polling, message handlers, and a wavi-compatible driver interface.
Install
pip install teli-lib
# with user-account support (Telethon):
pip install "teli-lib[user]"
Quick start — Bot connections
# Register a bot
teli add mybot --token 123456:ABC...
# Discover your chat_id (send /start to the bot, look at output)
teli listen mybot
# Lock down allowed chats
teli update mybot --allow 987654321
# Send a message via the bot
teli send mybot 987654321 "Hello from teli!"
# Check what's registered
teli status
Quick start — Personal user account
Send messages from your own Telegram account (no bot token needed):
# 1. Get API credentials at https://my.telegram.org → API development tools
# 2. Register your account
teli user add me --api-id 12345678 --api-hash abc123...
# 3. Authenticate once (asks for phone + code)
teli user connect
# 4. Send messages directly
teli user send Luganense "Hola!"
teli user send @username "Hola!"
teli user send 987654321 "Hola!"
All commands
teli status Show all connections + user accounts
teli add <name> --token TOKEN Register a bot
teli list List bot connections
teli remove <name> Remove a bot
teli send <name> <chat_id> <message> Send via bot
teli listen <name> [--webhook URL] Long-poll incoming messages
teli whoami <name> Get bot identity
teli user add <name> --api-id ID --api-hash H Register personal account
teli user accounts List personal accounts
teli user connect [name] Authenticate (once)
teli user send <recipient> <message> Send from your account
teli user listen --bot <bot_username> Listen for bot messages
teli install-skill Install Claude Code skill
Claude Code skill
Install a skill that teaches Claude how to use teli:
teli install-skill
This copies SKILL.md to ~/.claude/skills/teli/. After restarting Claude Code, you can invoke it as /teli.
Python API
from teli.bot import Bot
async with Bot.from_connection("mybot") as bot:
await bot.send_message(987654321, "Hello!")
Long-polling daemon with handlers:
bot = Bot.from_connection("mybot")
@bot.on_command("start")
async def handle_start(msg):
await bot.send_message(msg["chat"]["id"], "Hi!")
await bot.start()
await bot.stop()
Driver interface (wavi-compatible)
import teli.driver as td
await td.connect("mybot")
await td.send("mybot", "987654321", "Hola!")
print(await td.status("mybot"))
await td.stop("mybot")
Development
pip install -e ".[dev]"
pytest tests/ -v
Metadata
Release files for teli-lib 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| teli_lib-0.2.0.tar.gz | 23.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| teli_lib-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.6 kB
Release files / teli_lib-0.2.0.tar.gz
| Download URL | teli_lib-0.2.0.tar.gz |
|---|---|
| Size | 23.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc3e867fe8b764be930de25dadc8e51340471b06f4acb9cc6039cdf479be73eb
|
|
BLAKE2b-256 checksum How to use checksums |
e0f527a7eaf7172515111e0c09114b3d7fd4624226197c4753f1695db919cdd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / teli_lib-0.2.0-py3-none-any.whl
| Download URL | teli_lib-0.2.0-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0a2fb20f45d7db107fed8d4f22c0c94705c6c06e36798b9a70574fcf7784fb6
|
|
BLAKE2b-256 checksum How to use checksums |
2f12eed9aedac328a028fcb2e879e08fa4b1ccb4495f38ab34ca6aeca1caad23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|