also, add inline_mention function

This commit is contained in:
Shrimadhav U K 2022-02-18 15:09:37 +05:30 committed by GitHub
parent 9bc163a045
commit d96e4dabe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -170,7 +170,11 @@ class Button:
) )
@staticmethod @staticmethod
def mention(is_inline: bool, text, input_entity=None): def inline_mention(text, input_entity=None):
return mention(text, input_entity, True)
@staticmethod
def mention(text, input_entity=None, is_inline: bool=False):
""" """
Creates a new inline button linked to the profile of user. Creates a new inline button linked to the profile of user.
@ -179,9 +183,6 @@ class Button:
Older clients will display unsupported message. Older clients will display unsupported message.
Args: Args:
is_inline:
whether to create inline / keyboard buttons
text: text:
Label text on the button Label text on the button
@ -195,6 +196,9 @@ class Button:
For now, you cannot use ID or username for this argument. For now, you cannot use ID or username for this argument.
If you want to use different user, you must manually use If you want to use different user, you must manually use
`client.get_input_entity() <telethon.client.users.UserMethods.get_input_entity>`. `client.get_input_entity() <telethon.client.users.UserMethods.get_input_entity>`.
is_inline:
whether to create inline / keyboard buttons
""" """
if is_inline: if is_inline:
return _tl.InputKeyboardButtonUserProfile( return _tl.InputKeyboardButtonUserProfile(
@ -433,3 +437,4 @@ def build_reply_markup(
# elif is_normal: # elif is_normal:
return _tl.ReplyKeyboardMarkup( return _tl.ReplyKeyboardMarkup(
rows, resize=resize, single_use=single_use, selective=selective) rows, resize=resize, single_use=single_use, selective=selective)