Telegram bot toolkit: named connections, long-polling, send/receive, and a wavi-compatible driver
Project description
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
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 teli_lib-0.2.0.tar.gz.
File metadata
- Download URL: teli_lib-0.2.0.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc3e867fe8b764be930de25dadc8e51340471b06f4acb9cc6039cdf479be73eb
|
|
| MD5 |
7ab9db99946167b0eaeaafc56ba64762
|
|
| BLAKE2b-256 |
e0f527a7eaf7172515111e0c09114b3d7fd4624226197c4753f1695db919cdd3
|
File details
Details for the file teli_lib-0.2.0-py3-none-any.whl.
File metadata
- Download URL: teli_lib-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0a2fb20f45d7db107fed8d4f22c0c94705c6c06e36798b9a70574fcf7784fb6
|
|
| MD5 |
b04502b64e28b871e063b736711fb658
|
|
| BLAKE2b-256 |
2f12eed9aedac328a028fcb2e879e08fa4b1ccb4495f38ab34ca6aeca1caad23
|