Skip to content

Commit

Permalink
Pyrofork: Update send_message to layer 160
Browse files Browse the repository at this point in the history
Signed-off-by: wulan17 <wulan17@nusantararom.org>
  • Loading branch information
wulan17 committed Jul 21, 2023
1 parent 301582e commit aec565d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pyrogram/methods/messages/send_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,25 @@ async def send_message(

message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values()

reply_to = None
if reply_to_message_id or message_thread_id:
if message_thread_id and not reply_to_message_id:
reply_to_msg_id = message_thread_id
top_msg_id = None
elif message_thread_id and reply_to_message_id:
reply_to_msg_id = reply_to_message_id
top_msg_id = message_thread_id
else:
reply_to_msg_id = reply_to_message_id
top_msg_id = None
reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id)

r = await self.invoke(
raw.functions.messages.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 or message_thread_id,
reply_to=reply_to,
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,
Expand Down

0 comments on commit aec565d

Please sign in to comment.