mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-06 07:50:32 +00:00
Fix missing message content types (#1252)
* Fix missing message content types * Added changelog * Fix black * Update CHANGES/1252.bugfix.rst Co-authored-by: Alex Root Junior <jroot.junior@gmail.com> * add tests --------- Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
This commit is contained in:
parent
fac0a533b0
commit
4d12e073ee
3 changed files with 25 additions and 0 deletions
1
CHANGES/1252.bugfix.rst
Normal file
1
CHANGES/1252.bugfix.rst
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fixed missing message content types (:code:`ContentType.USER_SHARED`, :code:`ContentType.CHAT_SHARED`)
|
||||
|
|
@ -492,6 +492,10 @@ class Message(TelegramObject):
|
|||
return ContentType.VIDEO_CHAT_PARTICIPANTS_INVITED
|
||||
if self.web_app_data:
|
||||
return ContentType.WEB_APP_DATA
|
||||
if self.user_shared:
|
||||
return ContentType.USER_SHARED
|
||||
if self.chat_shared:
|
||||
return ContentType.CHAT_SHARED
|
||||
|
||||
return ContentType.UNKNOWN
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ from aiogram.types import (
|
|||
Animation,
|
||||
Audio,
|
||||
Chat,
|
||||
ChatShared,
|
||||
Contact,
|
||||
Dice,
|
||||
Document,
|
||||
|
|
@ -62,6 +63,7 @@ from aiogram.types import (
|
|||
Sticker,
|
||||
SuccessfulPayment,
|
||||
User,
|
||||
UserShared,
|
||||
Venue,
|
||||
Video,
|
||||
VideoChatEnded,
|
||||
|
|
@ -439,6 +441,20 @@ TEST_FORUM_TOPIC_REOPENED = Message(
|
|||
from_user=User(id=42, is_bot=False, first_name="Test"),
|
||||
forum_topic_reopened=ForumTopicReopened(),
|
||||
)
|
||||
TEST_USER_SHARED = 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"),
|
||||
user_shared=UserShared(request_id=42, user_id=42),
|
||||
)
|
||||
TEST_CHAT_SHARED = 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"),
|
||||
chat_shared=ChatShared(request_id=42, chat_id=42),
|
||||
)
|
||||
TEST_MESSAGE_UNKNOWN = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
|
|
@ -498,6 +514,8 @@ class TestMessage:
|
|||
[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_USER_SHARED, ContentType.USER_SHARED],
|
||||
[TEST_CHAT_SHARED, ContentType.CHAT_SHARED],
|
||||
[TEST_MESSAGE_UNKNOWN, ContentType.UNKNOWN],
|
||||
],
|
||||
)
|
||||
|
|
@ -642,6 +660,8 @@ class TestMessage:
|
|||
[TEST_MESSAGE_VIDEO_CHAT_ENDED, None],
|
||||
[TEST_MESSAGE_VIDEO_CHAT_PARTICIPANTS_INVITED, None],
|
||||
[TEST_MESSAGE_DICE, SendDice],
|
||||
[TEST_USER_SHARED, None],
|
||||
[TEST_CHAT_SHARED, None],
|
||||
[TEST_MESSAGE_UNKNOWN, None],
|
||||
],
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue