2016-07-14 21:36:15 +02:00
|
|
|
# python-telegram-bot - a Python interface to the Telegram Bot API
|
2023-01-01 21:31:29 +01:00
|
|
|
# Copyright (C) 2015-2023
|
2016-07-14 21:36:15 +02:00
|
|
|
# by the python-telegram-bot contributors <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/].
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This module contains several constants that are relevant for working with the Bot API.
|
2016-07-14 21:36:15 +02:00
|
|
|
|
2021-10-19 18:28:19 +02:00
|
|
|
Unless noted otherwise, all constants in this module were extracted from the
|
2019-10-17 22:24:44 +02:00
|
|
|
`Telegram Bots FAQ <https://core.telegram.org/bots/faq>`_ and
|
|
|
|
`Telegram Bots API <https://core.telegram.org/bots/api>`_.
|
2016-07-14 21:36:15 +02:00
|
|
|
|
2022-05-14 15:50:12 +02:00
|
|
|
Most of the following constants are related to specific classes or topics and are grouped into
|
|
|
|
enums. If they are related to a specific class, then they are also available as attributes of
|
|
|
|
those classes.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionchanged:: 20.0
|
2022-08-17 18:24:50 +02:00
|
|
|
|
|
|
|
* Most of the constants in this module are grouped into enums.
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
2022-09-17 15:08:54 +02:00
|
|
|
# TODO: Remove this when https://github.com/PyCQA/pylint/issues/6887 is resolved.
|
|
|
|
# pylint: disable=invalid-enum-extension
|
2021-07-01 17:45:19 +02:00
|
|
|
|
2021-10-19 18:28:19 +02:00
|
|
|
__all__ = [
|
|
|
|
"BOT_API_VERSION",
|
2022-05-14 15:50:12 +02:00
|
|
|
"BOT_API_VERSION_INFO",
|
2022-11-22 11:07:42 +01:00
|
|
|
"BotCommandLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
"BotCommandScopeType",
|
2023-03-25 11:47:26 +01:00
|
|
|
"BotDescriptionLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
"CallbackQueryLimit",
|
|
|
|
"ChatAction",
|
|
|
|
"ChatID",
|
2021-11-29 20:32:26 +01:00
|
|
|
"ChatInviteLinkLimit",
|
2022-11-22 10:43:50 +01:00
|
|
|
"ChatLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
"ChatMemberStatus",
|
2022-11-22 11:07:42 +01:00
|
|
|
"ChatPhotoSize",
|
2021-10-19 18:28:19 +02:00
|
|
|
"ChatType",
|
2022-11-22 11:07:42 +01:00
|
|
|
"ContactLimit",
|
2022-08-25 19:36:55 +02:00
|
|
|
"CustomEmojiStickerLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
"DiceEmoji",
|
2022-11-22 11:07:42 +01:00
|
|
|
"DiceLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
"FileSizeLimit",
|
|
|
|
"FloodLimit",
|
2022-11-22 10:43:50 +01:00
|
|
|
"ForumIconColor",
|
|
|
|
"ForumTopicLimit",
|
2022-11-22 11:07:42 +01:00
|
|
|
"InlineKeyboardButtonLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
"InlineKeyboardMarkupLimit",
|
|
|
|
"InlineQueryLimit",
|
2022-11-22 11:07:42 +01:00
|
|
|
"InlineQueryResultLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
"InlineQueryResultType",
|
|
|
|
"InputMediaType",
|
2022-06-27 18:54:11 +02:00
|
|
|
"InvoiceLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
"LocationLimit",
|
|
|
|
"MaskPosition",
|
2022-12-30 14:09:06 +01:00
|
|
|
"MediaGroupLimit",
|
2022-05-03 18:21:50 +02:00
|
|
|
"MenuButtonType",
|
2021-10-19 18:28:19 +02:00
|
|
|
"MessageAttachmentType",
|
|
|
|
"MessageEntityType",
|
|
|
|
"MessageLimit",
|
|
|
|
"MessageType",
|
2022-11-22 11:07:42 +01:00
|
|
|
"PollingLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
"ParseMode",
|
|
|
|
"PollLimit",
|
|
|
|
"PollType",
|
2022-11-22 11:07:42 +01:00
|
|
|
"ReplyLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
"SUPPORTED_WEBHOOK_PORTS",
|
2023-03-25 11:47:26 +01:00
|
|
|
"StickerFormat",
|
2022-11-22 11:07:42 +01:00
|
|
|
"StickerLimit",
|
2023-03-25 11:47:26 +01:00
|
|
|
"StickerSetLimit",
|
2022-08-25 19:36:55 +02:00
|
|
|
"StickerType",
|
2022-06-27 18:54:11 +02:00
|
|
|
"WebhookLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
"UpdateType",
|
2022-11-22 11:07:42 +01:00
|
|
|
"UserProfilePhotosLimit",
|
2021-10-19 18:28:19 +02:00
|
|
|
]
|
2021-07-01 17:45:19 +02:00
|
|
|
|
2022-10-17 19:58:28 +02:00
|
|
|
import sys
|
2022-05-14 15:50:12 +02:00
|
|
|
from typing import List, NamedTuple
|
2021-12-05 09:42:14 +01:00
|
|
|
|
2022-08-17 18:24:50 +02:00
|
|
|
from telegram._utils.enum import IntEnum, StringEnum
|
2016-07-14 21:36:15 +02:00
|
|
|
|
2022-05-14 15:50:12 +02:00
|
|
|
|
|
|
|
class _BotAPIVersion(NamedTuple):
|
|
|
|
"""Similar behavior to sys.version_info.
|
|
|
|
So far TG has only published X.Y releases. We can add X.Y.Z(a(S)) if needed.
|
|
|
|
"""
|
|
|
|
|
|
|
|
major: int
|
|
|
|
minor: int
|
|
|
|
|
|
|
|
def __repr__(self) -> str:
|
|
|
|
"""Unfortunately calling super().__repr__ doesn't work with typing.NamedTuple, so we
|
|
|
|
do this manually.
|
|
|
|
"""
|
|
|
|
return f"BotAPIVersion(major={self.major}, minor={self.minor})"
|
|
|
|
|
|
|
|
def __str__(self) -> str:
|
|
|
|
return f"{self.major}.{self.minor}"
|
|
|
|
|
|
|
|
|
|
|
|
#: :class:`typing.NamedTuple`: A tuple containing the two components of the version number:
|
|
|
|
# ``major`` and ``minor``. Both values are integers.
|
|
|
|
#: The components can also be accessed by name, so ``BOT_API_VERSION_INFO[0]`` is equivalent
|
|
|
|
#: to ``BOT_API_VERSION_INFO.major`` and so on. Also available as
|
|
|
|
#: :data:`telegram.__bot_api_version_info__`.
|
|
|
|
#:
|
|
|
|
#: .. versionadded:: 20.0
|
2023-03-25 11:47:26 +01:00
|
|
|
BOT_API_VERSION_INFO = _BotAPIVersion(major=6, minor=6)
|
2022-05-14 15:50:12 +02:00
|
|
|
#: :obj:`str`: Telegram Bot API
|
|
|
|
#: version supported by this version of `python-telegram-bot`. Also available as
|
|
|
|
#: :data:`telegram.__bot_api_version__`.
|
|
|
|
#:
|
|
|
|
#: .. versionadded:: 13.4
|
|
|
|
BOT_API_VERSION = str(BOT_API_VERSION_INFO)
|
2016-07-14 21:36:15 +02:00
|
|
|
|
|
|
|
# constants above this line are tested
|
|
|
|
|
2022-05-14 15:50:12 +02:00
|
|
|
#: List[:obj:`int`]: Ports supported by
|
|
|
|
#: :paramref:`telegram.Bot.set_webhook.url`.
|
2020-10-06 19:28:40 +02:00
|
|
|
SUPPORTED_WEBHOOK_PORTS: List[int] = [443, 80, 88, 8443]
|
2020-10-13 17:58:36 +02:00
|
|
|
|
2021-07-01 17:45:19 +02:00
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
class BotCommandLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.BotCommand` and
|
|
|
|
:meth:`telegram.Bot.set_my_commands`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_COMMAND = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for :paramref:`~telegram.BotCommand.command` parameter of
|
|
|
|
:class:`telegram.BotCommand`.
|
|
|
|
"""
|
|
|
|
MAX_COMMAND = 32
|
|
|
|
""":obj:`int`: Maximum value allowed for :paramref:`~telegram.BotCommand.command` parameter of
|
|
|
|
:class:`telegram.BotCommand`.
|
|
|
|
"""
|
|
|
|
MIN_DESCRIPTION = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for :paramref:`~telegram.BotCommand.description`
|
|
|
|
parameter of :class:`telegram.BotCommand`.
|
|
|
|
"""
|
|
|
|
MAX_DESCRIPTION = 256
|
|
|
|
""":obj:`int`: Maximum value allowed for :paramref:`~telegram.BotCommand.description`
|
|
|
|
parameter of :class:`telegram.BotCommand`.
|
|
|
|
"""
|
|
|
|
MAX_COMMAND_NUMBER = 100
|
|
|
|
""":obj:`int`: Maximum number of bot commands passed in a :obj:`list` to the
|
|
|
|
:paramref:`~telegram.Bot.set_my_commands.commands`
|
|
|
|
parameter of :meth:`telegram.Bot.set_my_commands`.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class BotCommandScopeType(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available types of :class:`telegram.BotCommandScope`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
DEFAULT = "default"
|
|
|
|
""":obj:`str`: The type of :class:`telegram.BotCommandScopeDefault`."""
|
|
|
|
ALL_PRIVATE_CHATS = "all_private_chats"
|
|
|
|
""":obj:`str`: The type of :class:`telegram.BotCommandScopeAllPrivateChats`."""
|
|
|
|
ALL_GROUP_CHATS = "all_group_chats"
|
|
|
|
""":obj:`str`: The type of :class:`telegram.BotCommandScopeAllGroupChats`."""
|
|
|
|
ALL_CHAT_ADMINISTRATORS = "all_chat_administrators"
|
|
|
|
""":obj:`str`: The type of :class:`telegram.BotCommandScopeAllChatAdministrators`."""
|
|
|
|
CHAT = "chat"
|
|
|
|
""":obj:`str`: The type of :class:`telegram.BotCommandScopeChat`."""
|
|
|
|
CHAT_ADMINISTRATORS = "chat_administrators"
|
|
|
|
""":obj:`str`: The type of :class:`telegram.BotCommandScopeChatAdministrators`."""
|
|
|
|
CHAT_MEMBER = "chat_member"
|
|
|
|
""":obj:`str`: The type of :class:`telegram.BotCommandScopeChatMember`."""
|
|
|
|
|
|
|
|
|
2023-03-25 11:47:26 +01:00
|
|
|
class BotDescriptionLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for the methods :meth:`telegram.Bot.set_my_description` and
|
|
|
|
:meth:`telegram.Bot.set_my_short_description`. The enum members of this enumeration are
|
|
|
|
instances of :class:`int` and can be treated as such.
|
|
|
|
|
2023-03-25 13:25:59 +01:00
|
|
|
.. versionadded:: 20.2
|
2023-03-25 11:47:26 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MAX_DESCRIPTION_LENGTH = 512
|
|
|
|
""":obj:`int`: Maximum length for the parameter
|
|
|
|
:paramref:`~telegram.Bot.set_my_description.description` of
|
|
|
|
:meth:`telegram.Bot.set_my_description`
|
|
|
|
"""
|
|
|
|
MAX_SHORT_DESCRIPTION_LENGTH = 120
|
|
|
|
""":obj:`int`: Maximum length for the parameter
|
|
|
|
:paramref:`~telegram.Bot.set_my_short_description.short_description` of
|
|
|
|
:meth:`telegram.Bot.set_my_short_description`
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2021-10-19 18:28:19 +02:00
|
|
|
class CallbackQueryLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.CallbackQuery`/
|
|
|
|
:meth:`telegram.Bot.answer_callback_query`. The enum members of this enumeration are instances
|
|
|
|
of :class:`int` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
ANSWER_CALLBACK_QUERY_TEXT_LENGTH = 200
|
2022-11-22 11:07:42 +01:00
|
|
|
""":obj:`int`: Maximum number of characters in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.answer_callback_query.text` parameter of
|
2022-02-09 17:30:16 +01:00
|
|
|
:meth:`telegram.Bot.answer_callback_query`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class ChatAction(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available chat actions for :meth:`telegram.Bot.send_chat_action`.
|
|
|
|
The enum members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
CHOOSE_STICKER = "choose_sticker"
|
|
|
|
""":obj:`str`: Chat action indicating that the bot is selecting a sticker."""
|
|
|
|
FIND_LOCATION = "find_location"
|
|
|
|
""":obj:`str`: Chat action indicating that the bot is selecting a location."""
|
|
|
|
RECORD_VOICE = "record_voice"
|
|
|
|
""":obj:`str`: Chat action indicating that the bot is recording a voice message."""
|
|
|
|
RECORD_VIDEO = "record_video"
|
|
|
|
""":obj:`str`: Chat action indicating that the bot is recording a video."""
|
|
|
|
RECORD_VIDEO_NOTE = "record_video_note"
|
|
|
|
""":obj:`str`: Chat action indicating that the bot is recording a video note."""
|
|
|
|
TYPING = "typing"
|
|
|
|
""":obj:`str`: A chat indicating the bot is typing."""
|
|
|
|
UPLOAD_VOICE = "upload_voice"
|
|
|
|
""":obj:`str`: Chat action indicating that the bot is uploading a voice message."""
|
|
|
|
UPLOAD_DOCUMENT = "upload_document"
|
|
|
|
""":obj:`str`: Chat action indicating that the bot is uploading a document."""
|
|
|
|
UPLOAD_PHOTO = "upload_photo"
|
|
|
|
""":obj:`str`: Chat action indicating that the bot is uploading a photo."""
|
|
|
|
UPLOAD_VIDEO = "upload_video"
|
|
|
|
""":obj:`str`: Chat action indicating that the bot is uploading a video."""
|
|
|
|
UPLOAD_VIDEO_NOTE = "upload_video_note"
|
|
|
|
""":obj:`str`: Chat action indicating that the bot is uploading a video note."""
|
|
|
|
|
|
|
|
|
|
|
|
class ChatID(IntEnum):
|
|
|
|
"""This enum contains some special chat IDs. The enum
|
|
|
|
members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
ANONYMOUS_ADMIN = 1087968824
|
|
|
|
""":obj:`int`: User ID in groups for messages sent by anonymous admins.
|
|
|
|
|
|
|
|
Note:
|
2022-02-09 17:30:16 +01:00
|
|
|
:attr:`telegram.Message.from_user` will contain this ID for backwards compatibility only.
|
|
|
|
It's recommended to use :attr:`telegram.Message.sender_chat` instead.
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
SERVICE_CHAT = 777000
|
|
|
|
""":obj:`int`: Telegram service chat, that also acts as sender of channel posts forwarded to
|
|
|
|
discussion groups.
|
|
|
|
|
|
|
|
Note:
|
2022-02-09 17:30:16 +01:00
|
|
|
:attr:`telegram.Message.from_user` will contain this ID for backwards compatibility only.
|
|
|
|
It's recommended to use :attr:`telegram.Message.sender_chat` instead.
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
FAKE_CHANNEL = 136817688
|
|
|
|
""":obj:`int`: User ID in groups when message is sent on behalf of a channel.
|
|
|
|
|
|
|
|
Note:
|
2022-02-09 17:30:16 +01:00
|
|
|
* :attr:`telegram.Message.from_user` will contain this ID for backwards compatibility only.
|
|
|
|
It's recommended to use :attr:`telegram.Message.sender_chat` instead.
|
2021-10-19 18:28:19 +02:00
|
|
|
* This value is undocumented and might be changed by Telegram.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2021-11-29 20:32:26 +01:00
|
|
|
class ChatInviteLinkLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.ChatInviteLink`/
|
|
|
|
:meth:`telegram.Bot.create_chat_invite_link`/:meth:`telegram.Bot.edit_chat_invite_link`. The
|
|
|
|
enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-11-29 20:32:26 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
MIN_MEMBER_LIMIT = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for the
|
|
|
|
:paramref:`~telegram.Bot.create_chat_invite_link.member_limit` parameter of
|
|
|
|
:meth:`telegram.Bot.create_chat_invite_link` and
|
|
|
|
:paramref:`~telegram.Bot.edit_chat_invite_link.member_limit` of
|
|
|
|
:meth:`telegram.Bot.edit_chat_invite_link`.
|
|
|
|
"""
|
|
|
|
MAX_MEMBER_LIMIT = 99999
|
|
|
|
""":obj:`int`: Maximum value allowed for the
|
|
|
|
:paramref:`~telegram.Bot.create_chat_invite_link.member_limit` parameter of
|
|
|
|
:meth:`telegram.Bot.create_chat_invite_link` and
|
|
|
|
:paramref:`~telegram.Bot.edit_chat_invite_link.member_limit` of
|
|
|
|
:meth:`telegram.Bot.edit_chat_invite_link`.
|
|
|
|
"""
|
2021-11-29 20:32:26 +01:00
|
|
|
NAME_LENGTH = 32
|
2022-11-22 11:07:42 +01:00
|
|
|
""":obj:`int`: Maximum number of characters in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.create_chat_invite_link.name` parameter of
|
|
|
|
:meth:`telegram.Bot.create_chat_invite_link` and
|
|
|
|
:paramref:`~telegram.Bot.edit_chat_invite_link.name` of
|
|
|
|
:meth:`telegram.Bot.edit_chat_invite_link`.
|
|
|
|
"""
|
2021-11-29 20:32:26 +01:00
|
|
|
|
|
|
|
|
2022-11-22 10:43:50 +01:00
|
|
|
class ChatLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for
|
2022-11-22 12:09:44 +01:00
|
|
|
:meth:`telegram.Bot.set_chat_administrator_custom_title`,
|
|
|
|
:meth:`telegram.Bot.set_chat_description`, and :meth:`telegram.Bot.set_chat_title`.
|
2022-11-22 10:43:50 +01:00
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
CHAT_ADMINISTRATOR_CUSTOM_TITLE_LENGTH = 16
|
|
|
|
""":obj:`int`: Maximum length of a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.set_chat_administrator_custom_title.custom_title` parameter of
|
|
|
|
:meth:`telegram.Bot.set_chat_administrator_custom_title`.
|
|
|
|
"""
|
2022-11-22 12:09:44 +01:00
|
|
|
CHAT_DESCRIPTION_LENGTH = 255
|
|
|
|
""":obj:`int`: Maximum number of characters in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.set_chat_description.description` parameter of
|
|
|
|
:meth:`telegram.Bot.set_chat_description`.
|
|
|
|
"""
|
2022-11-22 10:43:50 +01:00
|
|
|
MIN_CHAT_TITLE_LENGTH = 1
|
|
|
|
""":obj:`int`: Minimum length of a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.set_chat_title.title` parameter of
|
|
|
|
:meth:`telegram.Bot.set_chat_title`.
|
|
|
|
"""
|
|
|
|
MAX_CHAT_TITLE_LENGTH = 128
|
|
|
|
""":obj:`int`: Maximum length of a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.set_chat_title.title` parameter of
|
|
|
|
:meth:`telegram.Bot.set_chat_title`.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class ChatMemberStatus(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available states for :class:`telegram.ChatMember`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
ADMINISTRATOR = "administrator"
|
|
|
|
""":obj:`str`: A :class:`telegram.ChatMember` who is administrator of the chat."""
|
2022-04-30 22:18:11 +02:00
|
|
|
OWNER = "creator"
|
|
|
|
""":obj:`str`: A :class:`telegram.ChatMember` who is the owner of the chat."""
|
|
|
|
BANNED = "kicked"
|
|
|
|
""":obj:`str`: A :class:`telegram.ChatMember` who was banned in the chat."""
|
2021-10-19 18:28:19 +02:00
|
|
|
LEFT = "left"
|
|
|
|
""":obj:`str`: A :class:`telegram.ChatMember` who has left the chat."""
|
|
|
|
MEMBER = "member"
|
|
|
|
""":obj:`str`: A :class:`telegram.ChatMember` who is a member of the chat."""
|
|
|
|
RESTRICTED = "restricted"
|
|
|
|
""":obj:`str`: A :class:`telegram.ChatMember` who was restricted in this chat."""
|
|
|
|
|
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
class ChatPhotoSize(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.ChatPhoto`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
SMALL = 160
|
|
|
|
""":obj:`int`: Width and height of a small chat photo, ID of which is passed in
|
|
|
|
:paramref:`~telegram.ChatPhoto.small_file_id` and
|
|
|
|
:paramref:`~telegram.ChatPhoto.small_file_unique_id` parameters of
|
|
|
|
:class:`telegram.ChatPhoto`.
|
|
|
|
"""
|
|
|
|
BIG = 640
|
|
|
|
""":obj:`int`: Width and height of a big chat photo, ID of which is passed in
|
|
|
|
:paramref:`~telegram.ChatPhoto.big_file_id` and
|
|
|
|
:paramref:`~telegram.ChatPhoto.big_file_unique_id` parameters of
|
|
|
|
:class:`telegram.ChatPhoto`.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class ChatType(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available types of :class:`telegram.Chat`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
SENDER = "sender"
|
|
|
|
""":obj:`str`: A :class:`telegram.Chat` that represents the chat of a :class:`telegram.User`
|
|
|
|
sending an :class:`telegram.InlineQuery`. """
|
|
|
|
PRIVATE = "private"
|
|
|
|
""":obj:`str`: A :class:`telegram.Chat` that is private."""
|
|
|
|
GROUP = "group"
|
|
|
|
""":obj:`str`: A :class:`telegram.Chat` that is a group."""
|
|
|
|
SUPERGROUP = "supergroup"
|
|
|
|
""":obj:`str`: A :class:`telegram.Chat` that is a supergroup."""
|
|
|
|
CHANNEL = "channel"
|
|
|
|
""":obj:`str`: A :class:`telegram.Chat` that is a channel."""
|
|
|
|
|
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
class ContactLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.InlineQueryResultContact`,
|
|
|
|
:class:`telegram.InputContactMessageContent`, and :meth:`telegram.Bot.send_contact`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
VCARD = 2048
|
|
|
|
""":obj:`int`: Maximum value allowed for:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.Bot.send_contact.vcard` parameter of :meth:`~telegram.Bot.send_contact`
|
|
|
|
* :paramref:`~telegram.InlineQueryResultContact.vcard` parameter of
|
|
|
|
:class:`~telegram.InlineQueryResultContact`
|
|
|
|
* :paramref:`~telegram.InputContactMessageContent.vcard` parameter of
|
|
|
|
:class:`~telegram.InputContactMessageContent`
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-08-25 19:36:55 +02:00
|
|
|
class CustomEmojiStickerLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :meth:`telegram.Bot.get_custom_emoji_stickers`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
CUSTOM_EMOJI_IDENTIFIER_LIMIT = 200
|
|
|
|
""":obj:`int`: Maximum amount of custom emoji identifiers which can be specified for the
|
|
|
|
:paramref:`~telegram.Bot.get_custom_emoji_stickers.custom_emoji_ids` parameter of
|
|
|
|
:meth:`telegram.Bot.get_custom_emoji_stickers`.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class DiceEmoji(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available emoji for :class:`telegram.Dice`/
|
|
|
|
:meth:`telegram.Bot.send_dice`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
DICE = "🎲"
|
|
|
|
""":obj:`str`: A :class:`telegram.Dice` with the emoji ``🎲``."""
|
|
|
|
DARTS = "🎯"
|
|
|
|
""":obj:`str`: A :class:`telegram.Dice` with the emoji ``🎯``."""
|
|
|
|
BASKETBALL = "🏀"
|
|
|
|
""":obj:`str`: A :class:`telegram.Dice` with the emoji ``🏀``."""
|
|
|
|
FOOTBALL = "⚽"
|
|
|
|
""":obj:`str`: A :class:`telegram.Dice` with the emoji ``⚽``."""
|
|
|
|
SLOT_MACHINE = "🎰"
|
|
|
|
""":obj:`str`: A :class:`telegram.Dice` with the emoji ``🎰``."""
|
|
|
|
BOWLING = "🎳"
|
|
|
|
""":obj:`str`: A :class:`telegram.Dice` with the emoji ``🎳``."""
|
|
|
|
|
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
class DiceLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.Dice`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_VALUE = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for :paramref:`~telegram.Dice.value` parameter of
|
|
|
|
:class:`telegram.Dice` (any emoji).
|
|
|
|
"""
|
|
|
|
|
|
|
|
MAX_VALUE_BASKETBALL = 5
|
|
|
|
""":obj:`int`: Maximum value allowed for :paramref:`~telegram.Dice.value` parameter of
|
|
|
|
:class:`telegram.Dice` if :paramref:`~telegram.Dice.emoji` is
|
|
|
|
:tg-const:`telegram.constants.DiceEmoji.BASKETBALL`.
|
|
|
|
"""
|
|
|
|
MAX_VALUE_BOWLING = 6
|
|
|
|
""":obj:`int`: Maximum value allowed for :paramref:`~telegram.Dice.value` parameter of
|
|
|
|
:class:`telegram.Dice` if :paramref:`~telegram.Dice.emoji` is
|
|
|
|
:tg-const:`telegram.constants.DiceEmoji.BOWLING`.
|
|
|
|
"""
|
|
|
|
MAX_VALUE_DARTS = 6
|
|
|
|
""":obj:`int`: Maximum value allowed for :paramref:`~telegram.Dice.value` parameter of
|
|
|
|
:class:`telegram.Dice` if :paramref:`~telegram.Dice.emoji` is
|
|
|
|
:tg-const:`telegram.constants.DiceEmoji.DARTS`.
|
|
|
|
"""
|
|
|
|
MAX_VALUE_DICE = 6
|
|
|
|
""":obj:`int`: Maximum value allowed for :paramref:`~telegram.Dice.value` parameter of
|
|
|
|
:class:`telegram.Dice` if :paramref:`~telegram.Dice.emoji` is
|
|
|
|
:tg-const:`telegram.constants.DiceEmoji.DICE`.
|
|
|
|
"""
|
|
|
|
MAX_VALUE_FOOTBALL = 5
|
|
|
|
""":obj:`int`: Maximum value allowed for :paramref:`~telegram.Dice.value` parameter of
|
|
|
|
:class:`telegram.Dice` if :paramref:`~telegram.Dice.emoji` is
|
|
|
|
:tg-const:`telegram.constants.DiceEmoji.FOOTBALL`.
|
|
|
|
"""
|
|
|
|
MAX_VALUE_SLOT_MACHINE = 64
|
|
|
|
""":obj:`int`: Maximum value allowed for :paramref:`~telegram.Dice.value` parameter of
|
|
|
|
:class:`telegram.Dice` if :paramref:`~telegram.Dice.emoji` is
|
|
|
|
:tg-const:`telegram.constants.DiceEmoji.SLOT_MACHINE`.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2021-10-19 18:28:19 +02:00
|
|
|
class FileSizeLimit(IntEnum):
|
|
|
|
"""This enum contains limitations regarding the upload and download of files. The enum
|
|
|
|
members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
FILESIZE_DOWNLOAD = int(20e6) # (20MB)
|
|
|
|
""":obj:`int`: Bots can download files of up to 20MB in size."""
|
|
|
|
FILESIZE_UPLOAD = int(50e6) # (50MB)
|
|
|
|
""":obj:`int`: Bots can upload non-photo files of up to 50MB in size."""
|
2022-10-17 19:58:28 +02:00
|
|
|
FILESIZE_UPLOAD_LOCAL_MODE = int(2e9) # (2000MB)
|
|
|
|
""":obj:`int`: Bots can upload non-photo files of up to 2000MB in size when using a local bot
|
|
|
|
API server.
|
|
|
|
"""
|
|
|
|
FILESIZE_DOWNLOAD_LOCAL_MODE = sys.maxsize
|
|
|
|
""":obj:`int`: Bots can download files without a size limit when using a local bot API server.
|
|
|
|
"""
|
2021-10-19 18:28:19 +02:00
|
|
|
PHOTOSIZE_UPLOAD = int(10e6) # (10MB)
|
|
|
|
""":obj:`int`: Bots can upload photo files of up to 10MB in size."""
|
2022-11-22 11:07:42 +01:00
|
|
|
VOICE_NOTE_FILE_SIZE = int(1e6) # (1MB)
|
|
|
|
""":obj:`int`: File size limit for the :meth:`~telegram.Bot.send_voice` method of
|
|
|
|
:class:`telegram.Bot`. Bots can send :mimetype:`audio/ogg` files of up to 1MB in size as
|
|
|
|
a voice note. Larger voice notes (up to 20MB) will be sent as files."""
|
|
|
|
# It seems OK to link 20MB limit to FILESIZE_DOWNLOAD rather than creating a new constant
|
2021-10-19 18:28:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
class FloodLimit(IntEnum):
|
|
|
|
"""This enum contains limitations regarding flood limits. The enum
|
|
|
|
members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MESSAGES_PER_SECOND_PER_CHAT = 1
|
|
|
|
""":obj:`int`: The number of messages that can be sent per second in a particular chat.
|
|
|
|
Telegram may allow short bursts that go over this limit, but eventually you'll begin
|
|
|
|
receiving 429 errors.
|
|
|
|
"""
|
|
|
|
MESSAGES_PER_SECOND = 30
|
|
|
|
""":obj:`int`: The number of messages that can roughly be sent in an interval of 30 seconds
|
|
|
|
across all chats.
|
|
|
|
"""
|
|
|
|
MESSAGES_PER_MINUTE_PER_GROUP = 20
|
|
|
|
""":obj:`int`: The number of messages that can roughly be sent to a particular group within one
|
|
|
|
minute.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-11-22 10:43:50 +01:00
|
|
|
class ForumIconColor(IntEnum):
|
|
|
|
"""This enum contains the available colors for use in
|
|
|
|
:paramref:`telegram.Bot.create_forum_topic.icon_color`. The enum members of this enumeration
|
|
|
|
are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
BLUE = 0x6FB9F0
|
|
|
|
""":obj:`int`: An icon with a color which corresponds to blue (``0x6FB9F0``).
|
|
|
|
|
|
|
|
.. raw:: html
|
|
|
|
|
|
|
|
<div style="height:15px; width:15px; background-color:#6FB9F0;"></div>
|
|
|
|
|
|
|
|
"""
|
|
|
|
YELLOW = 0xFFD67E
|
|
|
|
""":obj:`int`: An icon with a color which corresponds to yellow (``0xFFD67E``).
|
|
|
|
|
|
|
|
.. raw:: html
|
|
|
|
|
|
|
|
<div style="height:15px; width:15px; background-color:#FFD67E;"></div>
|
|
|
|
|
|
|
|
"""
|
|
|
|
PURPLE = 0xCB86DB
|
|
|
|
""":obj:`int`: An icon with a color which corresponds to purple (``0xCB86DB``).
|
|
|
|
|
|
|
|
.. raw:: html
|
|
|
|
|
|
|
|
<div style="height:15px; width:15px; background-color:#CB86DB;"></div>
|
|
|
|
|
|
|
|
"""
|
|
|
|
GREEN = 0x8EEE98
|
|
|
|
""":obj:`int`: An icon with a color which corresponds to green (``0x8EEE98``).
|
|
|
|
|
|
|
|
.. raw:: html
|
|
|
|
|
|
|
|
<div style="height:15px; width:15px; background-color:#8EEE98;"></div>
|
|
|
|
|
|
|
|
"""
|
|
|
|
PINK = 0xFF93B2
|
|
|
|
""":obj:`int`: An icon with a color which corresponds to pink (``0xFF93B2``).
|
|
|
|
|
|
|
|
.. raw:: html
|
|
|
|
|
|
|
|
<div style="height:15px; width:15px; background-color:#FF93B2;"></div>
|
|
|
|
|
|
|
|
"""
|
|
|
|
RED = 0xFB6F5F
|
|
|
|
""":obj:`int`: An icon with a color which corresponds to red (``0xFB6F5F``).
|
|
|
|
|
|
|
|
.. raw:: html
|
|
|
|
|
|
|
|
<div style="height:15px; width:15px; background-color:#FB6F5F;"></div>
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
class InlineKeyboardButtonLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.InlineKeyboardButton`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_CALLBACK_DATA = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for
|
|
|
|
:paramref:`~telegram.InlineKeyboardButton.callback_data` parameter of
|
|
|
|
:class:`telegram.InlineKeyboardButton`
|
|
|
|
"""
|
|
|
|
MAX_CALLBACK_DATA = 64
|
|
|
|
""":obj:`int`: Maximum value allowed for
|
|
|
|
:paramref:`~telegram.InlineKeyboardButton.callback_data` parameter of
|
|
|
|
:class:`telegram.InlineKeyboardButton`
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2021-10-19 18:28:19 +02:00
|
|
|
class InlineKeyboardMarkupLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.InlineKeyboardMarkup`/
|
|
|
|
:meth:`telegram.Bot.send_message` & friends. The enum
|
|
|
|
members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
TOTAL_BUTTON_NUMBER = 100
|
|
|
|
""":obj:`int`: Maximum number of buttons that can be attached to a message.
|
|
|
|
|
|
|
|
Note:
|
|
|
|
This value is undocumented and might be changed by Telegram.
|
|
|
|
"""
|
|
|
|
BUTTONS_PER_ROW = 8
|
|
|
|
""":obj:`int`: Maximum number of buttons that can be attached to a message per row.
|
|
|
|
|
|
|
|
Note:
|
|
|
|
This value is undocumented and might be changed by Telegram.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class InputMediaType(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available types of :class:`telegram.InputMedia`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
ANIMATION = "animation"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InputMediaAnimation`."""
|
|
|
|
DOCUMENT = "document"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InputMediaDocument`."""
|
|
|
|
AUDIO = "audio"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InputMediaAudio`."""
|
|
|
|
PHOTO = "photo"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InputMediaPhoto`."""
|
|
|
|
VIDEO = "video"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InputMediaVideo`."""
|
|
|
|
|
|
|
|
|
|
|
|
class InlineQueryLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.InlineQuery`/
|
|
|
|
:meth:`telegram.Bot.answer_inline_query`. The enum members of this enumeration are instances
|
|
|
|
of :class:`int` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
RESULTS = 50
|
|
|
|
""":obj:`int`: Maximum number of results that can be passed to
|
2022-02-09 17:30:16 +01:00
|
|
|
:meth:`telegram.Bot.answer_inline_query`."""
|
2022-11-22 11:07:42 +01:00
|
|
|
MAX_OFFSET_LENGTH = 64
|
|
|
|
""":obj:`int`: Maximum number of bytes in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.answer_inline_query.next_offset` parameter of
|
2022-02-09 17:30:16 +01:00
|
|
|
:meth:`telegram.Bot.answer_inline_query`."""
|
2022-11-22 11:07:42 +01:00
|
|
|
MAX_QUERY_LENGTH = 256
|
|
|
|
""":obj:`int`: Maximum number of characters in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.InlineQuery.query` parameter of :class:`telegram.InlineQuery`."""
|
|
|
|
MIN_SWITCH_PM_TEXT_LENGTH = 1
|
|
|
|
""":obj:`int`: Minimum number of characters in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.answer_inline_query.switch_pm_parameter` parameter of
|
|
|
|
:meth:`telegram.Bot.answer_inline_query`."""
|
|
|
|
MAX_SWITCH_PM_TEXT_LENGTH = 64
|
|
|
|
""":obj:`int`: Maximum number of characters in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.answer_inline_query.switch_pm_parameter` parameter of
|
|
|
|
:meth:`telegram.Bot.answer_inline_query`."""
|
|
|
|
|
|
|
|
|
|
|
|
class InlineQueryResultLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.InlineQueryResult` and its subclasses.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_ID_LENGTH = 1
|
|
|
|
""":obj:`int`: Minimum number of bytes in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.InlineQueryResult.id` parameter of
|
|
|
|
:class:`telegram.InlineQueryResult` and its subclasses
|
|
|
|
"""
|
|
|
|
MAX_ID_LENGTH = 64
|
|
|
|
""":obj:`int`: Maximum number of bytes in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.InlineQueryResult.id` parameter of
|
|
|
|
:class:`telegram.InlineQueryResult` and its subclasses
|
|
|
|
"""
|
2021-10-19 18:28:19 +02:00
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class InlineQueryResultType(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available types of :class:`telegram.InlineQueryResult`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
AUDIO = "audio"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultAudio` and
|
|
|
|
:class:`telegram.InlineQueryResultCachedAudio`.
|
|
|
|
"""
|
|
|
|
DOCUMENT = "document"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultDocument` and
|
|
|
|
:class:`telegram.InlineQueryResultCachedDocument`.
|
|
|
|
"""
|
|
|
|
GIF = "gif"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultGif` and
|
|
|
|
:class:`telegram.InlineQueryResultCachedGif`.
|
|
|
|
"""
|
|
|
|
MPEG4GIF = "mpeg4_gif"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultMpeg4Gif` and
|
|
|
|
:class:`telegram.InlineQueryResultCachedMpeg4Gif`.
|
|
|
|
"""
|
|
|
|
PHOTO = "photo"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultPhoto` and
|
|
|
|
:class:`telegram.InlineQueryResultCachedPhoto`.
|
|
|
|
"""
|
|
|
|
STICKER = "sticker"
|
|
|
|
""":obj:`str`: Type of and :class:`telegram.InlineQueryResultCachedSticker`."""
|
|
|
|
VIDEO = "video"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultVideo` and
|
|
|
|
:class:`telegram.InlineQueryResultCachedVideo`.
|
|
|
|
"""
|
|
|
|
VOICE = "voice"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultVoice` and
|
|
|
|
:class:`telegram.InlineQueryResultCachedVoice`.
|
|
|
|
"""
|
|
|
|
ARTICLE = "article"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultArticle`."""
|
|
|
|
CONTACT = "contact"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultContact`."""
|
|
|
|
GAME = "game"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultGame`."""
|
|
|
|
LOCATION = "location"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultLocation`."""
|
|
|
|
VENUE = "venue"
|
|
|
|
""":obj:`str`: Type of :class:`telegram.InlineQueryResultVenue`."""
|
|
|
|
|
|
|
|
|
|
|
|
class LocationLimit(IntEnum):
|
2022-11-22 11:07:42 +01:00
|
|
|
"""This enum contains limitations for
|
|
|
|
:class:`telegram.Location`/:class:`telegram.ChatLocation`/
|
|
|
|
:meth:`telegram.Bot.edit_message_live_location`/:meth:`telegram.Bot.send_location`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
2021-10-19 18:28:19 +02:00
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
MIN_CHAT_LOCATION_ADDRESS = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for :paramref:`~telegram.ChatLocation.address` parameter
|
|
|
|
of :class:`telegram.ChatLocation`
|
|
|
|
"""
|
|
|
|
MAX_CHAT_LOCATION_ADDRESS = 64
|
|
|
|
""":obj:`int`: Minimum value allowed for :paramref:`~telegram.ChatLocation.address` parameter
|
|
|
|
of :class:`telegram.ChatLocation`
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
2022-11-22 11:07:42 +01:00
|
|
|
|
|
|
|
HORIZONTAL_ACCURACY = 1500
|
|
|
|
""":obj:`int`: Maximum value allowed for:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.Location.horizontal_accuracy` parameter of :class:`telegram.Location`
|
|
|
|
* :paramref:`~telegram.InlineQueryResultLocation.horizontal_accuracy` parameter of
|
|
|
|
:class:`telegram.InlineQueryResultLocation`
|
|
|
|
* :paramref:`~telegram.InputLocationMessageContent.horizontal_accuracy` parameter of
|
|
|
|
:class:`telegram.InputLocationMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.edit_message_live_location.horizontal_accuracy` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_message_live_location`
|
|
|
|
* :paramref:`~telegram.Bot.send_location.horizontal_accuracy` parameter of
|
|
|
|
:meth:`telegram.Bot.send_location`
|
|
|
|
"""
|
|
|
|
|
|
|
|
MIN_HEADING = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.Location.heading` parameter of :class:`telegram.Location`
|
|
|
|
* :paramref:`~telegram.InlineQueryResultLocation.heading` parameter of
|
|
|
|
:class:`telegram.InlineQueryResultLocation`
|
|
|
|
* :paramref:`~telegram.InputLocationMessageContent.heading` parameter of
|
|
|
|
:class:`telegram.InputLocationMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.edit_message_live_location.heading` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_message_live_location`
|
|
|
|
* :paramref:`~telegram.Bot.send_location.heading` parameter of
|
|
|
|
:meth:`telegram.Bot.send_location`
|
|
|
|
"""
|
|
|
|
MAX_HEADING = 360
|
|
|
|
""":obj:`int`: Maximum value allowed for:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.Location.heading` parameter of :class:`telegram.Location`
|
|
|
|
* :paramref:`~telegram.InlineQueryResultLocation.heading` parameter of
|
|
|
|
:class:`telegram.InlineQueryResultLocation`
|
|
|
|
* :paramref:`~telegram.InputLocationMessageContent.heading` parameter of
|
|
|
|
:class:`telegram.InputLocationMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.edit_message_live_location.heading` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_message_live_location`
|
|
|
|
* :paramref:`~telegram.Bot.send_location.heading` parameter of
|
|
|
|
:meth:`telegram.Bot.send_location`
|
|
|
|
"""
|
|
|
|
|
|
|
|
MIN_LIVE_PERIOD = 60
|
|
|
|
""":obj:`int`: Minimum value allowed for:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.InlineQueryResultLocation.live_period` parameter of
|
|
|
|
:class:`telegram.InlineQueryResultLocation`
|
|
|
|
* :paramref:`~telegram.InputLocationMessageContent.live_period` parameter of
|
|
|
|
:class:`telegram.InputLocationMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.edit_message_live_location.live_period` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_message_live_location`
|
|
|
|
* :paramref:`~telegram.Bot.send_location.live_period` parameter of
|
|
|
|
:meth:`telegram.Bot.send_location`
|
|
|
|
"""
|
|
|
|
MAX_LIVE_PERIOD = 86400
|
|
|
|
""":obj:`int`: Maximum value allowed for:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.InlineQueryResultLocation.live_period` parameter of
|
|
|
|
:class:`telegram.InlineQueryResultLocation`
|
|
|
|
* :paramref:`~telegram.InputLocationMessageContent.live_period` parameter of
|
|
|
|
:class:`telegram.InputLocationMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.edit_message_live_location.live_period` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_message_live_location`
|
|
|
|
* :paramref:`~telegram.Bot.send_location.live_period` parameter of
|
|
|
|
:meth:`telegram.Bot.send_location`
|
|
|
|
"""
|
|
|
|
|
|
|
|
MIN_PROXIMITY_ALERT_RADIUS = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.InlineQueryResultLocation.proximity_alert_radius` parameter of
|
|
|
|
:class:`telegram.InlineQueryResultLocation`
|
|
|
|
* :paramref:`~telegram.InputLocationMessageContent.proximity_alert_radius` parameter of
|
|
|
|
:class:`telegram.InputLocationMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.edit_message_live_location.proximity_alert_radius` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_message_live_location`
|
|
|
|
* :paramref:`~telegram.Bot.send_location.proximity_alert_radius` parameter of
|
|
|
|
:meth:`telegram.Bot.send_location`
|
|
|
|
"""
|
|
|
|
MAX_PROXIMITY_ALERT_RADIUS = 100000
|
|
|
|
""":obj:`int`: Maximum value allowed for:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.InlineQueryResultLocation.proximity_alert_radius` parameter of
|
|
|
|
:class:`telegram.InlineQueryResultLocation`
|
|
|
|
* :paramref:`~telegram.InputLocationMessageContent.proximity_alert_radius` parameter of
|
|
|
|
:class:`telegram.InputLocationMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.edit_message_live_location.proximity_alert_radius` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_message_live_location`
|
|
|
|
* :paramref:`~telegram.Bot.send_location.proximity_alert_radius` parameter of
|
|
|
|
:meth:`telegram.Bot.send_location`
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class MaskPosition(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available positions for :class:`telegram.MaskPosition`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
FOREHEAD = "forehead"
|
|
|
|
""":obj:`str`: Mask position for a sticker on the forehead."""
|
|
|
|
EYES = "eyes"
|
|
|
|
""":obj:`str`: Mask position for a sticker on the eyes."""
|
|
|
|
MOUTH = "mouth"
|
|
|
|
""":obj:`str`: Mask position for a sticker on the mouth."""
|
|
|
|
CHIN = "chin"
|
|
|
|
""":obj:`str`: Mask position for a sticker on the chin."""
|
|
|
|
|
|
|
|
|
2022-12-30 14:09:06 +01:00
|
|
|
class MediaGroupLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :meth:`telegram.Bot.send_media_group`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_MEDIA_LENGTH = 2
|
|
|
|
""":obj:`int`: Minimum length of a :obj:`list` passed as the
|
|
|
|
:paramref:`~telegram.Bot.send_media_group.media` parameter of
|
|
|
|
:meth:`telegram.Bot.send_media_group`.
|
|
|
|
"""
|
|
|
|
MAX_MEDIA_LENGTH = 10
|
|
|
|
""":obj:`int`: Maximum length of a :obj:`list` passed as the
|
|
|
|
:paramref:`~telegram.Bot.send_media_group.media` parameter of
|
|
|
|
:meth:`telegram.Bot.send_media_group`.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-05-03 18:21:50 +02:00
|
|
|
class MenuButtonType(StringEnum):
|
|
|
|
"""This enum contains the available types of :class:`telegram.MenuButton`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
COMMANDS = "commands"
|
|
|
|
""":obj:`str`: The type of :class:`telegram.MenuButtonCommands`."""
|
|
|
|
WEB_APP = "web_app"
|
|
|
|
""":obj:`str`: The type of :class:`telegram.MenuButtonWebApp`."""
|
|
|
|
DEFAULT = "default"
|
|
|
|
""":obj:`str`: The type of :class:`telegram.MenuButtonDefault`."""
|
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class MessageAttachmentType(StringEnum):
|
2022-05-03 18:21:50 +02:00
|
|
|
"""This enum contains the available types of :class:`telegram.Message` that can be seen
|
2021-10-19 18:28:19 +02:00
|
|
|
as attachment. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
# Make sure that all constants here are also listed in the MessageType Enum!
|
|
|
|
# (Enums are not extendable)
|
|
|
|
|
|
|
|
ANIMATION = "animation"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.animation`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
AUDIO = "audio"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.audio`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
CONTACT = "contact"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.contact`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
DICE = "dice"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.dice`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
DOCUMENT = "document"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.document`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
GAME = "game"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.game`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
INVOICE = "invoice"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.invoice`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
LOCATION = "location"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.location`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
PASSPORT_DATA = "passport_data"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.passport_data`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
PHOTO = "photo"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.photo`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
POLL = "poll"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.poll`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
STICKER = "sticker"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.sticker`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
SUCCESSFUL_PAYMENT = "successful_payment"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.successful_payment`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
VIDEO = "video"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.video`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
VIDEO_NOTE = "video_note"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.video_note`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
VOICE = "voice"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.voice`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
VENUE = "venue"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.venue`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class MessageEntityType(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available types of :class:`telegram.MessageEntity`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MENTION = "mention"
|
|
|
|
""":obj:`str`: Message entities representing a mention."""
|
|
|
|
HASHTAG = "hashtag"
|
|
|
|
""":obj:`str`: Message entities representing a hashtag."""
|
|
|
|
CASHTAG = "cashtag"
|
|
|
|
""":obj:`str`: Message entities representing a cashtag."""
|
|
|
|
PHONE_NUMBER = "phone_number"
|
|
|
|
""":obj:`str`: Message entities representing a phone number."""
|
|
|
|
BOT_COMMAND = "bot_command"
|
|
|
|
""":obj:`str`: Message entities representing a bot command."""
|
|
|
|
URL = "url"
|
|
|
|
""":obj:`str`: Message entities representing a url."""
|
|
|
|
EMAIL = "email"
|
|
|
|
""":obj:`str`: Message entities representing a email."""
|
|
|
|
BOLD = "bold"
|
|
|
|
""":obj:`str`: Message entities representing bold text."""
|
|
|
|
ITALIC = "italic"
|
|
|
|
""":obj:`str`: Message entities representing italic text."""
|
|
|
|
CODE = "code"
|
|
|
|
""":obj:`str`: Message entities representing monowidth string."""
|
|
|
|
PRE = "pre"
|
|
|
|
""":obj:`str`: Message entities representing monowidth block."""
|
|
|
|
TEXT_LINK = "text_link"
|
|
|
|
""":obj:`str`: Message entities representing clickable text URLs."""
|
|
|
|
TEXT_MENTION = "text_mention"
|
|
|
|
""":obj:`str`: Message entities representing text mention for users without usernames."""
|
|
|
|
UNDERLINE = "underline"
|
|
|
|
""":obj:`str`: Message entities representing underline text."""
|
|
|
|
STRIKETHROUGH = "strikethrough"
|
|
|
|
""":obj:`str`: Message entities representing strikethrough text."""
|
|
|
|
SPOILER = "spoiler"
|
|
|
|
""":obj:`str`: Message entities representing spoiler text."""
|
2022-08-25 19:36:55 +02:00
|
|
|
CUSTOM_EMOJI = "custom_emoji"
|
|
|
|
""":obj:`str`: Message entities representing inline custom emoji stickers.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
2021-10-19 18:28:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
class MessageLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.Message`/
|
2022-11-22 11:07:42 +01:00
|
|
|
:class:`telegram.InputTextMessageContent`/
|
2021-10-19 18:28:19 +02:00
|
|
|
:meth:`telegram.Bot.send_message` & friends. The enum
|
|
|
|
members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
# TODO add links to params?
|
|
|
|
MAX_TEXT_LENGTH = 4096
|
|
|
|
""":obj:`int`: Maximum number of characters in a :obj:`str` passed as:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.Game.text` parameter of :class:`telegram.Game`
|
|
|
|
* :paramref:`~telegram.Message.text` parameter of :class:`telegram.Message`
|
|
|
|
* :paramref:`~telegram.InputTextMessageContent.message_text` parameter of
|
|
|
|
:class:`telegram.InputTextMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.send_message.text` parameter of :meth:`telegram.Bot.send_message`
|
|
|
|
* :paramref:`~telegram.Bot.edit_message_text.text` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_message_text`
|
|
|
|
"""
|
2021-10-19 18:28:19 +02:00
|
|
|
CAPTION_LENGTH = 1024
|
2022-11-22 11:07:42 +01:00
|
|
|
""":obj:`int`: Maximum number of characters in a :obj:`str` passed as:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.Message.caption` parameter of :class:`telegram.Message`
|
|
|
|
* :paramref:`~telegram.InputMedia.caption` parameter of :class:`telegram.InputMedia`
|
|
|
|
and its subclasses
|
|
|
|
* ``caption`` parameter of subclasses of :class:`telegram.InlineQueryResult`
|
|
|
|
* ``caption`` parameter of :meth:`telegram.Bot.send_photo`, :meth:`telegram.Bot.send_audio`,
|
|
|
|
:meth:`telegram.Bot.send_document`, :meth:`telegram.Bot.send_video`,
|
|
|
|
:meth:`telegram.Bot.send_animation`, :meth:`telegram.Bot.send_voice`,
|
|
|
|
:meth:`telegram.Bot.edit_message_caption`, :meth:`telegram.Bot.copy_message`
|
|
|
|
"""
|
2021-10-19 18:28:19 +02:00
|
|
|
# constants above this line are tested
|
2022-11-22 11:07:42 +01:00
|
|
|
MIN_TEXT_LENGTH = 1
|
|
|
|
""":obj:`int`: Minimum number of characters in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.InputTextMessageContent.message_text` parameter of
|
|
|
|
:class:`telegram.InputTextMessageContent` and the
|
|
|
|
:paramref:`~telegram.Bot.edit_message_text.text` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_message_text`.
|
|
|
|
"""
|
|
|
|
# TODO this constant is not used. helpers.py contains 64 as a number
|
2022-11-01 17:58:58 +01:00
|
|
|
DEEP_LINK_LENGTH = 64
|
|
|
|
""":obj:`int`: Maximum number of characters for a deep link."""
|
2022-11-22 11:07:42 +01:00
|
|
|
# TODO this constant is not used anywhere
|
2021-10-19 18:28:19 +02:00
|
|
|
MESSAGE_ENTITIES = 100
|
|
|
|
""":obj:`int`: Maximum number of entities that can be displayed in a message. Further entities
|
|
|
|
will simply be ignored by Telegram.
|
|
|
|
|
|
|
|
Note:
|
|
|
|
This value is undocumented and might be changed by Telegram.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class MessageType(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available types of :class:`telegram.Message` that can be seen
|
|
|
|
as attachment. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
# Make sure that all attachment type constants are also listed in the
|
|
|
|
# MessageAttachmentType Enum! (Enums are not extendable)
|
|
|
|
|
|
|
|
# -------------------------------------------------- Attachment types
|
|
|
|
ANIMATION = "animation"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.animation`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
AUDIO = "audio"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.audio`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
CONTACT = "contact"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.contact`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
DICE = "dice"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.dice`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
DOCUMENT = "document"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.document`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
GAME = "game"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.game`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
INVOICE = "invoice"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.invoice`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
LOCATION = "location"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.location`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
PASSPORT_DATA = "passport_data"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.passport_data`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
PHOTO = "photo"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.photo`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
POLL = "poll"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.poll`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
STICKER = "sticker"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.sticker`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
SUCCESSFUL_PAYMENT = "successful_payment"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.successful_payment`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
VIDEO = "video"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.video`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
VIDEO_NOTE = "video_note"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.video_note`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
VOICE = "voice"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.voice`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
VENUE = "venue"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.venue`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
# -------------------------------------------------- Other types
|
|
|
|
TEXT = "text"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.text`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
NEW_CHAT_MEMBERS = "new_chat_members"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.new_chat_members`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
LEFT_CHAT_MEMBER = "left_chat_member"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.left_chat_member`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
NEW_CHAT_TITLE = "new_chat_title"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.new_chat_title`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
NEW_CHAT_PHOTO = "new_chat_photo"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.new_chat_photo`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
DELETE_CHAT_PHOTO = "delete_chat_photo"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.delete_chat_photo`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
GROUP_CHAT_CREATED = "group_chat_created"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.group_chat_created`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
SUPERGROUP_CHAT_CREATED = "supergroup_chat_created"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.supergroup_chat_created`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
CHANNEL_CHAT_CREATED = "channel_chat_created"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.channel_chat_created`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
MESSAGE_AUTO_DELETE_TIMER_CHANGED = "message_auto_delete_timer_changed"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.message_auto_delete_timer_changed`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
MIGRATE_TO_CHAT_ID = "migrate_to_chat_id"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.migrate_to_chat_id`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
MIGRATE_FROM_CHAT_ID = "migrate_from_chat_id"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.migrate_from_chat_id`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
PINNED_MESSAGE = "pinned_message"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.pinned_message`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
PROXIMITY_ALERT_TRIGGERED = "proximity_alert_triggered"
|
2022-02-09 17:30:16 +01:00
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.proximity_alert_triggered`."""
|
2022-05-03 18:21:50 +02:00
|
|
|
VIDEO_CHAT_SCHEDULED = "video_chat_scheduled"
|
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.video_chat_scheduled`."""
|
|
|
|
VIDEO_CHAT_STARTED = "video_chat_started"
|
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.video_chat_started`."""
|
|
|
|
VIDEO_CHAT_ENDED = "video_chat_ended"
|
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.video_chat_ended`."""
|
|
|
|
VIDEO_CHAT_PARTICIPANTS_INVITED = "video_chat_participants_invited"
|
|
|
|
""":obj:`str`: Messages with :attr:`telegram.Message.video_chat_participants_invited`."""
|
2021-10-19 18:28:19 +02:00
|
|
|
|
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
class PollingLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :paramref:`telegram.Bot.get_updates.limit`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_LIMIT = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for the :paramref:`~telegram.Bot.get_updates.limit`
|
|
|
|
parameter of :meth:`telegram.Bot.get_updates`.
|
|
|
|
"""
|
|
|
|
MAX_LIMIT = 100
|
|
|
|
""":obj:`int`: Maximum value allowed for the :paramref:`~telegram.Bot.get_updates.limit`
|
|
|
|
parameter of :meth:`telegram.Bot.get_updates`.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class ReplyLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :class:`telegram.ForceReply`
|
|
|
|
and :class:`telegram.ReplyKeyboardMarkup`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_INPUT_FIELD_PLACEHOLDER = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for
|
|
|
|
:paramref:`~telegram.ForceReply.input_field_placeholder` parameter of
|
|
|
|
:class:`telegram.ForceReply` and
|
|
|
|
:paramref:`~telegram.ReplyKeyboardMarkup.input_field_placeholder` parameter of
|
|
|
|
:class:`telegram.ReplyKeyboardMarkup`
|
|
|
|
"""
|
|
|
|
MAX_INPUT_FIELD_PLACEHOLDER = 64
|
|
|
|
""":obj:`int`: Maximum value allowed for
|
|
|
|
:paramref:`~telegram.ForceReply.input_field_placeholder` parameter of
|
|
|
|
:class:`telegram.ForceReply` and
|
|
|
|
:paramref:`~telegram.ReplyKeyboardMarkup.input_field_placeholder` parameter of
|
|
|
|
:class:`telegram.ReplyKeyboardMarkup`
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2023-03-25 11:47:26 +01:00
|
|
|
class StickerFormat(StringEnum):
|
|
|
|
"""This enum contains the available formats of :class:`telegram.Sticker` in the set. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2023-03-25 13:25:59 +01:00
|
|
|
.. versionadded:: 20.2
|
2023-03-25 11:47:26 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
STATIC = "static"
|
|
|
|
""":obj:`str`: Static sticker."""
|
|
|
|
ANIMATED = "animated"
|
|
|
|
""":obj:`str`: Animated sticker."""
|
|
|
|
VIDEO = "video"
|
|
|
|
""":obj:`str`: Video sticker."""
|
|
|
|
|
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
class StickerLimit(IntEnum):
|
2023-03-25 11:47:26 +01:00
|
|
|
"""This enum contains limitations for various sticker methods, such as
|
|
|
|
:meth:`telegram.Bot.create_new_sticker_set`.
|
2022-11-22 11:07:42 +01:00
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_NAME_AND_TITLE = 1
|
|
|
|
""":obj:`int`: Minimum number of characters in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.create_new_sticker_set.name` parameter or the
|
|
|
|
:paramref:`~telegram.Bot.create_new_sticker_set.title` parameter of
|
|
|
|
:meth:`telegram.Bot.create_new_sticker_set`.
|
|
|
|
"""
|
|
|
|
MAX_NAME_AND_TITLE = 64
|
|
|
|
""":obj:`int`: Maximum number of characters in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.create_new_sticker_set.name` parameter or the
|
|
|
|
:paramref:`~telegram.Bot.create_new_sticker_set.title` parameter of
|
|
|
|
:meth:`telegram.Bot.create_new_sticker_set`.
|
|
|
|
"""
|
2023-03-25 11:47:26 +01:00
|
|
|
MIN_STICKER_EMOJI = 1
|
|
|
|
""":obj:`int`: Minimum number of emojis associated with a sticker, passed as the
|
|
|
|
:paramref:`~telegram.Bot.setStickerEmojiList.emoji_list` parameter of
|
|
|
|
:meth:`telegram.Bot.set_sticker_emoji_list`.
|
|
|
|
|
2023-03-25 13:25:59 +01:00
|
|
|
.. versionadded:: 20.2
|
2023-03-25 11:47:26 +01:00
|
|
|
"""
|
|
|
|
MAX_STICKER_EMOJI = 20
|
|
|
|
""":obj:`int`: Maximum number of emojis associated with a sticker, passed as the
|
|
|
|
:paramref:`~telegram.Bot.setStickerEmojiList.emoji_list` parameter of
|
|
|
|
:meth:`telegram.Bot.set_sticker_emoji_list`.
|
|
|
|
|
2023-03-25 13:25:59 +01:00
|
|
|
.. versionadded:: 20.2
|
2023-03-25 11:47:26 +01:00
|
|
|
"""
|
|
|
|
MAX_SEARCH_KEYWORDS = 20
|
|
|
|
""":obj:`int`: Maximum number of search keywords for a sticker, passed as the
|
|
|
|
:paramref:`~telegram.Bot.set_sticker_keywords.keywords` parameter of
|
|
|
|
:meth:`telegram.Bot.set_sticker_keywords`.
|
|
|
|
|
2023-03-25 13:25:59 +01:00
|
|
|
.. versionadded:: 20.2
|
2023-03-25 11:47:26 +01:00
|
|
|
"""
|
|
|
|
MAX_KEYWORD_LENGTH = 64
|
|
|
|
""":obj:`int`: Maximum number of characters in a search keyword for a sticker, for each item in
|
|
|
|
:paramref:`~telegram.Bot.set_sticker_keywords.keywords` sequence of
|
|
|
|
:meth:`telegram.Bot.set_sticker_keywords`.
|
|
|
|
|
2023-03-25 13:25:59 +01:00
|
|
|
.. versionadded:: 20.2
|
2023-03-25 11:47:26 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class StickerSetLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for various sticker set methods, such as
|
|
|
|
:meth:`telegram.Bot.create_new_sticker_set` and :meth:`telegram.Bot.add_sticker_to_set`.
|
|
|
|
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
2023-03-25 13:25:59 +01:00
|
|
|
.. versionadded:: 20.2
|
2023-03-25 11:47:26 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_INITIAL_STICKERS = 1
|
|
|
|
""":obj:`int`: Minimum number of stickers needed to create a sticker set, passed as the
|
|
|
|
:paramref:`~telegram.Bot.create_new_sticker_set.stickers` parameter of
|
|
|
|
:meth:`telegram.Bot.create_new_sticker_set`.
|
|
|
|
"""
|
|
|
|
MAX_INITIAL_STICKERS = 50
|
|
|
|
""":obj:`int`: Maximum number of stickers allowed while creating a sticker set, passed as the
|
|
|
|
:paramref:`~telegram.Bot.create_new_sticker_set.stickers` parameter of
|
|
|
|
:meth:`telegram.Bot.create_new_sticker_set`.
|
|
|
|
"""
|
|
|
|
MAX_EMOJI_STICKERS = 200
|
|
|
|
""":obj:`int`: Maximum number of stickers allowed in an emoji sticker set, as given in
|
|
|
|
:meth:`telegram.Bot.add_sticker_to_set`.
|
|
|
|
"""
|
|
|
|
MAX_ANIMATED_STICKERS = 50
|
|
|
|
""":obj:`int`: Maximum number of stickers allowed in an animated or video sticker set, as given
|
|
|
|
in :meth:`telegram.Bot.add_sticker_to_set`.
|
|
|
|
"""
|
|
|
|
MAX_STATIC_STICKERS = 120
|
|
|
|
""":obj:`int`: Maximum number of stickers allowed in a static sticker set, as given in
|
|
|
|
:meth:`telegram.Bot.add_sticker_to_set`.
|
|
|
|
"""
|
|
|
|
MAX_STATIC_THUMBNAIL_SIZE = 128
|
|
|
|
""":obj:`int`: Maximum size of the thumbnail if it is a **.WEBP** or **.PNG** in kilobytes,
|
|
|
|
as given in :meth:`telegram.Bot.set_sticker_set_thumbnail`."""
|
|
|
|
MAX_ANIMATED_THUMBNAIL_SIZE = 32
|
|
|
|
""":obj:`int`: Maximum size of the thumbnail if it is a **.TGS** or **.WEBM** in kilobytes,
|
|
|
|
as given in :meth:`telegram.Bot.set_sticker_set_thumbnail`."""
|
|
|
|
STATIC_THUMB_DIMENSIONS = 100
|
|
|
|
""":obj:`int`: Exact height and width of the thumbnail if it is a **.WEBP** or **.PNG** in
|
|
|
|
pixels, as given in :meth:`telegram.Bot.set_sticker_set_thumbnail`."""
|
2022-11-22 11:07:42 +01:00
|
|
|
|
|
|
|
|
2022-08-25 19:36:55 +02:00
|
|
|
class StickerType(StringEnum):
|
|
|
|
"""This enum contains the available types of :class:`telegram.Sticker`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
REGULAR = "regular"
|
|
|
|
""":obj:`str`: Regular sticker."""
|
|
|
|
MASK = "mask"
|
|
|
|
""":obj:`str`: Mask sticker."""
|
|
|
|
CUSTOM_EMOJI = "custom_emoji"
|
|
|
|
""":obj:`str`: Custom emoji sticker."""
|
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class ParseMode(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available parse modes. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MARKDOWN = "Markdown"
|
|
|
|
""":obj:`str`: Markdown parse mode.
|
|
|
|
|
|
|
|
Note:
|
|
|
|
:attr:`MARKDOWN` is a legacy mode, retained by Telegram for backward compatibility.
|
|
|
|
You should use :attr:`MARKDOWN_V2` instead.
|
|
|
|
"""
|
|
|
|
MARKDOWN_V2 = "MarkdownV2"
|
|
|
|
""":obj:`str`: Markdown parse mode version 2."""
|
|
|
|
HTML = "HTML"
|
|
|
|
""":obj:`str`: HTML parse mode."""
|
|
|
|
|
|
|
|
|
|
|
|
class PollLimit(IntEnum):
|
2022-11-22 11:07:42 +01:00
|
|
|
"""This enum contains limitations for :class:`telegram.Poll`/:class:`telegram.PollOption`/
|
2021-10-19 18:28:19 +02:00
|
|
|
:meth:`telegram.Bot.send_poll`. The enum
|
|
|
|
members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
MIN_QUESTION_LENGTH = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for the :paramref:`~telegram.Poll.question`
|
|
|
|
parameter of :class:`telegram.Poll` and the :paramref:`~telegram.Bot.send_poll.question`
|
|
|
|
parameter of :meth:`telegram.Bot.send_poll`.
|
|
|
|
"""
|
|
|
|
MAX_QUESTION_LENGTH = 300
|
|
|
|
""":obj:`int`: Maximum value allowed for the :paramref:`~telegram.Poll.question`
|
|
|
|
parameter of :class:`telegram.Poll` and the :paramref:`~telegram.Bot.send_poll.question`
|
|
|
|
parameter of :meth:`telegram.Bot.send_poll`.
|
|
|
|
"""
|
|
|
|
MIN_OPTION_LENGTH = 1
|
|
|
|
""":obj:`int`: Minimum length of each :obj:`str` passed in a :obj:`list`
|
|
|
|
to the :paramref:`~telegram.Bot.send_poll.options` parameter of
|
|
|
|
:meth:`telegram.Bot.send_poll`.
|
|
|
|
"""
|
|
|
|
MAX_OPTION_LENGTH = 100
|
|
|
|
""":obj:`int`: Maximum length of each :obj:`str` passed in a :obj:`list`
|
|
|
|
to the :paramref:`~telegram.Bot.send_poll.options` parameter of
|
|
|
|
:meth:`telegram.Bot.send_poll`.
|
|
|
|
"""
|
|
|
|
MIN_OPTION_NUMBER = 2
|
|
|
|
""":obj:`int`: Minimum number of strings passed in a :obj:`list`
|
|
|
|
to the :paramref:`~telegram.Bot.send_poll.options` parameter of
|
|
|
|
:meth:`telegram.Bot.send_poll`.
|
|
|
|
"""
|
|
|
|
MAX_OPTION_NUMBER = 10
|
|
|
|
""":obj:`int`: Maximum number of strings passed in a :obj:`list`
|
|
|
|
to the :paramref:`~telegram.Bot.send_poll.options` parameter of
|
|
|
|
:meth:`telegram.Bot.send_poll`.
|
|
|
|
"""
|
|
|
|
MAX_EXPLANATION_LENGTH = 200
|
|
|
|
""":obj:`int`: Maximum number of characters in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Poll.explanation` parameter of :class:`telegram.Poll` and the
|
|
|
|
:paramref:`~telegram.Bot.send_poll.explanation` parameter of :meth:`telegram.Bot.send_poll`.
|
|
|
|
"""
|
|
|
|
MAX_EXPLANATION_LINE_FEEDS = 2
|
|
|
|
""":obj:`int`: Maximum number of line feeds in a :obj:`str` passed as the
|
|
|
|
:paramref:`~telegram.Bot.send_poll.explanation` parameter of :meth:`telegram.Bot.send_poll`
|
|
|
|
after entities parsing.
|
|
|
|
"""
|
|
|
|
MIN_OPEN_PERIOD = 5
|
|
|
|
""":obj:`int`: Minimum value allowed for the
|
|
|
|
:paramref:`~telegram.Bot.send_poll.open_period` parameter of :meth:`telegram.Bot.send_poll`.
|
|
|
|
Also used in the :paramref:`~telegram.Bot.send_poll.close_date` parameter of
|
|
|
|
:meth:`telegram.Bot.send_poll`.
|
|
|
|
"""
|
|
|
|
MAX_OPEN_PERIOD = 600
|
|
|
|
""":obj:`int`: Maximum value allowed for the
|
|
|
|
:paramref:`~telegram.Bot.send_poll.open_period` parameter of :meth:`telegram.Bot.send_poll`.
|
|
|
|
Also used in the :paramref:`~telegram.Bot.send_poll.close_date` parameter of
|
|
|
|
:meth:`telegram.Bot.send_poll`.
|
|
|
|
"""
|
2021-10-19 18:28:19 +02:00
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class PollType(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available types for :class:`telegram.Poll`/
|
|
|
|
:meth:`telegram.Bot.send_poll`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
REGULAR = "regular"
|
|
|
|
""":obj:`str`: regular polls."""
|
|
|
|
QUIZ = "quiz"
|
|
|
|
""":obj:`str`: quiz polls."""
|
|
|
|
|
|
|
|
|
2022-04-24 12:38:09 +02:00
|
|
|
class UpdateType(StringEnum):
|
2021-10-19 18:28:19 +02:00
|
|
|
"""This enum contains the available types of :class:`telegram.Update`. The enum
|
|
|
|
members of this enumeration are instances of :class:`str` and can be treated as such.
|
|
|
|
|
2022-05-06 17:15:23 +02:00
|
|
|
.. versionadded:: 20.0
|
2021-10-19 18:28:19 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MESSAGE = "message"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.message`."""
|
|
|
|
EDITED_MESSAGE = "edited_message"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.edited_message`."""
|
|
|
|
CHANNEL_POST = "channel_post"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.channel_post`."""
|
|
|
|
EDITED_CHANNEL_POST = "edited_channel_post"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.edited_channel_post`."""
|
|
|
|
INLINE_QUERY = "inline_query"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.inline_query`."""
|
|
|
|
CHOSEN_INLINE_RESULT = "chosen_inline_result"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.chosen_inline_result`."""
|
|
|
|
CALLBACK_QUERY = "callback_query"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.callback_query`."""
|
|
|
|
SHIPPING_QUERY = "shipping_query"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.shipping_query`."""
|
|
|
|
PRE_CHECKOUT_QUERY = "pre_checkout_query"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.pre_checkout_query`."""
|
|
|
|
POLL = "poll"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.poll`."""
|
|
|
|
POLL_ANSWER = "poll_answer"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.poll_answer`."""
|
|
|
|
MY_CHAT_MEMBER = "my_chat_member"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.my_chat_member`."""
|
|
|
|
CHAT_MEMBER = "chat_member"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.chat_member`."""
|
|
|
|
CHAT_JOIN_REQUEST = "chat_join_request"
|
|
|
|
""":obj:`str`: Updates with :attr:`telegram.Update.chat_join_request`."""
|
2022-06-27 18:54:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
class InvoiceLimit(IntEnum):
|
2022-12-30 14:09:06 +01:00
|
|
|
"""This enum contains limitations for :class:`telegram.InputInvoiceMessageContent`,
|
|
|
|
:meth:`telegram.Bot.send_invoice`, and :meth:`telegram.Bot.create_invoice_link`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
2022-06-27 18:54:11 +02:00
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_TITLE_LENGTH = 1
|
2022-11-22 11:07:42 +01:00
|
|
|
""":obj:`int`: Minimum number of characters in a :obj:`str` passed as:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.InputInvoiceMessageContent.title` parameter of
|
|
|
|
:class:`telegram.InputInvoiceMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.send_invoice.title` parameter of
|
|
|
|
:meth:`telegram.Bot.send_invoice`.
|
|
|
|
* :paramref:`~telegram.Bot.create_invoice_link.title` parameter of
|
|
|
|
:meth:`telegram.Bot.create_invoice_link`.
|
|
|
|
"""
|
2022-06-27 18:54:11 +02:00
|
|
|
MAX_TITLE_LENGTH = 32
|
2022-11-22 11:07:42 +01:00
|
|
|
""":obj:`int`: Maximum number of characters in a :obj:`str` passed as:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.InputInvoiceMessageContent.title` parameter of
|
|
|
|
:class:`telegram.InputInvoiceMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.send_invoice.title` parameter of
|
|
|
|
:meth:`telegram.Bot.send_invoice`.
|
|
|
|
* :paramref:`~telegram.Bot.create_invoice_link.title` parameter of
|
|
|
|
:meth:`telegram.Bot.create_invoice_link`.
|
|
|
|
"""
|
2022-06-27 18:54:11 +02:00
|
|
|
MIN_DESCRIPTION_LENGTH = 1
|
2022-11-22 11:07:42 +01:00
|
|
|
""":obj:`int`: Minimum number of characters in a :obj:`str` passed as:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.InputInvoiceMessageContent.description` parameter of
|
|
|
|
:class:`telegram.InputInvoiceMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.send_invoice.description` parameter of
|
|
|
|
:meth:`telegram.Bot.send_invoice`.
|
|
|
|
* :paramref:`~telegram.Bot.create_invoice_link.description` parameter of
|
|
|
|
:meth:`telegram.Bot.create_invoice_link`.
|
|
|
|
"""
|
2022-06-27 18:54:11 +02:00
|
|
|
MAX_DESCRIPTION_LENGTH = 255
|
2022-11-22 11:07:42 +01:00
|
|
|
""":obj:`int`: Maximum number of characters in a :obj:`str` passed as:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.InputInvoiceMessageContent.description` parameter of
|
|
|
|
:class:`telegram.InputInvoiceMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.send_invoice.description` parameter of
|
|
|
|
:meth:`telegram.Bot.send_invoice`.
|
|
|
|
* :paramref:`~telegram.Bot.create_invoice_link.description` parameter of
|
|
|
|
:meth:`telegram.Bot.create_invoice_link`.
|
|
|
|
"""
|
2022-06-27 18:54:11 +02:00
|
|
|
MIN_PAYLOAD_LENGTH = 1
|
2022-11-22 11:07:42 +01:00
|
|
|
""":obj:`int`: Minimum amount of bytes in a :obj:`str` passed as:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.InputInvoiceMessageContent.payload` parameter of
|
|
|
|
:class:`telegram.InputInvoiceMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.send_invoice.payload` parameter of
|
|
|
|
:meth:`telegram.Bot.send_invoice`.
|
|
|
|
* :paramref:`~telegram.Bot.create_invoice_link.payload` parameter of
|
|
|
|
:meth:`telegram.Bot.create_invoice_link`.
|
|
|
|
"""
|
2022-06-27 18:54:11 +02:00
|
|
|
MAX_PAYLOAD_LENGTH = 128
|
2022-11-22 11:07:42 +01:00
|
|
|
""":obj:`int`: Maximum amount of bytes in a :obj:`str` passed as:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.InputInvoiceMessageContent.payload` parameter of
|
|
|
|
:class:`telegram.InputInvoiceMessageContent`
|
|
|
|
* :paramref:`~telegram.Bot.send_invoice.payload` parameter of
|
|
|
|
:meth:`telegram.Bot.send_invoice`.
|
|
|
|
* :paramref:`~telegram.Bot.create_invoice_link.payload` parameter of
|
|
|
|
:meth:`telegram.Bot.create_invoice_link`.
|
|
|
|
"""
|
2022-12-30 14:09:06 +01:00
|
|
|
MAX_TIP_AMOUNTS = 4
|
|
|
|
""":obj:`int`: Maximum length of a :obj:`Sequence` passed as:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.Bot.send_invoice.suggested_tip_amounts` parameter of
|
|
|
|
:meth:`telegram.Bot.send_invoice`.
|
|
|
|
* :paramref:`~telegram.Bot.create_invoice_link.suggested_tip_amounts` parameter of
|
|
|
|
:meth:`telegram.Bot.create_invoice_link`.
|
|
|
|
"""
|
2022-11-22 11:07:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
class UserProfilePhotosLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :paramref:`telegram.Bot.get_user_profile_photos.limit`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_LIMIT = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for
|
|
|
|
:paramref:`~telegram.Bot.get_user_profile_photos.limit` parameter of
|
|
|
|
:meth:`telegram.Bot.get_user_profile_photos`.
|
|
|
|
"""
|
|
|
|
MAX_LIMIT = 100
|
|
|
|
""":obj:`int`: Maximum value allowed for
|
|
|
|
:paramref:`~telegram.Bot.get_user_profile_photos.limit` parameter of
|
|
|
|
:meth:`telegram.Bot.get_user_profile_photos`.
|
|
|
|
"""
|
2022-06-27 18:54:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
class WebhookLimit(IntEnum):
|
2022-11-22 11:07:42 +01:00
|
|
|
"""This enum contains limitations for :paramref:`telegram.Bot.set_webhook.max_connections` and
|
|
|
|
:paramref:`telegram.Bot.set_webhook.secret_token`. The enum members of this enumeration are
|
|
|
|
instances of :class:`int` and can be treated as such.
|
2022-06-27 18:54:11 +02:00
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
2022-11-22 11:07:42 +01:00
|
|
|
MIN_CONNECTIONS_LIMIT = 1
|
|
|
|
""":obj:`int`: Minimum value allowed for the
|
|
|
|
:paramref:`~telegram.Bot.set_webhook.max_connections` parameter of
|
|
|
|
:meth:`telegram.Bot.set_webhook`.
|
|
|
|
"""
|
|
|
|
MAX_CONNECTIONS_LIMIT = 100
|
|
|
|
""":obj:`int`: Maximum value allowed for the
|
|
|
|
:paramref:`~telegram.Bot.set_webhook.max_connections` parameter of
|
|
|
|
:meth:`telegram.Bot.set_webhook`.
|
|
|
|
"""
|
2022-06-27 18:54:11 +02:00
|
|
|
MIN_SECRET_TOKEN_LENGTH = 1
|
2022-11-22 11:07:42 +01:00
|
|
|
""":obj:`int`: Minimum length of the secret token for the
|
|
|
|
:paramref:`~telegram.Bot.set_webhook.secret_token` parameter of
|
|
|
|
:meth:`telegram.Bot.set_webhook`.
|
|
|
|
"""
|
2022-06-27 18:54:11 +02:00
|
|
|
MAX_SECRET_TOKEN_LENGTH = 256
|
2022-11-22 11:07:42 +01:00
|
|
|
""":obj:`int`: Maximum length of the secret token for the
|
|
|
|
:paramref:`~telegram.Bot.set_webhook.secret_token` parameter of
|
|
|
|
:meth:`telegram.Bot.set_webhook`.
|
|
|
|
"""
|
2022-11-22 10:43:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ForumTopicLimit(IntEnum):
|
|
|
|
"""This enum contains limitations for :paramref:`telegram.Bot.create_forum_topic.name` and
|
|
|
|
:paramref:`telegram.Bot.edit_forum_topic.name`.
|
|
|
|
The enum members of this enumeration are instances of :class:`int` and can be treated as such.
|
|
|
|
|
|
|
|
.. versionadded:: 20.0
|
|
|
|
"""
|
|
|
|
|
|
|
|
__slots__ = ()
|
|
|
|
|
|
|
|
MIN_NAME_LENGTH = 1
|
2023-01-01 17:00:49 +01:00
|
|
|
""":obj:`int`: Minimum length of a :obj:`str` passed as:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.Bot.create_forum_topic.name` parameter of
|
|
|
|
:meth:`telegram.Bot.create_forum_topic`
|
|
|
|
* :paramref:`~telegram.Bot.edit_forum_topic.name` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_forum_topic`
|
|
|
|
* :paramref:`~telegram.Bot.edit_general_forum_topic.name` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_general_forum_topic`
|
2022-11-22 10:43:50 +01:00
|
|
|
"""
|
|
|
|
MAX_NAME_LENGTH = 128
|
2023-01-01 17:00:49 +01:00
|
|
|
""":obj:`int`: Maximum length of a :obj:`str` passed as:
|
|
|
|
|
|
|
|
* :paramref:`~telegram.Bot.create_forum_topic.name` parameter of
|
|
|
|
:meth:`telegram.Bot.create_forum_topic`
|
|
|
|
* :paramref:`~telegram.Bot.edit_forum_topic.name` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_forum_topic`
|
|
|
|
* :paramref:`~telegram.Bot.edit_general_forum_topic.name` parameter of
|
|
|
|
:meth:`telegram.Bot.edit_general_forum_topic`
|
2022-11-22 10:43:50 +01:00
|
|
|
"""
|