Skip to content

Commit

Permalink
Add comment_to to InlineResult-click method (#3118)
Browse files Browse the repository at this point in the history
  • Loading branch information
New-dev0 committed Aug 3, 2021
1 parent 196cef6 commit ad55b94
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions telethon/tl/custom/inlineresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def document(self):
elif isinstance(self.result, types.BotInlineMediaResult):
return self.result.document

async def click(self, entity=None, reply_to=None,
async def click(self, entity=None, reply_to=None, comment_to=None,
silent=False, clear_draft=False, hide_via=False):
"""
Clicks this result and sends the associated `message`.
Expand All @@ -114,6 +114,11 @@ async def click(self, entity=None, reply_to=None,
reply_to (`int` | `Message <telethon.tl.custom.message.Message>`, optional):
If present, the sent message will reply to this ID or message.
comment_to (`int` | `Message <telethon.tl.custom.message.Message>`, optional):
Similar to ``reply_to``, but replies in the linked group of a
broadcast channel instead (effectively leaving a "comment to"
the specified message).
silent (`bool`, optional):
Whether the message should notify people with sound or not.
Defaults to `False` (send with a notification sound unless
Expand All @@ -135,7 +140,11 @@ async def click(self, entity=None, reply_to=None,
else:
raise ValueError('You must provide the entity where the result should be sent to')

reply_id = None if reply_to is None else utils.get_message_id(reply_to)
if comment_to:
entity, reply_id = await self._client._get_comment_data(entity, comment_to)
else:
reply_id = None if reply_to is None else utils.get_message_id(reply_to)

req = functions.messages.SendInlineBotResultRequest(
peer=entity,
query_id=self._query_id,
Expand Down

0 comments on commit ad55b94

Please sign in to comment.