From 8d2bf20fb89a2e428eefd8b6f5a3b09165d54ca0 Mon Sep 17 00:00:00 2001 From: Aleksandr Date: Sun, 16 Apr 2023 22:41:49 +0300 Subject: [PATCH] Added missing FORUM_TOPIC_EDITED value to content_type property (#1160) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added missing FORUM_TOPIC_EDITED value to content_type property * Added changelog to CHANGES * Fixed aiogram/filters/magic_data.py:21:41: C416 Unnecessary `dict` comprehension (rewrite using `dict()`) * Resolve #1155: Different signature of startup/shutdown events on polling and webhooks (#1156) * Code refactor - Use 'or' istead of 'A if A else B' - Raise new error from catched error: raise Error from e * Fixed signature of startup/shutdown events - Include the **dispatcher.workflow_data as the handler arguments * Update deep_linking basic examples (#1151) * skip if current router does not have observer for custom event (#1147) * skip if current router does not have observer for custom event * Test custom event in router * Feature changelog file * fix style * Change `InlineQueryResultType.MPEG` to more correct (#1146) * Change `InlineQueryResultType.MPEG` to `InlineQueryResultType.MPEG4GIF` * Change regexp for parse entities * Use code generator to fix types * Add changelog * fix(docs): fix wrong page link in docs (#1154) * storage cleanup (#1144) * storage cleanup * storage cleanup * Update API docs * Added tests * Fix tests --------- Co-authored-by: Alex Root Junior Co-authored-by: Ɓukasz Tshipenchko Co-authored-by: Max Kotsiuruba <81016938+A5KET@users.noreply.github.com> Co-authored-by: Andrey Tikhonov Co-authored-by: Desiders <47452083+Desiders@users.noreply.github.com> Co-authored-by: Daniil Co-authored-by: RootShinobi <111008396+RootShinobi@users.noreply.github.com> --- CHANGES/1160.bugfix | 1 + aiogram/types/message.py | 2 ++ tests/test_api/test_types/test_message.py | 12 ++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 CHANGES/1160.bugfix diff --git a/CHANGES/1160.bugfix b/CHANGES/1160.bugfix new file mode 100644 index 00000000..68e82835 --- /dev/null +++ b/CHANGES/1160.bugfix @@ -0,0 +1 @@ +Added missing FORUM_TOPIC_EDITED value to content_type property diff --git a/aiogram/types/message.py b/aiogram/types/message.py index c74ccb97..a057ef97 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -317,6 +317,8 @@ class Message(TelegramObject): return ContentType.MESSAGE_AUTO_DELETE_TIMER_CHANGED if self.forum_topic_created: return ContentType.FORUM_TOPIC_CREATED + if self.forum_topic_edited: + return ContentType.FORUM_TOPIC_EDITED if self.forum_topic_closed: return ContentType.FORUM_TOPIC_CLOSED if self.forum_topic_reopened: diff --git a/tests/test_api/test_types/test_message.py b/tests/test_api/test_types/test_message.py index 7eec99c7..563141f1 100644 --- a/tests/test_api/test_types/test_message.py +++ b/tests/test_api/test_types/test_message.py @@ -43,6 +43,7 @@ from aiogram.types import ( Document, EncryptedCredentials, ForumTopicClosed, + ForumTopicEdited, ForumTopicCreated, ForumTopicReopened, Game, @@ -414,6 +415,16 @@ TEST_FORUM_TOPIC_CREATED = Message( icon_color=0xFFD67E, ), ) +TEST_FORUM_TOPIC_EDITED = Message( + message_id=42, + date=datetime.datetime.now(), + chat=Chat(id=42, type="private"), + from_user=User(id=42, is_bot=False, first_name="Test"), + forum_topic_edited=ForumTopicEdited( + name="test_edited", + icon_color=0xFFD67E, + ), +) TEST_FORUM_TOPIC_CLOSED = Message( message_id=42, date=datetime.datetime.now(), @@ -484,6 +495,7 @@ class TestMessage: [TEST_MESSAGE_DICE, ContentType.DICE], [TEST_MESSAGE_WEB_APP_DATA, ContentType.WEB_APP_DATA], [TEST_FORUM_TOPIC_CREATED, ContentType.FORUM_TOPIC_CREATED], + [TEST_FORUM_TOPIC_EDITED, ContentType.FORUM_TOPIC_EDITED], [TEST_FORUM_TOPIC_CLOSED, ContentType.FORUM_TOPIC_CLOSED], [TEST_FORUM_TOPIC_REOPENED, ContentType.FORUM_TOPIC_REOPENED], [TEST_MESSAGE_UNKNOWN, ContentType.UNKNOWN],