- Notifications
You must be signed in to change notification settings - Fork5.7k
Api 9.0 general#4782
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
Api 9.0 general#4782
Changes fromall commits
Commits
Show all changes
8 commits Select commitHold shift + click to select a range
da79486
Update some constants to new values
Bibo-Joshi954205c
Add class PaidMessagePriceChanged
Bibo-Joshie5c4cef
Add new attributes to `Message`
Bibo-Joshi3dbd527
Add new filter
Bibo-Joshi15293ce
Add PR to chango fragment
Bibo-Joshi3bb9394
fix chango fragment
Bibo-Joshib714bd0
Update `constants.MessageType`
Bibo-Joshi7a95d45
small docstring fix
Bibo-JoshiFile 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
4 changes: 4 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
1 change: 1 addition & 0 deletionsdocs/source/telegram.at-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.paidmeessagepricechanged.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 @@ | ||
PaidMessagePriceChanged | ||
======================= | ||
.. autoclass:: telegram.PaidMessagePriceChanged | ||
: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
28 changes: 28 additions & 0 deletionstelegram/_message.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
55 changes: 55 additions & 0 deletionstelegram/_paidmessagepricechanged.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,55 @@ | ||
#!/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/]. | ||
"""This module contains an object that describes a price change of a paid message.""" | ||
from typing import Optional | ||
from telegram._telegramobject import TelegramObject | ||
from telegram._utils.types import JSONDict | ||
class PaidMessagePriceChanged(TelegramObject): | ||
"""Describes a service message about a change in the price of paid messages within a chat. | ||
Objects of this class are comparable in terms of equality. Two objects of this class are | ||
considered equal, if their :attr:`paid_message_star_count` is equal. | ||
.. versionadded:: NEXT.VERSION | ||
Args: | ||
paid_message_star_count (:obj:`int`): The new number of Telegram Stars that must be paid by | ||
non-administrator users of the supergroup chat for each sent message | ||
Attributes: | ||
paid_message_star_count (:obj:`int`): The new number of Telegram Stars that must be paid by | ||
non-administrator users of the supergroup chat for each sent message | ||
""" | ||
__slots__ = ("paid_message_star_count",) | ||
def __init__( | ||
self, | ||
paid_message_star_count: int, | ||
*, | ||
api_kwargs: Optional[JSONDict] = None, | ||
) -> None: | ||
super().__init__(api_kwargs=api_kwargs) | ||
self.paid_message_star_count: int = paid_message_star_count | ||
self._id_attrs = (self.paid_message_star_count,) | ||
self._freeze() |
21 changes: 17 additions & 4 deletionstelegram/constants.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
15 changes: 15 additions & 0 deletionstelegram/ext/filters.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
5 changes: 5 additions & 0 deletionstests/ext/test_filters.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
1 change: 1 addition & 0 deletionstests/test_constants.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
5 changes: 5 additions & 0 deletionstests/test_message.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
70 changes: 70 additions & 0 deletionstests/test_paidmessagepricechanged.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,70 @@ | ||
#!/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/]. | ||
import pytest | ||
from telegram import Dice, PaidMessagePriceChanged | ||
from tests.auxil.slots import mro_slots | ||
class PaidMessagePriceChangedTestBase: | ||
paid_message_star_count = 291 | ||
@pytest.fixture(scope="module") | ||
def paid_message_price_changed(): | ||
return PaidMessagePriceChanged(PaidMessagePriceChangedTestBase.paid_message_star_count) | ||
class TestPaidMessagePriceChangedWithoutRequest(PaidMessagePriceChangedTestBase): | ||
def test_slot_behaviour(self, paid_message_price_changed): | ||
for attr in paid_message_price_changed.__slots__: | ||
assert ( | ||
getattr(paid_message_price_changed, attr, "err") != "err" | ||
), f"got extra slot '{attr}'" | ||
assert len(mro_slots(paid_message_price_changed)) == len( | ||
set(mro_slots(paid_message_price_changed)) | ||
), "duplicate slot" | ||
def test_to_dict(self, paid_message_price_changed): | ||
pmpc_dict = paid_message_price_changed.to_dict() | ||
assert isinstance(pmpc_dict, dict) | ||
assert pmpc_dict["paid_message_star_count"] == self.paid_message_star_count | ||
def test_de_json(self, offline_bot): | ||
json_dict = {"paid_message_star_count": self.paid_message_star_count} | ||
pmpc = PaidMessagePriceChanged.de_json(json_dict, offline_bot) | ||
assert isinstance(pmpc, PaidMessagePriceChanged) | ||
assert pmpc.paid_message_star_count == self.paid_message_star_count | ||
assert pmpc.api_kwargs == {} | ||
def test_equality(self): | ||
pmpc1 = PaidMessagePriceChanged(self.paid_message_star_count) | ||
pmpc2 = PaidMessagePriceChanged(self.paid_message_star_count) | ||
pmpc3 = PaidMessagePriceChanged(3) | ||
dice = Dice(5, "emoji") | ||
assert pmpc1 == pmpc2 | ||
assert hash(pmpc1) == hash(pmpc2) | ||
assert pmpc1 != pmpc3 | ||
assert hash(pmpc1) != hash(pmpc3) | ||
assert pmpc1 != dice | ||
assert hash(pmpc1) != hash(dice) |
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.