mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
* Added 3 missing content types * Added tests for 3 missing content types * More tests * Added changelog
This commit is contained in:
parent
f2e02e2a7c
commit
6ad242399b
3 changed files with 46 additions and 0 deletions
5
CHANGES/906.bugfix.rst
Normal file
5
CHANGES/906.bugfix.rst
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Added 3 missing content types:
|
||||
|
||||
* proximity_alert_triggered
|
||||
* supergroup_chat_created
|
||||
* channel_chat_created
|
||||
|
|
@ -250,8 +250,14 @@ class Message(TelegramObject):
|
|||
return ContentType.DELETE_CHAT_PHOTO
|
||||
if self.group_chat_created:
|
||||
return ContentType.GROUP_CHAT_CREATED
|
||||
if self.supergroup_chat_created:
|
||||
return ContentType.SUPERGROUP_CHAT_CREATED
|
||||
if self.channel_chat_created:
|
||||
return ContentType.CHANNEL_CHAT_CREATED
|
||||
if self.passport_data:
|
||||
return ContentType.PASSPORT_DATA
|
||||
if self.proximity_alert_triggered:
|
||||
return ContentType.PROXIMITY_ALERT_TRIGGERED
|
||||
if self.poll:
|
||||
return ContentType.POLL
|
||||
if self.dice:
|
||||
|
|
@ -1900,7 +1906,10 @@ class ContentType(helper.Helper):
|
|||
NEW_CHAT_PHOTO = helper.Item() # new_chat_photo
|
||||
DELETE_CHAT_PHOTO = helper.Item() # delete_chat_photo
|
||||
GROUP_CHAT_CREATED = helper.Item() # group_chat_created
|
||||
SUPERGROUP_CHAT_CREATED = helper.Item() # supergroup_chat_created
|
||||
CHANNEL_CHAT_CREATED = helper.Item() # channel_chat_created
|
||||
PASSPORT_DATA = helper.Item() # passport_data
|
||||
PROXIMITY_ALERT_TRIGGERED = helper.Item() # proximity_alert_triggered
|
||||
POLL = helper.Item() # poll
|
||||
DICE = helper.Item() # dice
|
||||
MESSAGE_AUTO_DELETE_TIMER_CHANGED = helper.Item() # message_auto_delete_timer_changed
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ from aiogram.types import (
|
|||
PhotoSize,
|
||||
Poll,
|
||||
PollOption,
|
||||
ProximityAlertTriggered,
|
||||
Sticker,
|
||||
SuccessfulPayment,
|
||||
User,
|
||||
|
|
@ -284,6 +285,20 @@ TEST_MESSAGE_GROUP_CHAT_CREATED = Message(
|
|||
chat=Chat(id=42, type="private"),
|
||||
from_user=User(id=42, is_bot=False, first_name="Test"),
|
||||
)
|
||||
TEST_MESSAGE_SUPERGROUP_CHAT_CREATED = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
supergroup_chat_created=True,
|
||||
chat=Chat(id=-10042, type="supergroup"),
|
||||
from_user=User(id=42, is_bot=False, first_name="Test"),
|
||||
)
|
||||
TEST_MESSAGE_CHANNEL_CHAT_CREATED = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
channel_chat_created=True,
|
||||
chat=Chat(id=-10042, type="channel"),
|
||||
from_user=User(id=42, is_bot=False, first_name="Test"),
|
||||
)
|
||||
TEST_MESSAGE_PASSPORT_DATA = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
|
|
@ -294,6 +309,17 @@ TEST_MESSAGE_PASSPORT_DATA = Message(
|
|||
chat=Chat(id=42, type="private"),
|
||||
from_user=User(id=42, is_bot=False, first_name="Test"),
|
||||
)
|
||||
TEST_MESSAGE_PROXIMITY_ALERT_TRIGGERED = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
chat=Chat(id=42, type="supergroup"),
|
||||
from_user=User(id=42, is_bot=False, first_name="Test"),
|
||||
proximity_alert_triggered=ProximityAlertTriggered(
|
||||
traveler=User(id=1, is_bot=False, first_name="Traveler"),
|
||||
watcher=User(id=2, is_bot=False, first_name="Watcher"),
|
||||
distance=42,
|
||||
),
|
||||
)
|
||||
TEST_MESSAGE_POLL = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
|
|
@ -404,7 +430,10 @@ class TestMessage:
|
|||
[TEST_MESSAGE_NEW_CHAT_PHOTO, ContentType.NEW_CHAT_PHOTO],
|
||||
[TEST_MESSAGE_DELETE_CHAT_PHOTO, ContentType.DELETE_CHAT_PHOTO],
|
||||
[TEST_MESSAGE_GROUP_CHAT_CREATED, ContentType.GROUP_CHAT_CREATED],
|
||||
[TEST_MESSAGE_SUPERGROUP_CHAT_CREATED, ContentType.SUPERGROUP_CHAT_CREATED],
|
||||
[TEST_MESSAGE_CHANNEL_CHAT_CREATED, ContentType.CHANNEL_CHAT_CREATED],
|
||||
[TEST_MESSAGE_PASSPORT_DATA, ContentType.PASSPORT_DATA],
|
||||
[TEST_MESSAGE_PROXIMITY_ALERT_TRIGGERED, ContentType.PROXIMITY_ALERT_TRIGGERED],
|
||||
[TEST_MESSAGE_POLL, ContentType.POLL],
|
||||
[
|
||||
TEST_MESSAGE_MESSAGE_AUTO_DELETE_TIMER_CHANGED,
|
||||
|
|
@ -553,7 +582,10 @@ class TestMessage:
|
|||
[TEST_MESSAGE_NEW_CHAT_PHOTO, None],
|
||||
[TEST_MESSAGE_DELETE_CHAT_PHOTO, None],
|
||||
[TEST_MESSAGE_GROUP_CHAT_CREATED, None],
|
||||
[TEST_MESSAGE_SUPERGROUP_CHAT_CREATED, None],
|
||||
[TEST_MESSAGE_CHANNEL_CHAT_CREATED, None],
|
||||
[TEST_MESSAGE_PASSPORT_DATA, None],
|
||||
[TEST_MESSAGE_PROXIMITY_ALERT_TRIGGERED, None],
|
||||
[TEST_MESSAGE_POLL, SendPoll],
|
||||
[TEST_MESSAGE_MESSAGE_AUTO_DELETE_TIMER_CHANGED, None],
|
||||
[TEST_MESSAGE_VIDEO_CHAT_STARTED, None],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue