Skip to content

Commit

Permalink
fix miss service message for MessageActionChatJoinedByRequest (Mayuri…
Browse files Browse the repository at this point in the history
…-Chan#48)

* fix miss service message for MessageActionChatJoinedByRequest

Closes Mayuri-Chan#47

---------

Co-authored-by: KurimuzonAkuma <31959970+KurimuzonAkuma@users.noreply.github.com>
Signed-off-by: eyMarv <eyMarv07@gmail.com>
  • Loading branch information
2 people authored and eyMarv committed Jun 1, 2024
1 parent 27075f9 commit e642e33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyrogram/enums/message_service_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,6 @@ class MessageServiceType(AutoName):

BOOST_APPLY = auto()
"Boost apply"

JOIN_REQUEST_APPROVED = auto()
"Join request approved"
10 changes: 10 additions & 0 deletions pyrogram/types/messages_and_media/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ class Message(Object, Update):
boosts_applied (``int``, *optional*):
Service message: how many boosts were applied.
join_request_approved (``bool``, *optional*):
Service message: user join request approved
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user.
Expand Down Expand Up @@ -515,6 +518,7 @@ def __init__(
requested_chats: "types.RequestedChats" = None,
chat_ttl_period: int = None,
boosts_applied: int = None,
join_request_approved: bool = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
Expand Down Expand Up @@ -625,6 +629,7 @@ def __init__(
self.giveaway_launched = giveaway_launched
self.chat_ttl_period = chat_ttl_period
self.boosts_applied = boosts_applied
self.join_request_approved = join_request_approved
self.reactions = reactions
self.raw = raw

Expand Down Expand Up @@ -735,6 +740,7 @@ async def _parse(
requested_chats = None
chat_ttl_period = None
boosts_applied = None
join_request_approved = None

service_type = None

Expand Down Expand Up @@ -847,6 +853,9 @@ async def _parse(
elif isinstance(action, raw.types.MessageActionBoostApply):
boosts_applied = action.boosts
service_type = enums.MessageServiceType.BOOST_APPLY
elif isinstance(action, raw.types.MessageActionChatJoinedByRequest):
join_request_approved = True
service_type = enums.MessageServiceType.JOIN_REQUEST_APPROVED

giveaway_launched = types.GiveawayLaunched()
service_type = enums.MessageServiceType.GIVEAWAY_LAUNCHED
Expand Down Expand Up @@ -915,6 +924,7 @@ async def _parse(
requested_chats=requested_chats,
chat_ttl_period=chat_ttl_period,
boosts_applied=boosts_applied,
join_request_approved=join_request_approved,
raw=message,
client=client,
# TODO: supergroup_chat_created
Expand Down

0 comments on commit e642e33

Please sign in to comment.