Skip to main content
FTMGram Logo

FTMGram v3.5.1

Next-Gen Telegram MTProto & Bot API 10.3 Framework for Python

Docs PyPI Telegram License


FTMGram is a rock-solid, high-performance, asynchronous Telegram MTProto client library and Bot API framework for Python. It supercharges both user accounts and bots with modern features like Turbo Multi-Worker Transfers (Upload & Download), In-Message Buttons, AI Response Token Streaming, Bot Chat History Scanning, and Telegram Stars 2.0.


⚡ Key Highlights in v3.5.1

  • 🛡️ 100% Rock-Solid Stability: Zero file descriptor leaks on Linux / uvloop containers ([Errno 24] Too many open files completely eliminated).
  • ⚡ Turbo Multi-Worker Upload Engine (fast_upload): Upload videos, documents, and large files up to 2GB/4GB at maximum speed using concurrent multi-worker chunk streaming.
  • ⚡ Turbo Multi-Worker Download Engine (fast_download): Download media files concurrently with parallel chunk workers for gigabit saturation.
  • 🤖 Bot Chat History (get_bot_chat_history): Allows bots to retrieve message history across private chats and groups using safe, high-speed 100-ID batch scanning.
  • 🎨 Fluent RichMessageBuilder DSL: Construct structured rich messages with in-message buttons (<tg-button-row>), expandable quotes, tables, and paragraphs effortlessly in Python.
  • 🧠 Real-Time AI Streaming (stream_text & thinking): Seamlessly stream LLM tokens (OpenAI, Anthropic, Gemini, Groq, Ollama) directly to chat drafts with animated thinking placeholders and stop buttons.
  • 🧹 Batch Chat Purge (purge_messages): Safely delete hundreds of messages in seconds with automatic RPC chunking and rate-limit handling.
  • 💾 Memory Media Streaming (download_media_to_memory): Download media straight into an in-memory io.BytesIO buffer without disk I/O bottlenecks.
  • 👥 Multi-Client Orchestrator (MultiClient): Manage and run dozens of bots and user accounts concurrently in a single event loop.

📦 Installation

pip install -U ftmgram

Or install with fast cryptographic acceleration:

pip install -U "ftmgram[fast]"

🚀 Quick Examples

1. Fast Upload & Fast Download (Turbo Transfers)

from ftmgram import Client

app = Client("my_bot", bot_token="TOKEN")

async def upload_and_download():
    async with app:
        # Fast Upload with 8 parallel workers
        uploaded_file = await app.fast_upload("large_video.mp4", workers=8)
        msg = await app.send_video(123456789, video=uploaded_file, caption="Sent via Turbo Upload! 🚀")

        # Fast Download with 8 parallel workers
        await app.fast_download(msg, file_name="downloads/", workers=8)

app.run(upload_and_download())

2. In-Message Buttons (Bot API 10.3)

from ftmgram import Client
from ftmgram.helpers import RichMessageBuilder, Button

app = Client("my_bot", bot_token="TOKEN")

async def send_menu(chat_id: int):
    async with app:
        rich = (
            RichMessageBuilder()
            .title("💎 VIP Subscription")
            .paragraph("Select your desired membership tier:")
            .button_row(
                Button("Starter ($5)", data="plan_starter", style="primary"),
                Button("Pro ($15)", data="plan_pro", style="success"),
                Button("VIP ($25)", data="plan_vip", style="danger")
            )
            .build()
        )
        await app.send_rich_message(chat_id, rich)

app.run(send_menu(123456789))

3. Bot Chat History Retrieval

from ftmgram import Client

app = Client("my_bot", bot_token="TOKEN")

async def scan_history(chat_id: int):
    async with app:
        async for msg in app.get_bot_chat_history(chat_id, start_message_id=1, limit=50):
            print(f"[{msg.id}] {msg.text}")

app.run(scan_history(123456789))

📚 Documentation

Visit the official documentation portal: https://ftmgram.ftmbotzx.dev/


📜 License

FTMGram is licensed under the GNU Lesser General Public License v3.0 (LGPL-3.0). Copyright (C) 2024-present FTM DEVELOPERZ.

Release files for ftmgram 3.5.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ftmgram 3.5.7
File Size Uploaded
ftmgram-3.5.7.tar.gz 14.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ftmgram 3.5.7
File Interpreter ABI Platform
ftmgram-3.5.7-py3-none-any.whl Python 3 none any Details

Total release size: 20.4 MB

Release files / ftmgram-3.5.7.tar.gz

Download URL ftmgram-3.5.7.tar.gz
Size 14.4 MB
Tags Source
SHA-256 checksum
How to use checksums
e924b6dc0b8ba643a13bdf5bf2bbd691da42613a96014e32f10c70b8b5ee10f7
BLAKE2b-256 checksum
How to use checksums
2c349fd818e5acc774c8f2ec55f0e05dfcd9f8102c120575593973ff0eec7194
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ftmgram-3.5.7-py3-none-any.whl

Download URL ftmgram-3.5.7-py3-none-any.whl
Size 6.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c2d57f1780130775aa47801d9ebe017e90f6049733558389b6add25ccb381ffb
BLAKE2b-256 checksum
How to use checksums
ddceadad29a35a1cbbc22eb043343148011fb04ce9a1bf805b3ba5f879b5a29f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

3.5.8

2 release files

This release

3.5.7 This release

2 release files

3.5.6

2 release files

3.5.4

2 release files

3.5.3

2 release files

3.5.2

2 release files

3.5.1

2 release files

3.5.0

2 release files

3.3.0

2 release files

3.1.0

2 release files

3.0.25

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.2.17

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page