pyrofork: Append message_thread_id to reply bound methods if the message is a topic message

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2023-08-08 20:19:28 +07:00
parent 6b45a89f2b
commit f44c80c1a2
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -1118,6 +1118,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_message( return await self._client.send_message(
chat_id=self.chat.id, chat_id=self.chat.id,
text=text, text=text,
@ -1125,6 +1129,7 @@ class Message(Object, Update):
entities=entities, entities=entities,
disable_web_page_preview=disable_web_page_preview, disable_web_page_preview=disable_web_page_preview,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
schedule_date=schedule_date, schedule_date=schedule_date,
protect_content=protect_content, protect_content=protect_content,
@ -1264,6 +1269,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_animation( return await self._client.send_animation(
chat_id=self.chat.id, chat_id=self.chat.id,
animation=animation, animation=animation,
@ -1277,6 +1286,7 @@ class Message(Object, Update):
thumb=thumb, thumb=thumb,
file_name=file_name, file_name=file_name,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup, reply_markup=reply_markup,
progress=progress, progress=progress,
@ -1410,6 +1420,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_audio( return await self._client.send_audio(
chat_id=self.chat.id, chat_id=self.chat.id,
audio=audio, audio=audio,
@ -1422,6 +1436,7 @@ class Message(Object, Update):
thumb=thumb, thumb=thumb,
file_name=file_name, file_name=file_name,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup, reply_markup=reply_markup,
progress=progress, progress=progress,
@ -1503,6 +1518,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_cached_media( return await self._client.send_cached_media(
chat_id=self.chat.id, chat_id=self.chat.id,
file_id=file_id, file_id=file_id,
@ -1510,6 +1529,7 @@ class Message(Object, Update):
parse_mode=parse_mode, parse_mode=parse_mode,
caption_entities=caption_entities, caption_entities=caption_entities,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup reply_markup=reply_markup
) )
@ -1625,6 +1645,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_contact( return await self._client.send_contact(
chat_id=self.chat.id, chat_id=self.chat.id,
phone_number=phone_number, phone_number=phone_number,
@ -1632,6 +1656,7 @@ class Message(Object, Update):
last_name=last_name, last_name=last_name,
vcard=vcard, vcard=vcard,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup reply_markup=reply_markup
) )
@ -1761,6 +1786,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_document( return await self._client.send_document(
chat_id=self.chat.id, chat_id=self.chat.id,
document=document, document=document,
@ -1771,6 +1800,7 @@ class Message(Object, Update):
file_name=file_name, file_name=file_name,
force_document=force_document, force_document=force_document,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
schedule_date=schedule_date, schedule_date=schedule_date,
reply_markup=reply_markup, reply_markup=reply_markup,
@ -1839,10 +1869,15 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_game( return await self._client.send_game(
chat_id=self.chat.id, chat_id=self.chat.id,
game_short_name=game_short_name, game_short_name=game_short_name,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup reply_markup=reply_markup
) )
@ -1853,7 +1888,6 @@ class Message(Object, Update):
result_id: str, result_id: str,
quote: bool = None, quote: bool = None,
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: bool = None,
reply_to_message_id: int = None reply_to_message_id: int = None
) -> "Message": ) -> "Message":
"""Bound method *reply_inline_bot_result* of :obj:`~pyrogram.types.Message`. """Bound method *reply_inline_bot_result* of :obj:`~pyrogram.types.Message`.
@ -1904,6 +1938,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_inline_bot_result( return await self._client.send_inline_bot_result(
chat_id=self.chat.id, chat_id=self.chat.id,
query_id=query_id, query_id=query_id,
@ -1979,11 +2017,16 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_location( return await self._client.send_location(
chat_id=self.chat.id, chat_id=self.chat.id,
latitude=latitude, latitude=latitude,
longitude=longitude, longitude=longitude,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup reply_markup=reply_markup
) )
@ -2047,10 +2090,15 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_media_group( return await self._client.send_media_group(
chat_id=self.chat.id, chat_id=self.chat.id,
media=media, media=media,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id reply_to_message_id=reply_to_message_id
) )
@ -2167,6 +2215,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_photo( return await self._client.send_photo(
chat_id=self.chat.id, chat_id=self.chat.id,
photo=photo, photo=photo,
@ -2176,6 +2228,7 @@ class Message(Object, Update):
has_spoiler=has_spoiler, has_spoiler=has_spoiler,
ttl_seconds=ttl_seconds, ttl_seconds=ttl_seconds,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup, reply_markup=reply_markup,
progress=progress, progress=progress,
@ -2306,6 +2359,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_poll( return await self._client.send_poll(
chat_id=self.chat.id, chat_id=self.chat.id,
question=question, question=question,
@ -2322,6 +2379,7 @@ class Message(Object, Update):
is_closed=is_closed, is_closed=is_closed,
disable_notification=disable_notification, disable_notification=disable_notification,
protect_content=protect_content, protect_content=protect_content,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
schedule_date=schedule_date, schedule_date=schedule_date,
reply_markup=reply_markup reply_markup=reply_markup
@ -2417,10 +2475,15 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_sticker( return await self._client.send_sticker(
chat_id=self.chat.id, chat_id=self.chat.id,
sticker=sticker, sticker=sticker,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup, reply_markup=reply_markup,
progress=progress, progress=progress,
@ -2512,6 +2575,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_venue( return await self._client.send_venue(
chat_id=self.chat.id, chat_id=self.chat.id,
latitude=latitude, latitude=latitude,
@ -2521,6 +2588,7 @@ class Message(Object, Update):
foursquare_id=foursquare_id, foursquare_id=foursquare_id,
foursquare_type=foursquare_type, foursquare_type=foursquare_type,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup reply_markup=reply_markup
) )
@ -2666,6 +2734,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_video( return await self._client.send_video(
chat_id=self.chat.id, chat_id=self.chat.id,
video=video, video=video,
@ -2681,6 +2753,7 @@ class Message(Object, Update):
file_name=file_name, file_name=file_name,
supports_streaming=supports_streaming, supports_streaming=supports_streaming,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup, reply_markup=reply_markup,
progress=progress, progress=progress,
@ -2792,6 +2865,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_video_note( return await self._client.send_video_note(
chat_id=self.chat.id, chat_id=self.chat.id,
video_note=video_note, video_note=video_note,
@ -2799,6 +2876,7 @@ class Message(Object, Update):
length=length, length=length,
thumb=thumb, thumb=thumb,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup, reply_markup=reply_markup,
progress=progress, progress=progress,
@ -2912,6 +2990,10 @@ class Message(Object, Update):
if reply_to_message_id is None and quote: if reply_to_message_id is None and quote:
reply_to_message_id = self.id reply_to_message_id = self.id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
return await self._client.send_voice( return await self._client.send_voice(
chat_id=self.chat.id, chat_id=self.chat.id,
voice=voice, voice=voice,
@ -2920,6 +3002,7 @@ class Message(Object, Update):
caption_entities=caption_entities, caption_entities=caption_entities,
duration=duration, duration=duration,
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup, reply_markup=reply_markup,
progress=progress, progress=progress,