FAQ¶
What is pyrogram?¶
pyrogram is a fork of Pyrogram with support for the latest Telegram features including Gifts, Stories, Topics, Business Accounts, and more.
How is it different from Pyrogram?¶
pyrogram stays up to date with Telegram’s latest API changes faster than the upstream Pyrogram project. It adds support for newer Telegram features and fixes compatibility issues with recent Telegram server updates.
What Python versions are supported?¶
Python 3.10 through 3.14.
How do I install tobigram?¶
pip install tobigram
Or install directly from the repository:
pip install git+https://github.com/TobiBotz/Tobigram.git
Can I use tobigram with uv?¶
Yes. tobigram is built with Hatch and fully compatible with uv:
uv add tobigram
Do I need an API ID and hash?¶
Yes, for both. Get them at https://my.telegram.org/apps. A bot additionally needs its
token from @BotFather, but the API key is still required for
the first authorization — pyrogram raises AttributeError without it. Once a session
exists, neither is needed again.
How do I start a Client?¶
from pyrogram import Client
async with Client("my_account") as app:
await app.send_message("me", "Hello!")
The context manager starts and stops the client for you. Doing it by hand is
await app.start() and await app.stop().
Can I use pyrogram synchronously?¶
No. pyrogram is async-only — there is no wrapper that lets you call methods without
await. Use asyncio.run() or run():
import asyncio
from pyrogram import Client
async def main():
async with Client("my_account") as app:
await app.send_message("me", "Hello!")
asyncio.run(main())
See Synchronous Usage for calling pyrogram from code that is not async.
How do I handle progress for uploads and downloads?¶
Pass a progress callback to any send or download method:
async def progress(current, total):
print(f"{current * 100 / total:.1f}%")
await app.send_document("me", "file.zip", progress=progress)
What are bound methods?¶
Bound methods are convenience methods attached to type instances. For example,
a Message object has .reply(), .delete(), and .download():
msg = await app.send_message("me", "Hello!")
await msg.reply("World!") # bound method on the Message object
await msg.delete() # same
Does pyrogram support parallel downloads?¶
Yes. pyrogram uses an aria2c-style parallel download engine that fetches file
chunks concurrently from multiple sessions. Pass a progress callback to
download_media() to track speed and progress.
Does pyrogram support Stories?¶
Yes. Use methods like send_story(),
get_stories(), and delete_stories()
to manage stories.
Does pyrogram support Gifts and Stars?¶
Yes. pyrogram fully supports Telegram Stars, Gifts, Gift Upgrades, and
Auction Bids through the payments method group.
Does pyrogram support Business Accounts?¶
Yes. pyrogram provides business-specific methods for managing chat links, away messages, greeting messages, working hours, and locations.
Does pyrogram support Rich Text (styled messages)?¶
Yes, and there are two different things under that name. Message-level formatting —
bold, spoilers, custom emoji, formatted dates — is covered in Text Formatting.
Full documents with headings, lists and tables are rich messages, sent with rich_text on
send_message() or with
send_rich_message().
How do I enable debug logging?¶
import logging
logging.basicConfig(level=logging.INFO)
For more verbose output:
logging.getLogger("pyrogram").setLevel(logging.DEBUG)
Can I wait for a user’s reply without a handler?¶
answer = await message.chat.ask("What is your name?", timeout=60)
await answer.reply(f"Hello, {answer.text}!")
See Listeners.
How do I avoid FloodWait?¶
By default pyrogram sends at full speed and lets sleep_threshold decide how long a
FloodWait it sits out for you rather than raising. If you would rather not reach one at
all, pass rate_limits to enable the built-in token-bucket limiter, which paces requests
below Telegram’s limits. See Rate Limiting.
Why does my bot use so much memory with many clients?¶
It should not: transfer budgets are process-wide, not per client, so fifteen clients do not
reserve fifteen times the buffers. If memory is still high, lower
PYROGRAM_MAX_READ_AHEAD. See Performance and Resource Budgets.
Can I keep sessions in a database instead of a file?¶
Yes. MongoStorage and RedisStorage keep
the session in a database, and HybridStorage puts a local cache in
front of either so reads never pay network latency:
from pyrogram import Client
from pyrogram.storage import HybridStorage, MongoStorage
app = Client(
"my_account",
storage_engine=HybridStorage(
"my_account",
backend=MongoStorage("my_account", "mongodb://localhost:27017"),
),
)
Install the driver with pip install "tobigram[mongo]" or pip install "tobigram[redis]".
See Storage Engines.
Where can I get help?¶
Open an issue on the GitHub repository.