- Notifications
You must be signed in to change notification settings - Fork5.7k
Api 9.0 business stars#4773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
6 commits Select commitHold shift + click to select a range
ff62e53
Add class `StarAmount` and method `getBusinessAccountStarBalance`.
aelkheir7debcdc
Add method `transferBusinessAccountStars`.
aelkheir116999f
Add chango fragment for PR #4773
aelkheir2905654
Update master chango fragment for PR and delete local.
aelkheir5d9309e
Merge `nanostar_amuont` constants into one enum class.
aelkheircab81f8
Address code review comments.
aelkheirFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
10 changes: 10 additions & 0 deletionschanges/unreleased/4756.JT5nmUmGRG6qDEh5ScMn5f.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletionsdocs/source/inclusions/bot_methods.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletionsdocs/source/telegram.payments-tree.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletionsdocs/source/telegram.staramount.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
StarAmount | ||
========== | ||
.. autoclass:: telegram.StarAmount | ||
:members: | ||
:show-inheritance: |
2 changes: 2 additions & 0 deletionstelegram/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletionstelegram/_bot.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletionstelegram/_payment/stars/affiliateinfo.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletionstelegram/_payment/stars/staramount.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env python | ||
# | ||
# A library that provides a Python interface to the Telegram Bot API | ||
# Copyright (C) 2015-2025 | ||
# Leandro Toledo de Souza <devs@python-telegram-bot.org> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Lesser Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Lesser Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser Public License | ||
# along with this program. If not, see [http://www.gnu.org/licenses/]. | ||
# pylint: disable=redefined-builtin | ||
"""This module contains an object that represents a Telegram StarAmount.""" | ||
from typing import Optional | ||
from telegram._telegramobject import TelegramObject | ||
from telegram._utils.types import JSONDict | ||
class StarAmount(TelegramObject): | ||
"""Describes an amount of Telegram Stars. | ||
Objects of this class are comparable in terms of equality. Two objects of this class are | ||
considered equal, if their :attr:`amount` and :attr:`nanostar_amount` are equal. | ||
Args: | ||
amount (:obj:`int`): Integer amount of Telegram Stars, rounded to ``0``; can be negative. | ||
nanostar_amount (:obj:`int`, optional): The number of | ||
:tg-const:`telegram.constants.Nanostar.VALUE` shares of Telegram | ||
Stars; from :tg-const:`telegram.constants.NanostarLimit.MIN_AMOUNT` | ||
to :tg-const:`telegram.constants.NanostarLimit.MAX_AMOUNT`; can be | ||
negative if and only if :attr:`amount` is non-positive. | ||
Attributes: | ||
amount (:obj:`int`): Integer amount of Telegram Stars, rounded to ``0``; can be negative. | ||
nanostar_amount (:obj:`int`): Optional. The number of | ||
:tg-const:`telegram.constants.Nanostar.VALUE` shares of Telegram | ||
Stars; from :tg-const:`telegram.constants.NanostarLimit.MIN_AMOUNT` | ||
to :tg-const:`telegram.constants.NanostarLimit.MAX_AMOUNT`; can be | ||
negative if and only if :attr:`amount` is non-positive. | ||
""" | ||
__slots__ = ("amount", "nanostar_amount") | ||
def __init__( | ||
self, | ||
amount: int, | ||
nanostar_amount: Optional[int] = None, | ||
*, | ||
api_kwargs: Optional[JSONDict] = None, | ||
): | ||
super().__init__(api_kwargs=api_kwargs) | ||
self.amount: int = amount | ||
self.nanostar_amount: Optional[int] = nanostar_amount | ||
self._id_attrs = (self.amount, self.nanostar_amount) | ||
self._freeze() |
8 changes: 4 additions & 4 deletionstelegram/_payment/stars/startransactions.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.