From 520153dfb113e4af411866d3056a01d2a34b64bb Mon Sep 17 00:00:00 2001 From: bohd4nx Date: Mon, 16 Mar 2026 01:14:12 +0200 Subject: [PATCH] feat: update terminology from "gift" to "purchase" for Telegram Premium and Stars; enhance README and example scripts --- README.md | 18 ++++++++++-------- examples/gift_premium.py | 4 ++-- examples/gift_stars.py | 4 ++-- pyfragment/client.py | 10 +++++++--- pyproject.toml | 2 +- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 3e0ed5f..6640ce6 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@
Fragment Logo -

💎 Fragment API

+

Fragment API

- Python library for the Fragment.com API — gift Telegram Stars, Premium, and top up TON Ads balance. + Python library for the Fragment.com API — purchase Telegram Stars, Premium, and top up TON Ads balance.

[![PyPI version](https://img.shields.io/pypi/v/pyfragment?style=flat&color=blue)](https://pypi.org/project/pyfragment/) @@ -18,13 +18,15 @@
+> **Disclaimer:** This project is not affiliated with, endorsed by, or in any way officially connected with [Fragment](https://fragment.com) or [Telegram](https://telegram.org). + --- ## ✨ Features - 💰 **TON Advertisement Topups** — Top up Telegram Ads balance (1–1,000,000,000 TON) -- 👑 **Telegram Premium Gifts** — Gift Premium to any user (3, 6, or 12 months) -- ⭐ **Telegram Stars Purchases** — Gift Stars to any Telegram user (50–1,000,000 Stars) +- 👑 **Telegram Premium** — Purchase Premium for any user (3, 6, or 12 months) +- ⭐ **Telegram Stars Purchases** — Purchase Stars for any Telegram user (50–1,000,000 Stars) - 🔐 **Multi-wallet support** — V4R2 and V5R1 wallet contract versions - ⚡ **Async-first** — Built on `httpx` and `asyncio` @@ -58,11 +60,11 @@ client = FragmentClient( ) async def main(): - # Gift 6 months of Telegram Premium + # Purchase 6 months of Telegram Premium result = await client.gift_premium("@username", months=6) print(result.transaction_id) - # Gift 500 Stars + # Purchase 500 Stars result = await client.gift_stars("@username", amount=500) print(result.transaction_id) @@ -94,8 +96,8 @@ See the [`examples/`](examples/) folder for ready-to-run scripts. | Method | Returns | Description | Limits | | -------------------------------------------------- | ---------------- | ---------------------------------- | ------------------------- | -| `gift_premium(username, months, show_sender=True)` | `PremiumResult` | Gift Telegram Premium subscription | `months`: 3, 6, or 12 | -| `gift_stars(username, amount, show_sender=True)` | `StarsResult` | Gift Telegram Stars | `amount`: 50–1,000,000 | +| `gift_premium(username, months, show_sender=True)` | `PremiumResult` | Purchase Telegram Premium | `months`: 3, 6, or 12 | +| `gift_stars(username, amount, show_sender=True)` | `StarsResult` | Purchase Telegram Stars | `amount`: 50–1,000,000 | | `topup_ton(username, amount, show_sender=True)` | `AdsTopupResult` | Top up Telegram Ads balance | `amount`: 1–1,000,000,000 | | `get_wallet()` | `WalletInfo` | Get wallet address, state, balance | — | diff --git a/examples/gift_premium.py b/examples/gift_premium.py index d36ffab..16b8395 100644 --- a/examples/gift_premium.py +++ b/examples/gift_premium.py @@ -1,5 +1,5 @@ """ -Example: gift Telegram Premium to a user. +Example: purchase Telegram Premium for a user. Supported durations: 3, 6, or 12 months. Set show_sender=False to send anonymously. @@ -34,7 +34,7 @@ async def main() -> None: print(f"Invalid parameters: {e}") return - print("Premium gifted") + print("Premium purchased") print(" %-14s %s" % ("Username:", result.username)) print(" %-14s %s months" % ("Duration:", result.months)) print(" %-14s %s" % ("Transaction:", result.transaction_id)) diff --git a/examples/gift_stars.py b/examples/gift_stars.py index 0849edd..e9500b9 100644 --- a/examples/gift_stars.py +++ b/examples/gift_stars.py @@ -1,5 +1,5 @@ """ -Example: gift Telegram Stars to a user. +Example: purchase Telegram Stars for a user. Amount must be an integer between 50 and 1 000 000. Set show_sender=False to send anonymously. @@ -34,7 +34,7 @@ async def main() -> None: print(f"Invalid parameters: {e}") return - print("Stars gifted") + print("Stars purchased") print(" %-14s %s" % ("Username:", result.username)) print(" %-14s %s" % ("Stars:", result.stars)) print(" %-14s %s" % ("Transaction:", result.transaction_id)) diff --git a/pyfragment/client.py b/pyfragment/client.py index 3618632..0c33fce 100644 --- a/pyfragment/client.py +++ b/pyfragment/client.py @@ -21,6 +21,10 @@ class FragmentClient: """ Client for the Fragment.com API. + .. note:: + This library is not affiliated with, endorsed by, or in any way officially + connected with Fragment or Telegram. + Args: seed: 24-word mnemonic phrase for the TON wallet. api_key: Tonapi API key — get one at https://tonconsole.com. @@ -85,12 +89,12 @@ class FragmentClient: self.wallet_version: WalletVersion = version # type: ignore[assignment] async def gift_premium(self, username: str, months: int, show_sender: bool = True) -> PremiumResult: - """Gift Telegram Premium to a user. + """Purchase Telegram Premium for a user. Args: username: Recipient's Telegram username (with or without ``@``). months: Duration — ``3``, ``6``, or ``12``. - show_sender: Show your name as the gift sender. Defaults to ``True``. + show_sender: Show your name as the sender. Defaults to ``True``. Returns: :class:`PremiumResult` with ``transaction_id``, ``username``, ``months``, ``timestamp``. @@ -98,7 +102,7 @@ class FragmentClient: return await gift_premium(self, username, months, show_sender) async def gift_stars(self, username: str, amount: int, show_sender: bool = True) -> StarsResult: - """Gift Telegram Stars to a user. + """Purchase Telegram Stars for a user. Args: username: Recipient's Telegram username (with or without ``@``). diff --git a/pyproject.toml b/pyproject.toml index 1f6ab66..dadce56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "pyfragment" version = "2026.1.0" -description = "Python library for the Fragment.com API — gift Telegram Stars, Premium, and top up TON Ads balance." +description = "Python library for the Fragment.com API — purchase Telegram Stars, Premium, and top up TON Ads balance." readme = "README.md" license = { text = "MIT" } requires-python = ">=3.12"