Pyrogram: Add message_thread_id parameter to send_{animation,audio,cached_media,contact,dice,document,location,media_group,message,photo,poll,sticker,venue,video,video_note,voice} methods

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2022-11-12 23:05:33 +07:00
parent c9e36cc150
commit 9b92492553
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
16 changed files with 96 additions and 16 deletions

View file

@ -45,6 +45,7 @@ class SendAnimation:
thumb: Union[str, BinaryIO] = None,
file_name: str = None,
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -111,6 +112,10 @@ class SendAnimation:
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.
@ -223,7 +228,7 @@ class SendAnimation:
peer=await self.resolve_peer(chat_id),
media=media,
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -44,6 +44,7 @@ class SendAudio:
thumb: Union[str, BinaryIO] = None,
file_name: str = None,
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -108,6 +109,10 @@ class SendAudio:
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.
@ -217,7 +222,7 @@ class SendAudio:
peer=await self.resolve_peer(chat_id),
media=media,
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -34,6 +34,7 @@ class SendCachedMedia:
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,
@ -76,6 +77,10 @@ class SendCachedMedia:
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.
@ -103,7 +108,7 @@ class SendCachedMedia:
peer=await self.resolve_peer(chat_id),
media=utils.get_input_media_from_file_id(file_id),
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -33,6 +33,7 @@ class SendContact:
last_name: str = None,
vcard: str = None,
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -69,6 +70,10 @@ class SendContact:
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.
@ -101,7 +106,7 @@ class SendContact:
),
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -30,6 +30,7 @@ class SendDice:
chat_id: Union[int, str],
emoji: str = "🎲",
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -61,6 +62,10 @@ class SendDice:
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.
@ -95,7 +100,7 @@ class SendDice:
peer=await self.resolve_peer(chat_id),
media=raw.types.InputMediaDice(emoticon=emoji),
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -42,6 +42,7 @@ class SendDocument:
file_name: str = None,
force_document: bool = None,
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -100,6 +101,10 @@ class SendDocument:
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.
@ -195,7 +200,7 @@ class SendDocument:
peer=await self.resolve_peer(chat_id),
media=media,
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -31,6 +31,7 @@ class SendLocation:
latitude: float,
longitude: float,
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -61,6 +62,10 @@ class SendLocation:
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
@ -93,7 +98,7 @@ class SendLocation:
),
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -43,6 +43,7 @@ class SendMediaGroup:
"types.InputMediaDocument"
]],
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -64,6 +65,10 @@ class SendMediaGroup:
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.
@ -383,7 +388,7 @@ class SendMediaGroup:
peer=await self.resolve_peer(chat_id),
multi_media=multi_media,
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,
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content
),

View file

@ -33,6 +33,7 @@ class SendMessage:
entities: List["types.MessageEntity"] = None,
disable_web_page_preview: bool = None,
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -70,6 +71,10 @@ class SendMessage:
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.
@ -128,7 +133,7 @@ class SendMessage:
peer=await self.resolve_peer(chat_id),
no_webpage=disable_web_page_preview or None,
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
reply_markup=await reply_markup.write(self) if reply_markup else None,

View file

@ -39,6 +39,7 @@ class SendPhoto:
caption_entities: List["types.MessageEntity"] = None,
ttl_seconds: int = None,
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -87,6 +88,10 @@ class SendPhoto:
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.
@ -172,7 +177,7 @@ class SendPhoto:
peer=await self.resolve_peer(chat_id),
media=media,
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -42,6 +42,7 @@ class SendPoll:
is_closed: bool = None,
disable_notification: bool = None,
protect_content: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
reply_markup: Union[
@ -114,6 +115,10 @@ class SendPoll:
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
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.
@ -161,7 +166,7 @@ class SendPoll:
),
message="",
silent=disable_notification,
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -36,6 +36,7 @@ class SendSticker:
chat_id: Union[int, str],
sticker: Union[str, BinaryIO],
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -69,6 +70,10 @@ class SendSticker:
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.
@ -154,7 +159,7 @@ class SendSticker:
peer=await self.resolve_peer(chat_id),
media=media,
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -35,6 +35,7 @@ class SendVenue:
foursquare_id: str = "",
foursquare_type: str = "",
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -78,6 +79,10 @@ class SendVenue:
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
@ -117,7 +122,7 @@ class SendVenue:
),
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -46,6 +46,7 @@ class SendVideo:
file_name: str = None,
supports_streaming: bool = True,
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -117,6 +118,10 @@ class SendVideo:
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.
@ -229,7 +234,7 @@ class SendVideo:
peer=await self.resolve_peer(chat_id),
media=media,
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -38,6 +38,7 @@ class SendVideoNote:
length: int = 1,
thumb: Union[str, BinaryIO] = None,
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -83,6 +84,10 @@ class SendVideoNote:
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
@ -178,7 +183,7 @@ class SendVideoNote:
peer=await self.resolve_peer(chat_id),
media=media,
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,

View file

@ -40,6 +40,7 @@ class SendVoice:
caption_entities: List["types.MessageEntity"] = None,
duration: int = 0,
disable_notification: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
@ -86,6 +87,10 @@ class SendVoice:
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
@ -179,7 +184,7 @@ class SendVoice:
peer=await self.resolve_peer(chat_id),
media=media,
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(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,