diff --git a/pyrogram/methods/bots/send_game.py b/pyrogram/methods/bots/send_game.py index 60155a6f..1194a3ef 100644 --- a/pyrogram/methods/bots/send_game.py +++ b/pyrogram/methods/bots/send_game.py @@ -29,6 +29,7 @@ class SendGame: chat_id: Union[int, str], game_short_name: str, disable_notification: bool = None, + message_thread_id: int = None, reply_to_message_id: int = None, protect_content: bool = None, reply_markup: Union[ @@ -55,6 +56,10 @@ class SendGame: Sends the message silently. Users will receive a notification with no sound. + message_thread_id (``int``, *optional*): + Unique identifier of a message thread to which the message belongs. + for supergroups only + reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. @@ -84,7 +89,7 @@ class SendGame: ), message="", silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id, + reply_to_msg_id=reply_to_message_id or message_thread_id, random_id=self.rnd_id(), noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 1f6a6fbc..1759bc6b 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -3054,6 +3054,7 @@ class Message(Object, Update): parse_mode: Optional["enums.ParseMode"] = None, caption_entities: List["types.MessageEntity"] = None, disable_notification: bool = None, + message_thread_id: int = None, reply_to_message_id: int = None, schedule_date: datetime = None, protect_content: bool = None, @@ -3103,6 +3104,10 @@ class Message(Object, Update): Sends the message silently. Users will receive a notification with no sound. + message_thread_id (``int``, *optional*): + Unique identifier for the target message thread (topic) of the forum. + for forum supergroups only. + reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. @@ -3140,6 +3145,7 @@ class Message(Object, Update): parse_mode=enums.ParseMode.DISABLED, disable_web_page_preview=not self.web_page, disable_notification=disable_notification, + message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, schedule_date=schedule_date, protect_content=protect_content, @@ -3150,6 +3156,7 @@ class Message(Object, Update): self._client.send_cached_media, chat_id=chat_id, disable_notification=disable_notification, + message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, schedule_date=schedule_date, protect_content=protect_content, @@ -3180,6 +3187,7 @@ class Message(Object, Update): last_name=self.contact.last_name, vcard=self.contact.vcard, disable_notification=disable_notification, + message_thread_id=message_thread_id, schedule_date=schedule_date ) elif self.location: @@ -3188,6 +3196,7 @@ class Message(Object, Update): latitude=self.location.latitude, longitude=self.location.longitude, disable_notification=disable_notification, + message_thread_id=message_thread_id, schedule_date=schedule_date ) elif self.venue: @@ -3200,6 +3209,7 @@ class Message(Object, Update): foursquare_id=self.venue.foursquare_id, foursquare_type=self.venue.foursquare_type, disable_notification=disable_notification, + message_thread_id=message_thread_id, schedule_date=schedule_date ) elif self.poll: @@ -3208,19 +3218,24 @@ class Message(Object, Update): question=self.poll.question, options=[opt.text for opt in self.poll.options], disable_notification=disable_notification, + message_thread_id=message_thread_id, schedule_date=schedule_date ) elif self.game: return await self._client.send_game( chat_id, game_short_name=self.game.short_name, - disable_notification=disable_notification + disable_notification=disable_notification, + message_thread_id=message_thread_id ) else: raise ValueError("Unknown media type") if self.sticker or self.video_note: # Sticker and VideoNote should have no caption - return await send_media(file_id=file_id) + return await send_media( + file_id=file_id, + message_thread_id=message_thread_id + ) else: if caption is None: caption = self.caption or "" @@ -3230,7 +3245,8 @@ class Message(Object, Update): file_id=file_id, caption=caption, parse_mode=parse_mode, - caption_entities=caption_entities + caption_entities=caption_entities, + message_thread_id=message_thread_id ) else: raise ValueError("Can't copy this message")