-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New classes for API 6.3: ForumTopic, ForumTopicCreated, ForumTopicClosed, ForumTopicReopened
#3356
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
374563d
copy-paste Poolitzer's `test_forum.py`, move test from `test_bot.py`
lemontree210 b5211d8
refactor(`test_forum.py`): add fixture to create and delete topic
lemontree210 c24efa2
merge api_6.3_update
lemontree210 726b6ab
create classes `ForumTopic`, `ForumTopic...`, 1st test
lemontree210 7d77ae9
add tests for service message classes, fix `de_json()` in `ForumTopic…
lemontree210 5c0a2e8
minor: remove TODO after comment in review
lemontree210 deaacfb
add tests and `de_json()` for `ForumTopic`
lemontree210 b627a9c
fix(typos in `message.py`): `TopicForum` -> `ForumTopic`
lemontree210 5fe81c1
fix(`_forumtopic.py`): rm `de_json()`, replace `{}` with `None` in test
lemontree210 d40e8a0
fix(`telegram.rst`): reorder alphabetically
lemontree210 417bd26
fix(`message.py`): add "forum_topic_closed", "_reopened" to `de_json()`
lemontree210 e12a8ff
fix(class docstrings) `, optional):` -> `): Optional.` in attrs section
lemontree210 7328f43
refactor(`test_forum.py`) add/change fixtures
lemontree210 99095c4
fix(`ForumTopic`): make `__eq__` check all required args (+`icon_color`)
lemontree210 1be6f67
Merge remote-tracking branch 'origin/api_6.3_update' into new_classes…
lemontree210 0d3d1c0
Merge branch 'api_6.3_update' into new_classes_for_api_6.3
Bibo-Joshi 46d24bc
re-add new classes to toctree
Bibo-Joshi f51caf3
Merge remote-tracking branch 'origin/api_6.3_update' into new_classes…
lemontree210 f958cbc
fix(`Bot.create_forum_topic`): return `ForumTopic`; change test fixture
lemontree210 759816f
fix(`Bot.create_forum_topic`): make 2 attrs optional, tweak docstring
lemontree210 d323c7f
fix existing test that was failing
lemontree210 1b52d1c
add tests for `Bot.create_forum_topic()`
lemontree210 011fcfa
rename fixture, replace dummy emoji ID with real one from fixture
lemontree210 61eca9a
remove failing test: service message can't be checked
lemontree210 748ca5f
remove 2 TODOs
lemontree210 ab33cb5
fix signature of `ExtBot.create_forum_topic()`
lemontree210 c180f8f
Merge remote-tracking branch 'origin/api_6.3_update' into new_classes…
lemontree210 27db94d
add test for `Bot.close_forum_topic()` and `.reopen_forum_topic()`
lemontree210 b137494
add (failing, commented) test for `Bot.unpin_all_forum_topic_messages`
lemontree210 3b12a8e
fix failing `unpin_all_forum_messages` test
harshil21 620c0c2
remove duplicate test from test_bot.py
harshil21 c2705e9
status update filters
Bibo-Joshi 07a0967
Merge remote-tracking branch 'origin/new_classes_for_api_6.3' into ne…
Bibo-Joshi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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 @@ | ||
| telegram.ForumTopic | ||
| =================== | ||
|
|
||
| .. autoclass:: telegram.ForumTopic | ||
| :members: | ||
| :show-inheritance: |
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 @@ | ||
| telegram.ForumTopicClosed | ||
| ========================= | ||
|
|
||
| .. autoclass:: telegram.ForumTopicClosed | ||
| :members: | ||
| :show-inheritance: |
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 @@ | ||
| telegram.ForumTopicCreated | ||
| ========================== | ||
|
|
||
| .. autoclass:: telegram.ForumTopicCreated | ||
| :members: | ||
| :show-inheritance: |
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 @@ | ||
| telegram.ForumTopicReopened | ||
| =========================== | ||
|
|
||
| .. autoclass:: telegram.ForumTopicReopened | ||
| :members: | ||
| :show-inheritance: |
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
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
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
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,131 @@ | ||
| #!/usr/bin/env python | ||
| # | ||
| # A library that provides a Python interface to the Telegram Bot API | ||
| # Copyright (C) 2015-2022 | ||
| # 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 objects related to Telegram forum topics.""" | ||
|
|
||
| from telegram._telegramobject import TelegramObject | ||
| from telegram._utils.types import JSONDict | ||
|
|
||
|
|
||
| class ForumTopic(TelegramObject): | ||
| """ | ||
| This object represents the content of a service message about a new forum topic created in | ||
| the chat. | ||
|
|
||
| Objects of this class are comparable in terms of equality. Two objects of this class are | ||
| considered equal, if their :attr:`message_thread_id`, :attr:`name` and :attr:`icon_color` | ||
| are equal. | ||
|
|
||
| .. versionadded:: 20.0 | ||
|
|
||
| Args: | ||
| message_thread_id (:obj:`int`): Unique identifier of the forum topic | ||
| name (:obj:`str`): Name of the topic | ||
| icon_color (:obj:`int`): Color of the topic icon in RGB format | ||
| icon_custom_emoji_id (:obj:`str`, optional): Unique identifier of the custom emoji shown | ||
| as the topic icon. | ||
|
|
||
| Attributes: | ||
| message_thread_id (:obj:`int`): Unique identifier of the forum topic | ||
| name (:obj:`str`): Name of the topic | ||
| icon_color (:obj:`int`): Color of the topic icon in RGB format | ||
| icon_custom_emoji_id (:obj:`str`): Optional. Unique identifier of the custom emoji shown | ||
| as the topic icon. | ||
| """ | ||
|
|
||
| __slots__ = ("message_thread_id", "name", "icon_color", "icon_custom_emoji_id") | ||
|
|
||
| def __init__( | ||
| self, | ||
| message_thread_id: int, | ||
| name: str, | ||
| icon_color: int, | ||
| icon_custom_emoji_id: str = None, | ||
| *, | ||
| api_kwargs: JSONDict = None, | ||
| ): | ||
| super().__init__(api_kwargs=api_kwargs) | ||
| self.message_thread_id = message_thread_id | ||
| self.name = name | ||
| self.icon_color = icon_color | ||
| self.icon_custom_emoji_id = icon_custom_emoji_id | ||
|
|
||
| self._id_attrs = (self.message_thread_id, self.name, self.icon_color) | ||
|
|
||
|
|
||
| class ForumTopicCreated(TelegramObject): | ||
| """ | ||
| This object represents the content of a service message about a new forum topic created in | ||
| the chat. | ||
|
|
||
| Objects of this class are comparable in terms of equality. Two objects of this class are | ||
| considered equal, if their :attr:`name` and :attr:`icon_color` are equal. | ||
|
|
||
| .. versionadded:: 20.0 | ||
|
|
||
| Args: | ||
| name (:obj:`str`): Name of the topic | ||
| icon_color (:obj:`int`): Color of the topic icon in RGB format | ||
| icon_custom_emoji_id (:obj:`str`, optional): Unique identifier of the custom emoji shown | ||
| as the topic icon. | ||
|
|
||
| Attributes: | ||
| name (:obj:`str`): Name of the topic | ||
| icon_color (:obj:`int`): Color of the topic icon in RGB format | ||
| icon_custom_emoji_id (:obj:`str`): Optional. Unique identifier of the custom emoji shown | ||
| as the topic icon. | ||
| """ | ||
|
|
||
| __slots__ = ("name", "icon_color", "icon_custom_emoji_id") | ||
|
|
||
| def __init__( | ||
| self, | ||
| name: str, | ||
| icon_color: int, | ||
| icon_custom_emoji_id: str = None, | ||
| *, | ||
| api_kwargs: JSONDict = None, | ||
| ): | ||
| super().__init__(api_kwargs=api_kwargs) | ||
| self.name = name | ||
| self.icon_color = icon_color | ||
| self.icon_custom_emoji_id = icon_custom_emoji_id | ||
|
|
||
| self._id_attrs = (self.name, self.icon_color) | ||
|
|
||
|
|
||
| class ForumTopicClosed(TelegramObject): | ||
| """ | ||
| This object represents a service message about a forum topic closed in the chat. | ||
| Currently holds no information. | ||
|
|
||
| .. versionadded:: 20.0 | ||
| """ | ||
|
|
||
| __slots__ = () | ||
|
|
||
|
|
||
| class ForumTopicReopened(TelegramObject): | ||
| """ | ||
| This object represents a service message about a forum topic reopened in the chat. | ||
| Currently holds no information. | ||
|
|
||
| .. versionadded:: 20.0 | ||
| """ | ||
|
|
||
| __slots__ = () |
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
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.
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.
Uh oh!
There was an error while loading. Please reload this page.