get_stars_transactions()¶
- async Client.get_stars_transactions()¶
Get the Telegram Stars transaction history for an account, bot, or channel.
Usable by Users Bots- Parameters:
chat_id (
int|str, optional) – Unique identifier (int) or username (str) of the target chat, bot, or channel. Defaults to None (the current account / “me”).inbound (
bool, optional) – Pass True to retrieve only incoming transactions (credits). Defaults to None (both incoming and outgoing).outbound (
bool, optional) – Pass True to retrieve only outgoing transactions (debits). Defaults to None (both incoming and outgoing).ascending (
bool, optional) – Pass True to sort transactions in ascending order (oldest first). Defaults to False (newest first).ton (
bool, optional) – Pass True to retrieve TON transactions instead of Stars. Defaults to False.subscription_id (
str, optional) – Filter transactions by a specific star subscription ID.limit (
int, optional) – Limits the number of transactions to be retrieved. By default, no limit is applied and all transactions are returned.
- Returns:
Generator– A generator yieldingStarsTransactionobjects.
Example
# Get all stars transactions for the current account async for tx in app.get_stars_transactions(): print(tx.id, tx.amount, tx.date) # Get only incoming stars for a channel or bot async for tx in app.get_stars_transactions(chat_id="my_channel", inbound=True, limit=20): print(f"+{tx.amount} from {tx.user.first_name if tx.user else tx.peer}")