Expose more raw API params in friendly methods (#3104)

This commit is contained in:
Devesh Pal
2021-08-05 14:24:07 +05:30
committed by GitHub
parent ad55b945c1
commit e5599c178b
4 changed files with 53 additions and 12 deletions

View File

@@ -245,17 +245,29 @@ class Button:
resize=resize, single_use=single_use, selective=selective)
@staticmethod
def clear():
def clear(selective=None):
"""
Clears all keyboard buttons after sending a message with this markup.
When used, no other button should be present or it will be ignored.
``selective`` is as documented in `text`.
"""
return types.ReplyKeyboardHide()
return types.ReplyKeyboardHide(selective=selective)
@staticmethod
def force_reply():
def force_reply(single_use=None, selective=None, placeholder=None):
"""
Forces a reply to the message with this markup. If used,
no other button should be present or it will be ignored.
``single_use`` and ``selective`` are as documented in `text`.
Args:
placeholder (str):
text to show the user at typing place of message.
"""
return types.ReplyKeyboardForceReply()
return types.ReplyKeyboardForceReply(
single_use=single_use,
selective=selective,
placeholder=placeholder)

View File

@@ -103,7 +103,8 @@ class InlineResult:
return self.result.document
async def click(self, entity=None, reply_to=None, comment_to=None,
silent=False, clear_draft=False, hide_via=False):
silent=False, clear_draft=False, hide_via=False,
background=None):
"""
Clicks this result and sends the associated `message`.
@@ -128,10 +129,14 @@ class InlineResult:
clear_draft (`bool`, optional):
Whether the draft should be removed after sending the
message from this result or not. Defaults to `False`.
hide_via (`bool`, optional):
Whether the "via @bot" should be hidden or not.
Only works with certain bots (like @bing or @gif).
background (`bool`, optional):
Whether the message should be send in background.
"""
if entity:
entity = await self._client.get_input_entity(entity)
@@ -150,6 +155,7 @@ class InlineResult:
query_id=self._query_id,
id=self.result.id,
silent=silent,
background=background,
clear_draft=clear_draft,
hide_via=hide_via,
reply_to_msg_id=reply_id