Metadata-Version: 2.4
Name: dlgram
Version: 3.0.0
Summary: DLGram: a lightweight, stable Telegram MTProto API framework for bots and user clients
Project-URL: Homepage, https://github.com/growxupdate/dlgram
Project-URL: Tracker, https://github.com/growxupdate/dlgram/issues
Project-URL: Community, https://t.me/dlgramUpdates
Project-URL: Source, https://github.com/growxupdate/dlgram
Project-URL: Documentation, https://growxupdate.github.io/dlgram
Author: DLGram Team
License-Expression: LGPL-3.0-or-later
License-File: COPYING
License-File: COPYING.lesser
License-File: NOTICE
Keywords: async,dlgram,library,mtproto,pyrofork,pyrogram,python,telegram,telegram-api,telegram-bot,telegram-client
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Communications
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: ~=3.9
Requires-Dist: pyaes==1.6.1
Requires-Dist: pymediainfo-pyrofork<7.0.0,>=6.0.1
Requires-Dist: pysocks==1.7.1
Provides-Extra: dev
Requires-Dist: hatch>=1.7.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.1; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=7.4.3; extra == 'dev'
Requires-Dist: twine>=4.0.2; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx; extra == 'docs'
Requires-Dist: sphinx-autobuild; extra == 'docs'
Requires-Dist: sphinx-copybutton; extra == 'docs'
Requires-Dist: sphinx-immaterial==0.12.4; extra == 'docs'
Requires-Dist: tornado>=6.3.3; extra == 'docs'
Provides-Extra: speedup
Requires-Dist: tgcrypto-pyrofork>=1.2.6; extra == 'speedup'
Requires-Dist: uvloop>=0.19.0; extra == 'speedup'
Description-Content-Type: text/markdown

# DLGram

<p align="center">
  <a href="https://github.com/growxupdate/dlgram"><img src="https://img.shields.io/badge/DLGram-3.21.0-2563eb?style=for-the-badge" alt="DLGram version"></a>
  <a href="https://growxupdate.github.io/dlgram"><img src="https://img.shields.io/badge/Docs-GitHub%20Pages-16a34a?style=for-the-badge" alt="Docs"></a>
  <a href="https://t.me/dlgramUpdates"><img src="https://img.shields.io/badge/Updates-t.me%2FdlgramUpdates-0ea5e9?style=for-the-badge" alt="Telegram updates"></a>
</p>

<p align="center">
  <b>A lightweight Telegram MTProto framework for Python bots and user clients.</b><br>
  Built from the Pyrogram/Pyrofork ecosystem, tuned for lower memory usage, safer downloads, and high-traffic bots.
</p>

<p align="center">
  <a href="https://growxupdate.github.io/dlgram"><b>Read the docs</b></a>
  ·
  <a href="https://github.com/growxupdate/dlgram/issues">Report issue</a>
  ·
  <a href="https://t.me/dlgramUpdates">Telegram updates</a>
</p>

---

## Why DLGram?

DLGram keeps the familiar `pyrogram` import style while adding practical fixes for real bots:

- **Low RAM mode** with smart message cache and bounded update queue.
- **High traffic stability** with reconnect-safe TCP transport handling.
- **Safer downloads** with cleaner media/CDN session behavior.
- **Direct downloads** using `no_temp=True` when you do not want `.temp` files.
- **Simple button API** with `color="green"`, `colour="red"`, or old `style="blue"`.
- **Premium/custom emoji** support in message text and inline buttons.
- **GitHub Actions build** and **GitHub Pages documentation**.

## Install

Install latest from GitHub:

```bash
pip install --no-cache-dir --force-reinstall "git+https://github.com/growxupdate/dlgram.git"
```

Optional speedup:

```bash
pip install -U tgcrypto
```

Termux setup:

```bash
pkg update -y && pkg upgrade -y
pkg install -y python git clang make openssl libffi rust
python -m pip install -U pip setuptools wheel
pip install --no-cache-dir --force-reinstall "git+https://github.com/growxupdate/dlgram.git"
```

## Quick bot

```python
from pyrogram import Client, filters, types

API_ID = 12345
API_HASH = "your_api_hash"
BOT_TOKEN = "your_bot_token"

app = Client(
    "bot",
    api_id=API_ID,
    api_hash=API_HASH,
    bot_token=BOT_TOKEN,
    msg_cache=300,
    biz_cache=100,
    update_queue=1000,
    smart_updates=True,
)

@app.on_message(filters.command("start"))
async def start(_, message):
    keyboard = types.InlineKeyboardMarkup([
        [types.InlineKeyboardButton(
            "Play",
            callback_data="play",
            color="green",
            icon_emoji_id="6267032805910254913",
        )],
        [types.InlineKeyboardButton("Stop", callback_data="stop", color="red")],
    ])

    await message.reply(
        '<emoji id="6266764202950530136">💬</emoji> <b>DLGram is working.</b>',
        reply_markup=keyboard,
    )

@app.on_callback_query()
async def callback(_, query):
    await query.answer(f"Clicked: {query.data}", show_alert=True)

app.run()
```

## Button colors and premium emoji

```python
from pyrogram import types

types.InlineKeyboardButton("OK", callback_data="ok", color="green")
types.InlineKeyboardButton("Cancel", callback_data="cancel", colour="red")
types.InlineKeyboardButton("Info", callback_data="info", style="blue")

types.InlineKeyboardButton(
    "Heart",
    callback_data="heart",
    color="green",
    icon_emoji_id="6267032805910254913",
)
```

Supported colors: `default`, `blue`, `red`, `green`.
Unsupported colors, for example `orange`, fall back to default and show a warning.

Message custom emoji:

```python
await message.reply('<emoji id="6266764202950530136">💬</emoji> Premium emoji test')
```

## Downloads

```python
path = await message.download()
path = await message.download(file_name="xyz.m4a", no_temp=True)
path = await app.download_message(message, file_name="xyz.m4a", no_temp=True)
```

Streaming chunks:

```python
async for chunk in app.stream_media(message):
    # write/send chunk
    pass
```

Avoid `in_memory=True` for large files on small VPS/Termux because it can load the whole file into RAM.

## Recommended configs

Big public bot:

```python
app = Client(
    "bot",
    api_id=API_ID,
    api_hash=API_HASH,
    bot_token=BOT_TOKEN,
    msg_cache=300,
    biz_cache=100,
    update_queue=1000,
    smart_updates=True,
)
```

Download-only session:

```python
dl = Client(
    "download",
    api_id=API_ID,
    api_hash=API_HASH,
    session_string=SESSION_STRING,
    no_updates=True,
    msg_cache=0,
    biz_cache=0,
    update_queue=0,
)
```

## Documentation

Main docs are published at:

**https://growxupdate.github.io/dlgram**

The docs page includes search, install commands, examples, download notes, security notes, and attribution.

## Security notes

DLGram should not contain owner backdoors, token dumpers, external paste uploads, or hidden environment exfiltration logic. If you find suspicious code, report it in Issues or in the Telegram update channel.

The repository should never commit real `API_HASH`, `BOT_TOKEN`, `.session`, `.session-journal`, string sessions, MongoDB URI, or private config files.

## Attribution

DLGram is based on the Pyrogram/Pyrofork ecosystem and continues to use upstream concepts and LGPL-licensed code, including MTProto/session architecture, generated Telegram raw API types/functions, parsers, storage helpers, handlers, filters, and crypto utilities.

See `NOTICE`, `COPYING`, and `COPYING.lesser` for licensing and attribution details.
