mirror of
https://github.com/vibe-existing/pyfragment.git
synced 2026-07-25 06:54:31 +00:00
feat: update terminology from "gift" to "purchase" for Telegram Premium and Stars; enhance README and example scripts
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<div align="center">
|
||||
<img src="fragment.svg" alt="Fragment Logo" width="120" height="120" style="border-radius: 24px;">
|
||||
|
||||
<h1 style="margin-top: 24px;">💎 Fragment API</h1>
|
||||
<h1 style="margin-top: 24px;">Fragment API</h1>
|
||||
|
||||
<p style="font-size: 18px; margin-bottom: 24px;">
|
||||
<b>Python library for the Fragment.com API — gift Telegram Stars, Premium, and top up TON Ads balance.</b>
|
||||
<b>Python library for the Fragment.com API — purchase Telegram Stars, Premium, and top up TON Ads balance.</b>
|
||||
</p>
|
||||
|
||||
[](https://pypi.org/project/pyfragment/)
|
||||
@@ -18,13 +18,15 @@
|
||||
|
||||
</div>
|
||||
|
||||
> **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 | — |
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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 ``@``).
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user