fix miss service message for MessageActionChatJoinedByRequest (#48)

* fix miss service message for MessageActionChatJoinedByRequest

Closes #47 

---------

Co-authored-by: KurimuzonAkuma <31959970+KurimuzonAkuma@users.noreply.github.com>
This commit is contained in:
python israel 2024-04-28 19:01:17 +03:00 committed by GitHub
parent 9342bdfdd1
commit 2b53d394d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -107,3 +107,6 @@ class MessageServiceType(AutoName):
BOOST_APPLY = auto() BOOST_APPLY = auto()
"Boost apply" "Boost apply"
JOIN_REQUEST_APPROVED = auto()
"Join request approved"

View File

@ -372,6 +372,9 @@ class Message(Object, Update):
boosts_applied (``int``, *optional*): boosts_applied (``int``, *optional*):
Service message: how many boosts were applied. Service message: how many boosts were applied.
join_request_approved (``bool``, *optional*):
Service message: user join request approved
business_connection_id (``str``, *optional*): business_connection_id (``str``, *optional*):
Unique identifier of the business connection from which the message was received. Unique identifier of the business connection from which the message was received.
If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.
@ -489,6 +492,7 @@ class Message(Object, Update):
giveaway_launched: bool = None, giveaway_launched: bool = None,
chat_ttl_period: int = None, chat_ttl_period: int = None,
boosts_applied: int = None, boosts_applied: int = None,
join_request_approved: bool = None,
business_connection_id: str = None, business_connection_id: str = None,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
@ -595,6 +599,7 @@ class Message(Object, Update):
self.giveaway_launched = giveaway_launched self.giveaway_launched = giveaway_launched
self.chat_ttl_period = chat_ttl_period self.chat_ttl_period = chat_ttl_period
self.boosts_applied = boosts_applied self.boosts_applied = boosts_applied
self.join_request_approved = join_request_approved
self.reactions = reactions self.reactions = reactions
self.raw = raw self.raw = raw
@ -669,6 +674,7 @@ class Message(Object, Update):
requested_chats = None requested_chats = None
chat_ttl_period = None chat_ttl_period = None
boosts_applied = None boosts_applied = None
join_request_approved = None
service_type = None service_type = None
@ -756,6 +762,9 @@ class Message(Object, Update):
elif isinstance(action, raw.types.MessageActionBoostApply): elif isinstance(action, raw.types.MessageActionBoostApply):
boosts_applied = action.boosts boosts_applied = action.boosts
service_type = enums.MessageServiceType.BOOST_APPLY service_type = enums.MessageServiceType.BOOST_APPLY
elif isinstance(action, raw.types.MessageActionChatJoinedByRequest):
join_request_approved = True
service_type = enums.MessageServiceType.JOIN_REQUEST_APPROVED
from_user = types.User._parse(client, users.get(user_id, None)) from_user = types.User._parse(client, users.get(user_id, None))
sender_chat = types.Chat._parse(client, message, users, chats, is_chat=False) if not from_user else None sender_chat = types.Chat._parse(client, message, users, chats, is_chat=False) if not from_user else None
@ -794,6 +803,7 @@ class Message(Object, Update):
requested_chats=requested_chats, requested_chats=requested_chats,
chat_ttl_period=chat_ttl_period, chat_ttl_period=chat_ttl_period,
boosts_applied=boosts_applied, boosts_applied=boosts_applied,
join_request_approved=join_request_approved,
business_connection_id=business_connection_id, business_connection_id=business_connection_id,
raw=message, raw=message,
client=client client=client