mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-22 14:35:00 +01:00
Remove telegram.ReplyMarkup (#2870)
This commit is contained in:
parent
0ccd7d40ac
commit
8560af9c4f
37 changed files with 249 additions and 225 deletions
|
@ -1,8 +0,0 @@
|
||||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/replymarkup.py
|
|
||||||
|
|
||||||
telegram.ReplyMarkup
|
|
||||||
====================
|
|
||||||
|
|
||||||
.. autoclass:: telegram.ReplyMarkup
|
|
||||||
:members:
|
|
||||||
:show-inheritance:
|
|
|
@ -59,7 +59,6 @@ telegram package
|
||||||
telegram.proximityalerttriggered
|
telegram.proximityalerttriggered
|
||||||
telegram.replykeyboardremove
|
telegram.replykeyboardremove
|
||||||
telegram.replykeyboardmarkup
|
telegram.replykeyboardmarkup
|
||||||
telegram.replymarkup
|
|
||||||
telegram.telegramobject
|
telegram.telegramobject
|
||||||
telegram.update
|
telegram.update
|
||||||
telegram.user
|
telegram.user
|
||||||
|
|
|
@ -137,7 +137,6 @@ __all__ = ( # Keep this alphabetically ordered
|
||||||
'ProximityAlertTriggered',
|
'ProximityAlertTriggered',
|
||||||
'ReplyKeyboardMarkup',
|
'ReplyKeyboardMarkup',
|
||||||
'ReplyKeyboardRemove',
|
'ReplyKeyboardRemove',
|
||||||
'ReplyMarkup',
|
|
||||||
'request',
|
'request',
|
||||||
'ResidentialAddress',
|
'ResidentialAddress',
|
||||||
'SecureData',
|
'SecureData',
|
||||||
|
@ -199,7 +198,6 @@ from ._dice import Dice
|
||||||
from ._userprofilephotos import UserProfilePhotos
|
from ._userprofilephotos import UserProfilePhotos
|
||||||
from ._keyboardbuttonpolltype import KeyboardButtonPollType
|
from ._keyboardbuttonpolltype import KeyboardButtonPollType
|
||||||
from ._keyboardbutton import KeyboardButton
|
from ._keyboardbutton import KeyboardButton
|
||||||
from ._replymarkup import ReplyMarkup
|
|
||||||
from ._replykeyboardmarkup import ReplyKeyboardMarkup
|
from ._replykeyboardmarkup import ReplyKeyboardMarkup
|
||||||
from ._replykeyboardremove import ReplyKeyboardRemove
|
from ._replykeyboardremove import ReplyKeyboardRemove
|
||||||
from ._forcereply import ForceReply
|
from ._forcereply import ForceReply
|
||||||
|
|
120
telegram/_bot.py
120
telegram/_bot.py
|
@ -75,7 +75,6 @@ from telegram import (
|
||||||
PassportElementError,
|
PassportElementError,
|
||||||
PhotoSize,
|
PhotoSize,
|
||||||
Poll,
|
Poll,
|
||||||
ReplyMarkup,
|
|
||||||
ShippingOption,
|
ShippingOption,
|
||||||
Sticker,
|
Sticker,
|
||||||
StickerSet,
|
StickerSet,
|
||||||
|
@ -90,6 +89,9 @@ from telegram import (
|
||||||
WebhookInfo,
|
WebhookInfo,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
ChatInviteLink,
|
ChatInviteLink,
|
||||||
|
ReplyKeyboardMarkup,
|
||||||
|
ReplyKeyboardRemove,
|
||||||
|
ForceReply,
|
||||||
)
|
)
|
||||||
from telegram.error import InvalidToken, TelegramError
|
from telegram.error import InvalidToken, TelegramError
|
||||||
from telegram.constants import InlineQueryLimit
|
from telegram.constants import InlineQueryLimit
|
||||||
|
@ -97,7 +99,7 @@ from telegram.request import Request
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE, DefaultValue, DEFAULT_20
|
from telegram._utils.defaultvalue import DEFAULT_NONE, DefaultValue, DEFAULT_20
|
||||||
from telegram._utils.datetime import to_timestamp
|
from telegram._utils.datetime import to_timestamp
|
||||||
from telegram._utils.files import is_local_file, parse_file_input
|
from telegram._utils.files import is_local_file, parse_file_input
|
||||||
from telegram._utils.types import FileInput, JSONDict, ODVInput, DVInput
|
from telegram._utils.types import FileInput, JSONDict, ODVInput, DVInput, ReplyMarkup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import (
|
from telegram import (
|
||||||
|
@ -291,7 +293,8 @@ class Bot(TelegramObject):
|
||||||
data['protect_content'] = protect_content
|
data['protect_content'] = protect_content
|
||||||
|
|
||||||
if reply_markup is not None:
|
if reply_markup is not None:
|
||||||
if isinstance(reply_markup, ReplyMarkup):
|
markups = (InlineKeyboardMarkup, ReplyKeyboardMarkup, ForceReply, ReplyKeyboardRemove)
|
||||||
|
if isinstance(reply_markup, markups):
|
||||||
# We need to_json() instead of to_dict() here, because reply_markups may be
|
# We need to_json() instead of to_dict() here, because reply_markups may be
|
||||||
# attached to media messages, which aren't json dumped by telegram.request
|
# attached to media messages, which aren't json dumped by telegram.request
|
||||||
data['reply_markup'] = reply_markup.to_json()
|
data['reply_markup'] = reply_markup.to_json()
|
||||||
|
@ -439,9 +442,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard,
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
instructions to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
||||||
the read timeout from the server (instead of the one specified during creation of
|
the read timeout from the server (instead of the one specified during creation of
|
||||||
the connection pool).
|
the connection pool).
|
||||||
|
@ -647,9 +651,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard, instructions
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
|
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
|
||||||
api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the
|
api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the
|
||||||
Telegram API.
|
Telegram API.
|
||||||
|
@ -760,9 +765,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard, instructions
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
thumb (`filelike object` | :obj:`bytes` | :class:`pathlib.Path`, optional): Thumbnail
|
thumb (`filelike object` | :obj:`bytes` | :class:`pathlib.Path`, optional): Thumbnail
|
||||||
of the file sent; can be ignored if
|
of the file sent; can be ignored if
|
||||||
thumbnail generation for the file is supported server-side. The thumbnail should be
|
thumbnail generation for the file is supported server-side. The thumbnail should be
|
||||||
|
@ -882,9 +888,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard, instructions
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
thumb (`filelike object` | :obj:`bytes` | :class:`pathlib.Path`, optional): Thumbnail
|
thumb (`filelike object` | :obj:`bytes` | :class:`pathlib.Path`, optional): Thumbnail
|
||||||
of the file sent; can be ignored if
|
of the file sent; can be ignored if
|
||||||
thumbnail generation for the file is supported server-side. The thumbnail should be
|
thumbnail generation for the file is supported server-side. The thumbnail should be
|
||||||
|
@ -976,9 +983,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard, instructions
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
|
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
|
||||||
api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the
|
api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the
|
||||||
Telegram API.
|
Telegram API.
|
||||||
|
@ -1083,9 +1091,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard, instructions
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
thumb (`filelike object` | :obj:`bytes` | :class:`pathlib.Path`, optional): Thumbnail
|
thumb (`filelike object` | :obj:`bytes` | :class:`pathlib.Path`, optional): Thumbnail
|
||||||
of the file sent; can be ignored if
|
of the file sent; can be ignored if
|
||||||
thumbnail generation for the file is supported server-side. The thumbnail should be
|
thumbnail generation for the file is supported server-side. The thumbnail should be
|
||||||
|
@ -1198,9 +1207,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard,
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
instructions to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
thumb (`filelike object` | :obj:`bytes` | :class:`pathlib.Path`, optional): Thumbnail
|
thumb (`filelike object` | :obj:`bytes` | :class:`pathlib.Path`, optional): Thumbnail
|
||||||
of the file sent; can be ignored if
|
of the file sent; can be ignored if
|
||||||
thumbnail generation for the file is supported server-side. The thumbnail should be
|
thumbnail generation for the file is supported server-side. The thumbnail should be
|
||||||
|
@ -1327,9 +1337,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard, instructions
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
|
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
|
||||||
api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the
|
api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the
|
||||||
Telegram API.
|
Telegram API.
|
||||||
|
@ -1439,9 +1450,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard,
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
instructions to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
|
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
|
||||||
api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the
|
api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the
|
||||||
Telegram API.
|
Telegram API.
|
||||||
|
@ -1589,9 +1601,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard,
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
instructions to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
||||||
the read timeout from the server (instead of the one specified during creation of
|
the read timeout from the server (instead of the one specified during creation of
|
||||||
the connection pool).
|
the connection pool).
|
||||||
|
@ -1840,9 +1853,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard, instructions
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
||||||
the read timeout from the server (instead of the one specified during creation of
|
the read timeout from the server (instead of the one specified during creation of
|
||||||
the connection pool).
|
the connection pool).
|
||||||
|
@ -1944,9 +1958,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard, instructions
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
||||||
the read timeout from the server (instead of the one specified during creation of
|
the read timeout from the server (instead of the one specified during creation of
|
||||||
the connection pool).
|
the connection pool).
|
||||||
|
@ -5106,9 +5121,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard, instructions
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
||||||
the read timeout from the server (instead of the one specified during creation of
|
the read timeout from the server (instead of the one specified during creation of
|
||||||
the connection pool).
|
the connection pool).
|
||||||
|
@ -5194,7 +5210,8 @@ class Bot(TelegramObject):
|
||||||
data: JSONDict = {'chat_id': chat_id, 'message_id': message_id}
|
data: JSONDict = {'chat_id': chat_id, 'message_id': message_id}
|
||||||
|
|
||||||
if reply_markup:
|
if reply_markup:
|
||||||
if isinstance(reply_markup, ReplyMarkup):
|
markups = (InlineKeyboardMarkup, ReplyKeyboardMarkup, ForceReply, ReplyKeyboardRemove)
|
||||||
|
if isinstance(reply_markup, markups):
|
||||||
# We need to_json() instead of to_dict() here, because reply_markups may be
|
# We need to_json() instead of to_dict() here, because reply_markups may be
|
||||||
# attached to media messages, which aren't json dumped by telegram.request
|
# attached to media messages, which aren't json dumped by telegram.request
|
||||||
data['reply_markup'] = reply_markup.to_json()
|
data['reply_markup'] = reply_markup.to_json()
|
||||||
|
@ -5247,9 +5264,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard, instructions
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
||||||
the read timeout from the server (instead of the one specified during creation of
|
the read timeout from the server (instead of the one specified during creation of
|
||||||
the connection pool).
|
the connection pool).
|
||||||
|
@ -5523,9 +5541,10 @@ class Bot(TelegramObject):
|
||||||
original message.
|
original message.
|
||||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||||
should be sent even if the specified replied-to message is not found.
|
should be sent even if the specified replied-to message is not found.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options.
|
reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
|
||||||
An object for an inline keyboard, custom reply keyboard,
|
:class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
|
||||||
instructions to remove reply keyboard or to force a reply from the user.
|
Additional interface options. An object for an inline keyboard, custom reply
|
||||||
|
keyboard, instructions to remove reply keyboard or to force a reply from the user.
|
||||||
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
||||||
the read timeout from the server (instead of the one specified during creation of
|
the read timeout from the server (instead of the one specified during creation of
|
||||||
the connection pool).
|
the connection pool).
|
||||||
|
@ -5554,7 +5573,8 @@ class Bot(TelegramObject):
|
||||||
if reply_to_message_id:
|
if reply_to_message_id:
|
||||||
data['reply_to_message_id'] = reply_to_message_id
|
data['reply_to_message_id'] = reply_to_message_id
|
||||||
if reply_markup:
|
if reply_markup:
|
||||||
if isinstance(reply_markup, ReplyMarkup):
|
markups = (InlineKeyboardMarkup, ReplyKeyboardMarkup, ForceReply, ReplyKeyboardRemove)
|
||||||
|
if isinstance(reply_markup, markups):
|
||||||
# We need to_json() instead of to_dict() here, because reply_markups may be
|
# We need to_json() instead of to_dict() here, because reply_markups may be
|
||||||
# attached to media messages, which aren't json dumped by telegram.request
|
# attached to media messages, which aren't json dumped by telegram.request
|
||||||
data['reply_markup'] = reply_markup.to_json()
|
data['reply_markup'] = reply_markup.to_json()
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
"""This module contains an object that represents a Telegram CallbackQuery"""
|
"""This module contains an object that represents a Telegram CallbackQuery"""
|
||||||
from typing import TYPE_CHECKING, Any, List, Optional, Union, Tuple, ClassVar
|
from typing import TYPE_CHECKING, Any, List, Optional, Union, Tuple, ClassVar
|
||||||
|
|
||||||
from telegram import Message, TelegramObject, User, Location, ReplyMarkup, constants
|
from telegram import Message, TelegramObject, User, Location, constants
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import JSONDict, ODVInput, DVInput
|
from telegram._utils.types import JSONDict, ODVInput, DVInput, ReplyMarkup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import (
|
from telegram import (
|
||||||
|
|
|
@ -22,7 +22,7 @@ from datetime import datetime
|
||||||
from typing import TYPE_CHECKING, List, Optional, ClassVar, Union, Tuple, Any
|
from typing import TYPE_CHECKING, List, Optional, ClassVar, Union, Tuple, Any
|
||||||
|
|
||||||
from telegram import ChatPhoto, TelegramObject, constants
|
from telegram import ChatPhoto, TelegramObject, constants
|
||||||
from telegram._utils.types import JSONDict, FileInput, ODVInput, DVInput
|
from telegram._utils.types import JSONDict, FileInput, ODVInput, DVInput, ReplyMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE, DEFAULT_20
|
from telegram._utils.defaultvalue import DEFAULT_NONE, DEFAULT_20
|
||||||
|
|
||||||
from telegram._chatpermissions import ChatPermissions
|
from telegram._chatpermissions import ChatPermissions
|
||||||
|
@ -35,7 +35,6 @@ if TYPE_CHECKING:
|
||||||
ChatInviteLink,
|
ChatInviteLink,
|
||||||
Message,
|
Message,
|
||||||
MessageId,
|
MessageId,
|
||||||
ReplyMarkup,
|
|
||||||
Contact,
|
Contact,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
Location,
|
Location,
|
||||||
|
@ -740,7 +739,7 @@ class Chat(TelegramObject):
|
||||||
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||||
|
@ -837,7 +836,7 @@ class Chat(TelegramObject):
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
|
@ -879,7 +878,7 @@ class Chat(TelegramObject):
|
||||||
last_name: str = None,
|
last_name: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
contact: 'Contact' = None,
|
contact: 'Contact' = None,
|
||||||
vcard: str = None,
|
vcard: str = None,
|
||||||
|
@ -922,7 +921,7 @@ class Chat(TelegramObject):
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
thumb: FileInput = None,
|
thumb: FileInput = None,
|
||||||
|
@ -969,7 +968,7 @@ class Chat(TelegramObject):
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
thumb: FileInput = None,
|
thumb: FileInput = None,
|
||||||
|
@ -1011,7 +1010,7 @@ class Chat(TelegramObject):
|
||||||
self,
|
self,
|
||||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
emoji: str = None,
|
emoji: str = None,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
|
@ -1160,7 +1159,7 @@ class Chat(TelegramObject):
|
||||||
longitude: float = None,
|
longitude: float = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
location: 'Location' = None,
|
location: 'Location' = None,
|
||||||
live_period: int = None,
|
live_period: int = None,
|
||||||
|
@ -1210,7 +1209,7 @@ class Chat(TelegramObject):
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||||
|
@ -1253,7 +1252,7 @@ class Chat(TelegramObject):
|
||||||
sticker: Union[FileInput, 'Sticker'],
|
sticker: Union[FileInput, 'Sticker'],
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||||
|
@ -1290,7 +1289,7 @@ class Chat(TelegramObject):
|
||||||
foursquare_id: str = None,
|
foursquare_id: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
venue: 'Venue' = None,
|
venue: 'Venue' = None,
|
||||||
foursquare_type: str = None,
|
foursquare_type: str = None,
|
||||||
|
@ -1337,7 +1336,7 @@ class Chat(TelegramObject):
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
width: int = None,
|
width: int = None,
|
||||||
height: int = None,
|
height: int = None,
|
||||||
|
@ -1388,7 +1387,7 @@ class Chat(TelegramObject):
|
||||||
length: int = None,
|
length: int = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
thumb: FileInput = None,
|
thumb: FileInput = None,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
|
@ -1429,7 +1428,7 @@ class Chat(TelegramObject):
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
|
@ -1477,7 +1476,7 @@ class Chat(TelegramObject):
|
||||||
is_closed: bool = None,
|
is_closed: bool = None,
|
||||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
explanation: str = None,
|
explanation: str = None,
|
||||||
explanation_parse_mode: ODVInput[str] = DEFAULT_NONE,
|
explanation_parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
|
@ -1531,7 +1530,7 @@ class Chat(TelegramObject):
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||||
|
@ -1572,7 +1571,7 @@ class Chat(TelegramObject):
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from telegram import ReplyMarkup
|
from telegram import TelegramObject
|
||||||
|
|
||||||
|
|
||||||
class ForceReply(ReplyMarkup):
|
class ForceReply(TelegramObject):
|
||||||
"""
|
"""
|
||||||
Upon receiving a message with this object, Telegram clients will display a reply interface to
|
Upon receiving a message with this object, Telegram clients will display a reply interface to
|
||||||
the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be
|
the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be
|
||||||
|
|
|
@ -20,19 +20,20 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, List, Optional
|
from typing import TYPE_CHECKING, Any, List, Optional
|
||||||
|
|
||||||
from telegram import InlineKeyboardButton, ReplyMarkup
|
from telegram import InlineKeyboardButton, TelegramObject
|
||||||
from telegram._utils.types import JSONDict
|
from telegram._utils.types import JSONDict
|
||||||
|
from telegram._utils.markup import check_keyboard_type
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import Bot
|
from telegram import Bot
|
||||||
|
|
||||||
|
|
||||||
class InlineKeyboardMarkup(ReplyMarkup):
|
class InlineKeyboardMarkup(TelegramObject):
|
||||||
"""
|
"""
|
||||||
This object represents an inline keyboard that appears right next to the message it belongs to.
|
This object represents an inline keyboard that appears right next to the message it belongs to.
|
||||||
|
|
||||||
Objects of this class are comparable in terms of equality. Two objects of this class are
|
Objects of this class are comparable in terms of equality. Two objects of this class are
|
||||||
considered equal, if their the size of :attr:`inline_keyboard` and all the buttons are equal.
|
considered equal, if their size of :attr:`inline_keyboard` and all the buttons are equal.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
inline_keyboard (List[List[:class:`telegram.InlineKeyboardButton`]]): List of button rows,
|
inline_keyboard (List[List[:class:`telegram.InlineKeyboardButton`]]): List of button rows,
|
||||||
|
@ -48,7 +49,7 @@ class InlineKeyboardMarkup(ReplyMarkup):
|
||||||
__slots__ = ('inline_keyboard',)
|
__slots__ = ('inline_keyboard',)
|
||||||
|
|
||||||
def __init__(self, inline_keyboard: List[List[InlineKeyboardButton]], **_kwargs: Any):
|
def __init__(self, inline_keyboard: List[List[InlineKeyboardButton]], **_kwargs: Any):
|
||||||
if not self._check_keyboard_type(inline_keyboard):
|
if not check_keyboard_type(inline_keyboard):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"The parameter `inline_keyboard` should be a list of "
|
"The parameter `inline_keyboard` should be a list of "
|
||||||
"list of InlineKeyboardButtons"
|
"list of InlineKeyboardButtons"
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from telegram import InlineQueryResult
|
from telegram import InlineQueryResult, InlineKeyboardMarkup
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultArticle(InlineQueryResult):
|
class InlineQueryResultArticle(InlineQueryResult):
|
||||||
|
@ -35,8 +35,8 @@ class InlineQueryResultArticle(InlineQueryResult):
|
||||||
title (:obj:`str`): Title of the result.
|
title (:obj:`str`): Title of the result.
|
||||||
input_message_content (:class:`telegram.InputMessageContent`): Content of the message to
|
input_message_content (:class:`telegram.InputMessageContent`): Content of the message to
|
||||||
be sent.
|
be sent.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): Inline keyboard attached to
|
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||||
the message
|
to the message.
|
||||||
url (:obj:`str`, optional): URL of the result.
|
url (:obj:`str`, optional): URL of the result.
|
||||||
hide_url (:obj:`bool`, optional): Pass :obj:`True`, if you don't want the URL to be shown
|
hide_url (:obj:`bool`, optional): Pass :obj:`True`, if you don't want the URL to be shown
|
||||||
in the message.
|
in the message.
|
||||||
|
@ -52,8 +52,8 @@ class InlineQueryResultArticle(InlineQueryResult):
|
||||||
title (:obj:`str`): Title of the result.
|
title (:obj:`str`): Title of the result.
|
||||||
input_message_content (:class:`telegram.InputMessageContent`): Content of the message to
|
input_message_content (:class:`telegram.InputMessageContent`): Content of the message to
|
||||||
be sent.
|
be sent.
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`): Optional. Inline keyboard attached to
|
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||||
the message.
|
to the message.
|
||||||
url (:obj:`str`): Optional. URL of the result.
|
url (:obj:`str`): Optional. URL of the result.
|
||||||
hide_url (:obj:`bool`): Optional. Pass :obj:`True`, if you don't want the URL to be shown
|
hide_url (:obj:`bool`): Optional. Pass :obj:`True`, if you don't want the URL to be shown
|
||||||
in the message.
|
in the message.
|
||||||
|
@ -81,7 +81,7 @@ class InlineQueryResultArticle(InlineQueryResult):
|
||||||
id: str, # pylint: disable=redefined-builtin
|
id: str, # pylint: disable=redefined-builtin
|
||||||
title: str,
|
title: str,
|
||||||
input_message_content: 'InputMessageContent',
|
input_message_content: 'InputMessageContent',
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
url: str = None,
|
url: str = None,
|
||||||
hide_url: bool = None,
|
hide_url: bool = None,
|
||||||
description: str = None,
|
description: str = None,
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultAudio(InlineQueryResult):
|
class InlineQueryResultAudio(InlineQueryResult):
|
||||||
|
@ -99,7 +99,7 @@ class InlineQueryResultAudio(InlineQueryResult):
|
||||||
performer: str = None,
|
performer: str = None,
|
||||||
audio_duration: int = None,
|
audio_duration: int = None,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedAudio(InlineQueryResult):
|
class InlineQueryResultCachedAudio(InlineQueryResult):
|
||||||
|
@ -87,7 +87,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
|
||||||
id: str, # pylint: disable=redefined-builtin
|
id: str, # pylint: disable=redefined-builtin
|
||||||
audio_file_id: str,
|
audio_file_id: str,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedDocument(InlineQueryResult):
|
class InlineQueryResultCachedDocument(InlineQueryResult):
|
||||||
|
@ -96,7 +96,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
|
||||||
document_file_id: str,
|
document_file_id: str,
|
||||||
description: str = None,
|
description: str = None,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedGif(InlineQueryResult):
|
class InlineQueryResultCachedGif(InlineQueryResult):
|
||||||
|
@ -92,7 +92,7 @@ class InlineQueryResultCachedGif(InlineQueryResult):
|
||||||
gif_file_id: str,
|
gif_file_id: str,
|
||||||
title: str = None,
|
title: str = None,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
||||||
|
@ -92,7 +92,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
||||||
mpeg4_file_id: str,
|
mpeg4_file_id: str,
|
||||||
title: str = None,
|
title: str = None,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedPhoto(InlineQueryResult):
|
class InlineQueryResultCachedPhoto(InlineQueryResult):
|
||||||
|
@ -97,7 +97,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
|
||||||
title: str = None,
|
title: str = None,
|
||||||
description: str = None,
|
description: str = None,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from telegram import InlineQueryResult
|
from telegram import InlineQueryResult, InlineKeyboardMarkup
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedSticker(InlineQueryResult):
|
class InlineQueryResultCachedSticker(InlineQueryResult):
|
||||||
|
@ -59,7 +59,7 @@ class InlineQueryResultCachedSticker(InlineQueryResult):
|
||||||
self,
|
self,
|
||||||
id: str, # pylint: disable=redefined-builtin
|
id: str, # pylint: disable=redefined-builtin
|
||||||
sticker_file_id: str,
|
sticker_file_id: str,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
**_kwargs: Any,
|
**_kwargs: Any,
|
||||||
):
|
):
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedVideo(InlineQueryResult):
|
class InlineQueryResultCachedVideo(InlineQueryResult):
|
||||||
|
@ -96,7 +96,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
|
||||||
title: str,
|
title: str,
|
||||||
description: str = None,
|
description: str = None,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedVoice(InlineQueryResult):
|
class InlineQueryResultCachedVoice(InlineQueryResult):
|
||||||
|
@ -91,7 +91,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
|
||||||
voice_file_id: str,
|
voice_file_id: str,
|
||||||
title: str,
|
title: str,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from telegram import InlineQueryResult
|
from telegram import InlineQueryResult, InlineKeyboardMarkup
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultContact(InlineQueryResult):
|
class InlineQueryResultContact(InlineQueryResult):
|
||||||
|
@ -85,7 +85,7 @@ class InlineQueryResultContact(InlineQueryResult):
|
||||||
phone_number: str,
|
phone_number: str,
|
||||||
first_name: str,
|
first_name: str,
|
||||||
last_name: str = None,
|
last_name: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
thumb_url: str = None,
|
thumb_url: str = None,
|
||||||
thumb_width: int = None,
|
thumb_width: int = None,
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultDocument(InlineQueryResult):
|
class InlineQueryResultDocument(InlineQueryResult):
|
||||||
|
@ -111,7 +111,7 @@ class InlineQueryResultDocument(InlineQueryResult):
|
||||||
mime_type: str,
|
mime_type: str,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
description: str = None,
|
description: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
thumb_url: str = None,
|
thumb_url: str = None,
|
||||||
thumb_width: int = None,
|
thumb_width: int = None,
|
||||||
|
|
|
@ -18,14 +18,11 @@
|
||||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||||
"""This module contains the classes that represent Telegram InlineQueryResultGame."""
|
"""This module contains the classes that represent Telegram InlineQueryResultGame."""
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import Any
|
||||||
|
|
||||||
from telegram import InlineQueryResult
|
from telegram import InlineQueryResult, InlineKeyboardMarkup
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from telegram import ReplyMarkup
|
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultGame(InlineQueryResult):
|
class InlineQueryResultGame(InlineQueryResult):
|
||||||
"""Represents a :class:`telegram.Game`.
|
"""Represents a :class:`telegram.Game`.
|
||||||
|
@ -52,7 +49,7 @@ class InlineQueryResultGame(InlineQueryResult):
|
||||||
self,
|
self,
|
||||||
id: str, # pylint: disable=redefined-builtin
|
id: str, # pylint: disable=redefined-builtin
|
||||||
game_short_name: str,
|
game_short_name: str,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
**_kwargs: Any,
|
**_kwargs: Any,
|
||||||
):
|
):
|
||||||
# Required
|
# Required
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultGif(InlineQueryResult):
|
class InlineQueryResultGif(InlineQueryResult):
|
||||||
|
@ -113,7 +113,7 @@ class InlineQueryResultGif(InlineQueryResult):
|
||||||
gif_height: int = None,
|
gif_height: int = None,
|
||||||
title: str = None,
|
title: str = None,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
gif_duration: int = None,
|
gif_duration: int = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from telegram import InlineQueryResult
|
from telegram import InlineQueryResult, InlineKeyboardMarkup
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultLocation(InlineQueryResult):
|
class InlineQueryResultLocation(InlineQueryResult):
|
||||||
|
@ -103,7 +103,7 @@ class InlineQueryResultLocation(InlineQueryResult):
|
||||||
longitude: float,
|
longitude: float,
|
||||||
title: str,
|
title: str,
|
||||||
live_period: int = None,
|
live_period: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
thumb_url: str = None,
|
thumb_url: str = None,
|
||||||
thumb_width: int = None,
|
thumb_width: int = None,
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
||||||
|
@ -112,7 +112,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
||||||
mpeg4_height: int = None,
|
mpeg4_height: int = None,
|
||||||
title: str = None,
|
title: str = None,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
mpeg4_duration: int = None,
|
mpeg4_duration: int = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultPhoto(InlineQueryResult):
|
class InlineQueryResultPhoto(InlineQueryResult):
|
||||||
|
@ -109,7 +109,7 @@ class InlineQueryResultPhoto(InlineQueryResult):
|
||||||
title: str = None,
|
title: str = None,
|
||||||
description: str = None,
|
description: str = None,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from telegram import InlineQueryResult
|
from telegram import InlineQueryResult, InlineKeyboardMarkup
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultVenue(InlineQueryResult):
|
class InlineQueryResultVenue(InlineQueryResult):
|
||||||
|
@ -105,7 +105,7 @@ class InlineQueryResultVenue(InlineQueryResult):
|
||||||
address: str,
|
address: str,
|
||||||
foursquare_id: str = None,
|
foursquare_id: str = None,
|
||||||
foursquare_type: str = None,
|
foursquare_type: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
thumb_url: str = None,
|
thumb_url: str = None,
|
||||||
thumb_width: int = None,
|
thumb_width: int = None,
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultVideo(InlineQueryResult):
|
class InlineQueryResultVideo(InlineQueryResult):
|
||||||
|
@ -124,7 +124,7 @@ class InlineQueryResultVideo(InlineQueryResult):
|
||||||
video_height: int = None,
|
video_height: int = None,
|
||||||
video_duration: int = None,
|
video_duration: int = None,
|
||||||
description: str = None,
|
description: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
from typing import TYPE_CHECKING, Any, Union, Tuple, List
|
||||||
|
|
||||||
from telegram import InlineQueryResult, MessageEntity
|
from telegram import InlineQueryResult, MessageEntity, InlineKeyboardMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||||
from telegram._utils.types import ODVInput
|
from telegram._utils.types import ODVInput
|
||||||
from telegram.constants import InlineQueryResultType
|
from telegram.constants import InlineQueryResultType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputMessageContent, ReplyMarkup
|
from telegram import InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultVoice(InlineQueryResult):
|
class InlineQueryResultVoice(InlineQueryResult):
|
||||||
|
@ -96,7 +96,7 @@ class InlineQueryResultVoice(InlineQueryResult):
|
||||||
title: str,
|
title: str,
|
||||||
voice_duration: int = None,
|
voice_duration: int = None,
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: InlineKeyboardMarkup = None,
|
||||||
input_message_content: 'InputMessageContent' = None,
|
input_message_content: 'InputMessageContent' = None,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
caption_entities: Union[Tuple[MessageEntity, ...], List[MessageEntity]] = None,
|
||||||
|
|
|
@ -50,7 +50,6 @@ from telegram import (
|
||||||
VoiceChatEnded,
|
VoiceChatEnded,
|
||||||
VoiceChatParticipantsInvited,
|
VoiceChatParticipantsInvited,
|
||||||
ProximityAlertTriggered,
|
ProximityAlertTriggered,
|
||||||
ReplyMarkup,
|
|
||||||
MessageAutoDeleteTimerChanged,
|
MessageAutoDeleteTimerChanged,
|
||||||
VoiceChatScheduled,
|
VoiceChatScheduled,
|
||||||
)
|
)
|
||||||
|
@ -58,7 +57,7 @@ from telegram.constants import ParseMode, MessageAttachmentType
|
||||||
from telegram.helpers import escape_markdown
|
from telegram.helpers import escape_markdown
|
||||||
from telegram._utils.datetime import from_timestamp, to_timestamp
|
from telegram._utils.datetime import from_timestamp, to_timestamp
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE, DEFAULT_20, DefaultValue
|
from telegram._utils.defaultvalue import DEFAULT_NONE, DEFAULT_20, DefaultValue
|
||||||
from telegram._utils.types import JSONDict, FileInput, ODVInput, DVInput
|
from telegram._utils.types import JSONDict, FileInput, ODVInput, DVInput, ReplyMarkup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import (
|
from telegram import (
|
||||||
|
|
|
@ -20,11 +20,12 @@
|
||||||
|
|
||||||
from typing import Any, List, Union, Sequence
|
from typing import Any, List, Union, Sequence
|
||||||
|
|
||||||
from telegram import KeyboardButton, ReplyMarkup
|
from telegram import KeyboardButton, TelegramObject
|
||||||
from telegram._utils.types import JSONDict
|
from telegram._utils.types import JSONDict
|
||||||
|
from telegram._utils.markup import check_keyboard_type
|
||||||
|
|
||||||
|
|
||||||
class ReplyKeyboardMarkup(ReplyMarkup):
|
class ReplyKeyboardMarkup(TelegramObject):
|
||||||
"""This object represents a custom keyboard with reply options.
|
"""This object represents a custom keyboard with reply options.
|
||||||
|
|
||||||
Objects of this class are comparable in terms of equality. Two objects of this class are
|
Objects of this class are comparable in terms of equality. Two objects of this class are
|
||||||
|
@ -92,7 +93,7 @@ class ReplyKeyboardMarkup(ReplyMarkup):
|
||||||
input_field_placeholder: str = None,
|
input_field_placeholder: str = None,
|
||||||
**_kwargs: Any,
|
**_kwargs: Any,
|
||||||
):
|
):
|
||||||
if not self._check_keyboard_type(keyboard):
|
if not check_keyboard_type(keyboard):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"The parameter `keyboard` should be a list of list of "
|
"The parameter `keyboard` should be a list of list of "
|
||||||
"strings or KeyboardButtons"
|
"strings or KeyboardButtons"
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
"""This module contains an object that represents a Telegram ReplyKeyboardRemove."""
|
"""This module contains an object that represents a Telegram ReplyKeyboardRemove."""
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from telegram import ReplyMarkup
|
from telegram import TelegramObject
|
||||||
|
|
||||||
|
|
||||||
class ReplyKeyboardRemove(ReplyMarkup):
|
class ReplyKeyboardRemove(TelegramObject):
|
||||||
"""
|
"""
|
||||||
Upon receiving a message with this object, Telegram clients will remove the current custom
|
Upon receiving a message with this object, Telegram clients will remove the current custom
|
||||||
keyboard and display the default letter-keyboard. By default, custom keyboards are displayed
|
keyboard and display the default letter-keyboard. By default, custom keyboards are displayed
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
# A library that provides a Python interface to the Telegram Bot API
|
|
||||||
# Copyright (C) 2015-2022
|
|
||||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Lesser Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Lesser Public License
|
|
||||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
|
||||||
"""Base class for Telegram ReplyMarkup Objects."""
|
|
||||||
from telegram import TelegramObject
|
|
||||||
|
|
||||||
|
|
||||||
class ReplyMarkup(TelegramObject):
|
|
||||||
"""Base class for Telegram ReplyMarkup Objects.
|
|
||||||
|
|
||||||
See :class:`telegram.InlineKeyboardMarkup`, :class:`telegram.ReplyKeyboardMarkup`,
|
|
||||||
:class:`telegram.ReplyKeyboardRemove` and :class:`telegram.ForceReply` for
|
|
||||||
detailed use.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
__slots__ = ()
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _check_keyboard_type(keyboard: object) -> bool:
|
|
||||||
"""Checks if the keyboard provided is of the correct type - A list of lists."""
|
|
||||||
if not isinstance(keyboard, list):
|
|
||||||
return False
|
|
||||||
for row in keyboard:
|
|
||||||
if not isinstance(row, list):
|
|
||||||
return False
|
|
||||||
return True
|
|
|
@ -28,7 +28,7 @@ from telegram.helpers import (
|
||||||
mention_html as helpers_mention_html,
|
mention_html as helpers_mention_html,
|
||||||
)
|
)
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE, DEFAULT_20
|
from telegram._utils.defaultvalue import DEFAULT_NONE, DEFAULT_20
|
||||||
from telegram._utils.types import JSONDict, FileInput, ODVInput, DVInput
|
from telegram._utils.types import JSONDict, FileInput, ODVInput, DVInput, ReplyMarkup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import (
|
from telegram import (
|
||||||
|
@ -41,7 +41,6 @@ if TYPE_CHECKING:
|
||||||
InputMediaPhoto,
|
InputMediaPhoto,
|
||||||
InputMediaVideo,
|
InputMediaVideo,
|
||||||
MessageEntity,
|
MessageEntity,
|
||||||
ReplyMarkup,
|
|
||||||
PhotoSize,
|
PhotoSize,
|
||||||
Audio,
|
Audio,
|
||||||
Contact,
|
Contact,
|
||||||
|
@ -331,7 +330,7 @@ class User(TelegramObject):
|
||||||
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||||
|
@ -369,7 +368,7 @@ class User(TelegramObject):
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
|
@ -446,7 +445,7 @@ class User(TelegramObject):
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
thumb: FileInput = None,
|
thumb: FileInput = None,
|
||||||
|
@ -519,7 +518,7 @@ class User(TelegramObject):
|
||||||
last_name: str = None,
|
last_name: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
contact: 'Contact' = None,
|
contact: 'Contact' = None,
|
||||||
vcard: str = None,
|
vcard: str = None,
|
||||||
|
@ -557,7 +556,7 @@ class User(TelegramObject):
|
||||||
self,
|
self,
|
||||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
emoji: str = None,
|
emoji: str = None,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
|
@ -593,7 +592,7 @@ class User(TelegramObject):
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
thumb: FileInput = None,
|
thumb: FileInput = None,
|
||||||
|
@ -751,7 +750,7 @@ class User(TelegramObject):
|
||||||
longitude: float = None,
|
longitude: float = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
location: 'Location' = None,
|
location: 'Location' = None,
|
||||||
live_period: int = None,
|
live_period: int = None,
|
||||||
|
@ -801,7 +800,7 @@ class User(TelegramObject):
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||||
|
@ -844,7 +843,7 @@ class User(TelegramObject):
|
||||||
sticker: Union[FileInput, 'Sticker'],
|
sticker: Union[FileInput, 'Sticker'],
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||||
|
@ -879,7 +878,7 @@ class User(TelegramObject):
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
width: int = None,
|
width: int = None,
|
||||||
height: int = None,
|
height: int = None,
|
||||||
|
@ -932,7 +931,7 @@ class User(TelegramObject):
|
||||||
foursquare_id: str = None,
|
foursquare_id: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
venue: 'Venue' = None,
|
venue: 'Venue' = None,
|
||||||
foursquare_type: str = None,
|
foursquare_type: str = None,
|
||||||
|
@ -979,7 +978,7 @@ class User(TelegramObject):
|
||||||
length: int = None,
|
length: int = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
thumb: FileInput = None,
|
thumb: FileInput = None,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
|
@ -1020,7 +1019,7 @@ class User(TelegramObject):
|
||||||
caption: str = None,
|
caption: str = None,
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: DVInput[float] = DEFAULT_20,
|
timeout: DVInput[float] = DEFAULT_20,
|
||||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
|
@ -1068,7 +1067,7 @@ class User(TelegramObject):
|
||||||
is_closed: bool = None,
|
is_closed: bool = None,
|
||||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
explanation: str = None,
|
explanation: str = None,
|
||||||
explanation_parse_mode: ODVInput[str] = DEFAULT_NONE,
|
explanation_parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||||
|
@ -1122,7 +1121,7 @@ class User(TelegramObject):
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||||
|
@ -1163,7 +1162,7 @@ class User(TelegramObject):
|
||||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||||
reply_markup: 'ReplyMarkup' = None,
|
reply_markup: ReplyMarkup = None,
|
||||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||||
api_kwargs: JSONDict = None,
|
api_kwargs: JSONDict = None,
|
||||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||||
|
|
41
telegram/_utils/markup.py
Normal file
41
telegram/_utils/markup.py
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# A library that provides a Python interface to the Telegram Bot API
|
||||||
|
# Copyright (C) 2015-2022
|
||||||
|
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Lesser Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser Public License
|
||||||
|
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||||
|
"""This module contains a helper function for Telegram's ReplyMarkups
|
||||||
|
|
||||||
|
.. versionchanged:: 14.0
|
||||||
|
Previously, the contents of this module were available through the (no longer existing)
|
||||||
|
class ``telegram.ReplyMarkup``.
|
||||||
|
|
||||||
|
Warning:
|
||||||
|
Contents of this module are intended to be used internally by the library and *not* by the
|
||||||
|
user. Changes to this module are not considered breaking changes and may not be documented in
|
||||||
|
the changelog.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def check_keyboard_type(keyboard: object) -> bool:
|
||||||
|
"""Checks if the keyboard provided is of the correct type - A list of lists.
|
||||||
|
Implicitly tested in the init-tests of `{Inline, Reply}KeyboardMarkup`
|
||||||
|
"""
|
||||||
|
if not isinstance(keyboard, list):
|
||||||
|
return False
|
||||||
|
for row in keyboard:
|
||||||
|
if not isinstance(row, list):
|
||||||
|
return False
|
||||||
|
return True
|
|
@ -39,6 +39,7 @@ from typing import (
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import InputFile # noqa: F401
|
from telegram import InputFile # noqa: F401
|
||||||
from telegram._utils.defaultvalue import DefaultValue # noqa: F401
|
from telegram._utils.defaultvalue import DefaultValue # noqa: F401
|
||||||
|
from telegram import InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
|
||||||
|
|
||||||
FileLike = Union[IO, 'InputFile']
|
FileLike = Union[IO, 'InputFile']
|
||||||
"""Either an open file handler or a :class:`telegram.InputFile`."""
|
"""Either an open file handler or a :class:`telegram.InputFile`."""
|
||||||
|
@ -64,3 +65,11 @@ as ``Union[DefaultValue, type]``."""
|
||||||
RT = TypeVar("RT")
|
RT = TypeVar("RT")
|
||||||
SLT = Union[RT, List[RT], Tuple[RT, ...]]
|
SLT = Union[RT, List[RT], Tuple[RT, ...]]
|
||||||
"""Single instance or list/tuple of instances."""
|
"""Single instance or list/tuple of instances."""
|
||||||
|
|
||||||
|
ReplyMarkup = Union[
|
||||||
|
'InlineKeyboardMarkup', 'ReplyKeyboardMarkup', 'ReplyKeyboardRemove', 'ForceReply'
|
||||||
|
]
|
||||||
|
"""Type alias for reply markup objects.
|
||||||
|
|
||||||
|
.. versionadded:: 14.0
|
||||||
|
"""
|
||||||
|
|
|
@ -37,7 +37,6 @@ from typing import (
|
||||||
|
|
||||||
from telegram import (
|
from telegram import (
|
||||||
Bot,
|
Bot,
|
||||||
ReplyMarkup,
|
|
||||||
Message,
|
Message,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
Poll,
|
Poll,
|
||||||
|
@ -48,7 +47,7 @@ from telegram import (
|
||||||
InputMedia,
|
InputMedia,
|
||||||
)
|
)
|
||||||
|
|
||||||
from telegram._utils.types import JSONDict, ODVInput, DVInput
|
from telegram._utils.types import JSONDict, ODVInput, DVInput, ReplyMarkup
|
||||||
from telegram._utils.defaultvalue import DEFAULT_NONE, DefaultValue
|
from telegram._utils.defaultvalue import DEFAULT_NONE, DefaultValue
|
||||||
from telegram._utils.datetime import to_timestamp
|
from telegram._utils.datetime import to_timestamp
|
||||||
from telegram.ext._callbackdatacache import CallbackDataCache
|
from telegram.ext._callbackdatacache import CallbackDataCache
|
||||||
|
|
|
@ -20,7 +20,13 @@
|
||||||
import pytest
|
import pytest
|
||||||
from flaky import flaky
|
from flaky import flaky
|
||||||
|
|
||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyMarkup, ReplyKeyboardMarkup
|
from telegram import (
|
||||||
|
InlineKeyboardButton,
|
||||||
|
InlineKeyboardMarkup,
|
||||||
|
ForceReply,
|
||||||
|
ReplyKeyboardMarkup,
|
||||||
|
ReplyKeyboardRemove,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='class')
|
@pytest.fixture(scope='class')
|
||||||
|
@ -100,7 +106,13 @@ class TestInlineKeyboardMarkup:
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
if reply_markup is not None:
|
if reply_markup is not None:
|
||||||
if isinstance(reply_markup, ReplyMarkup):
|
markups = (
|
||||||
|
InlineKeyboardMarkup,
|
||||||
|
ReplyKeyboardMarkup,
|
||||||
|
ForceReply,
|
||||||
|
ReplyKeyboardRemove,
|
||||||
|
)
|
||||||
|
if isinstance(reply_markup, markups):
|
||||||
data['reply_markup'] = reply_markup.to_dict()
|
data['reply_markup'] = reply_markup.to_dict()
|
||||||
else:
|
else:
|
||||||
data['reply_markup'] = reply_markup
|
data['reply_markup'] = reply_markup
|
||||||
|
|
Loading…
Reference in a new issue