mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
fixed checks x1
This commit is contained in:
parent
2e5fb10430
commit
3e0d69f7f4
@ -2219,6 +2219,45 @@ class KeyboardButtonPollType(Dictionaryable):
|
|||||||
return {'type': self.type}
|
return {'type': self.type}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class KeyboardButtonRequestUser(Dictionaryable):
|
||||||
|
"""
|
||||||
|
This object defines the criteria used to request a suitable user.
|
||||||
|
The identifier of the selected user will be shared with the bot when the corresponding button is pressed.
|
||||||
|
|
||||||
|
Telegram documentation: https://core.telegram.org/bots/api#keyboardbuttonrequestuser
|
||||||
|
|
||||||
|
:param request_id: Signed 32-bit identifier of the request, which will be received back in the UserShared object.
|
||||||
|
Must be unique within the message
|
||||||
|
:type request_id: :obj:`int`
|
||||||
|
|
||||||
|
:param user_is_bot: Optional. Pass True to request a bot, pass False to request a regular user.
|
||||||
|
If not specified, no additional restrictions are applied.
|
||||||
|
:type user_is_bot: :obj:`bool`
|
||||||
|
|
||||||
|
:param user_is_premium: Optional. Pass True to request a premium user, pass False to request a non-premium user.
|
||||||
|
If not specified, no additional restrictions are applied.
|
||||||
|
:type user_is_premium: :obj:`bool`
|
||||||
|
|
||||||
|
:return: Instance of the class
|
||||||
|
:rtype: :class:`telebot.types.KeyboardButtonRequestUser`
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, request_id: int, user_is_bot: Optional[bool]=None, user_is_premium: Optional[bool]=None) -> None:
|
||||||
|
self.request_id: int = request_id
|
||||||
|
self.user_is_bot: Optional[bool] = user_is_bot
|
||||||
|
self.user_is_premium: Optional[bool] = user_is_premium
|
||||||
|
|
||||||
|
def to_dict(self) -> dict:
|
||||||
|
data = {'request_id': self.request_id}
|
||||||
|
if self.user_is_bot is not None:
|
||||||
|
data['user_is_bot'] = self.user_is_bot
|
||||||
|
if self.user_is_premium is not None:
|
||||||
|
data['user_is_premium'] = self.user_is_premium
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
class KeyboardButton(Dictionaryable, JsonSerializable):
|
class KeyboardButton(Dictionaryable, JsonSerializable):
|
||||||
"""
|
"""
|
||||||
This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields web_app, request_contact, request_location, and request_poll are mutually exclusive.
|
This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields web_app, request_contact, request_location, and request_poll are mutually exclusive.
|
||||||
@ -7019,41 +7058,3 @@ class WriteAccessAllowed(JsonDeserializable):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class KeyboardButtonRequestUser(Dictionaryable):
|
|
||||||
"""
|
|
||||||
This object defines the criteria used to request a suitable user.
|
|
||||||
The identifier of the selected user will be shared with the bot when the corresponding button is pressed.
|
|
||||||
|
|
||||||
Telegram documentation: https://core.telegram.org/bots/api#keyboardbuttonrequestuser
|
|
||||||
|
|
||||||
:param request_id: Signed 32-bit identifier of the request, which will be received back in the UserShared object.
|
|
||||||
Must be unique within the message
|
|
||||||
:type request_id: :obj:`int`
|
|
||||||
|
|
||||||
:param user_is_bot: Optional. Pass True to request a bot, pass False to request a regular user.
|
|
||||||
If not specified, no additional restrictions are applied.
|
|
||||||
:type user_is_bot: :obj:`bool`
|
|
||||||
|
|
||||||
:param user_is_premium: Optional. Pass True to request a premium user, pass False to request a non-premium user.
|
|
||||||
If not specified, no additional restrictions are applied.
|
|
||||||
:type user_is_premium: :obj:`bool`
|
|
||||||
|
|
||||||
:return: Instance of the class
|
|
||||||
:rtype: :class:`telebot.types.KeyboardButtonRequestUser`
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, request_id: int, user_is_bot: Optional[bool]=None, user_is_premium: Optional[bool]=None) -> None:
|
|
||||||
self.request_id: int = request_id
|
|
||||||
self.user_is_bot: Optional[bool] = user_is_bot
|
|
||||||
self.user_is_premium: Optional[bool] = user_is_premium
|
|
||||||
|
|
||||||
def to_dict(self) -> dict:
|
|
||||||
data = {'request_id': self.request_id}
|
|
||||||
if self.user_is_bot is not None:
|
|
||||||
data['user_is_bot'] = self.user_is_bot
|
|
||||||
if self.user_is_premium is not None:
|
|
||||||
data['user_is_premium'] = self.user_is_premium
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user