Fix reply_to can be optional

This commit is contained in:
Lonami Exo 2023-07-21 22:44:35 +02:00
parent 75ed58ad89
commit 164d35681e
3 changed files with 7 additions and 4 deletions

View File

@ -838,6 +838,8 @@ class MessageMethods:
entity = await self.get_input_entity(entity)
if comment_to is not None:
entity, reply_to = await self._get_comment_data(entity, comment_to)
else:
reply_to = utils.get_message_id(reply_to)
if isinstance(message, types.Message):
if buttons is None:
@ -868,7 +870,7 @@ class MessageMethods:
message=message.message or '',
silent=silent,
background=background,
reply_to=types.InputReplyToMessage(utils.get_message_id(reply_to)),
reply_to=None if reply_to is None else types.InputReplyToMessage(reply_to),
reply_markup=markup,
entities=message.entities,
clear_draft=clear_draft,
@ -890,7 +892,7 @@ class MessageMethods:
message=message,
entities=formatting_entities,
no_webpage=not link_preview,
reply_to=types.InputReplyToMessage(utils.get_message_id(reply_to)),
reply_to=None if reply_to is None else types.InputReplyToMessage(reply_to),
clear_draft=clear_draft,
silent=silent,
background=background,

View File

@ -408,8 +408,9 @@ class UploadMethods:
raise TypeError('Cannot use {!r} as file'.format(file))
markup = self.build_reply_markup(buttons)
reply_to = None if reply_to is None else types.InputReplyToMessage(reply_to)
request = functions.messages.SendMediaRequest(
entity, media, reply_to=types.InputReplyToMessage(reply_to), message=caption,
entity, media, reply_to=reply_to, message=caption,
entities=msg_entities, reply_markup=markup, silent=silent,
schedule_date=schedule, clear_draft=clear_draft,
background=background

View File

@ -158,7 +158,7 @@ class InlineResult:
background=background,
clear_draft=clear_draft,
hide_via=hide_via,
reply_to=types.InputReplyToMessage(reply_id)
reply_to=None if reply_id is None else types.InputReplyToMessage(reply_id)
)
return self._client._get_response_message(
req, await self._client(req), entity)