mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-17 04:39:55 +01:00
Overhaul Constants (#2137)
* Move all constants to constants.py and documentation refactor. * Move all constants to constants.py and documentation refactor. * Overhaul constants * Overhaul constants * Minor docstring change Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
This commit is contained in:
parent
9ae48fecfe
commit
3b4559dd95
10 changed files with 267 additions and 122 deletions
|
@ -62,6 +62,7 @@ The following wonderful people contributed directly or indirectly to this projec
|
|||
- `Mischa Krüger <https://github.com/Makman2>`_
|
||||
- `naveenvhegde <https://github.com/naveenvhegde>`_
|
||||
- `neurrone <https://github.com/neurrone>`_
|
||||
- `NikitaPirate <https://github.com/NikitaPirate>`_
|
||||
- `njittam <https://github.com/njittam>`_
|
||||
- `Noam Meltzer <https://github.com/tsnoam>`_
|
||||
- `Oleg Shlyazhko <https://github.com/ollmer>`_
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
"""This module contains an object that represents a Telegram Chat."""
|
||||
|
||||
from telegram import TelegramObject, ChatPhoto
|
||||
from telegram import TelegramObject, ChatPhoto, constants
|
||||
from .chatpermissions import ChatPermissions
|
||||
|
||||
from telegram.utils.types import JSONDict
|
||||
|
@ -92,14 +92,14 @@ class Chat(TelegramObject):
|
|||
|
||||
"""
|
||||
|
||||
PRIVATE: str = 'private'
|
||||
""":obj:`str`: 'private'"""
|
||||
GROUP: str = 'group'
|
||||
""":obj:`str`: 'group'"""
|
||||
SUPERGROUP: str = 'supergroup'
|
||||
""":obj:`str`: 'supergroup'"""
|
||||
CHANNEL: str = 'channel'
|
||||
""":obj:`str`: 'channel'"""
|
||||
PRIVATE: str = constants.CHAT_PRIVATE
|
||||
""":const:`telegram.constants.CHAT_PRIVATE`"""
|
||||
GROUP: str = constants.CHAT_GROUP
|
||||
""":const:`telegram.constants.CHAT_GROUP`"""
|
||||
SUPERGROUP: str = constants.CHAT_SUPERGROUP
|
||||
""":const:`telegram.constants.CHAT_SUPERGROUP`"""
|
||||
CHANNEL: str = constants.CHAT_CHANNEL
|
||||
""":const:`telegram.constants.CHAT_CHANNEL`"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
|
@ -18,28 +18,29 @@
|
|||
# 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 an object that represents a Telegram ChatAction."""
|
||||
from telegram import constants
|
||||
|
||||
|
||||
class ChatAction:
|
||||
"""Helper class to provide constants for different chat actions."""
|
||||
|
||||
FIND_LOCATION: str = 'find_location'
|
||||
""":obj:`str`: 'find_location'"""
|
||||
RECORD_AUDIO: str = 'record_audio'
|
||||
""":obj:`str`: 'record_audio'"""
|
||||
RECORD_VIDEO: str = 'record_video'
|
||||
""":obj:`str`: 'record_video'"""
|
||||
RECORD_VIDEO_NOTE: str = 'record_video_note'
|
||||
""":obj:`str`: 'record_video_note'"""
|
||||
TYPING: str = 'typing'
|
||||
""":obj:`str`: 'typing'"""
|
||||
UPLOAD_AUDIO: str = 'upload_audio'
|
||||
""":obj:`str`: 'upload_audio'"""
|
||||
UPLOAD_DOCUMENT: str = 'upload_document'
|
||||
""":obj:`str`: 'upload_document'"""
|
||||
UPLOAD_PHOTO: str = 'upload_photo'
|
||||
""":obj:`str`: 'upload_photo'"""
|
||||
UPLOAD_VIDEO: str = 'upload_video'
|
||||
""":obj:`str`: 'upload_video'"""
|
||||
UPLOAD_VIDEO_NOTE: str = 'upload_video_note'
|
||||
""":obj:`str`: 'upload_video_note'"""
|
||||
FIND_LOCATION: str = constants.CHATACTION_FIND_LOCATION
|
||||
""":const:`telegram.constants.CHATACTION_FIND_LOCATION`"""
|
||||
RECORD_AUDIO: str = constants.CHATACTION_RECORD_AUDIO
|
||||
""":const:`telegram.constants.CHATACTION_RECORD_AUDIO`"""
|
||||
RECORD_VIDEO: str = constants.CHATACTION_RECORD_VIDEO
|
||||
""":const:`telegram.constants.CHATACTION_RECORD_VIDEO`"""
|
||||
RECORD_VIDEO_NOTE: str = constants.CHATACTION_RECORD_VIDEO_NOTE
|
||||
""":const:`telegram.constants.CHATACTION_RECORD_VIDEO_NOTE`"""
|
||||
TYPING: str = constants.CHATACTION_TYPING
|
||||
""":const:`telegram.constants.CHATACTION_TYPING`"""
|
||||
UPLOAD_AUDIO: str = constants.CHATACTION_UPLOAD_AUDIO
|
||||
""":const:`telegram.constants.CHATACTION_UPLOAD_AUDIO`"""
|
||||
UPLOAD_DOCUMENT: str = constants.CHATACTION_UPLOAD_DOCUMENT
|
||||
""":const:`telegram.constants.CHATACTION_UPLOAD_DOCUMENT`"""
|
||||
UPLOAD_PHOTO: str = constants.CHATACTION_UPLOAD_PHOTO
|
||||
""":const:`telegram.constants.CHATACTION_UPLOAD_PHOTO`"""
|
||||
UPLOAD_VIDEO: str = constants.CHATACTION_UPLOAD_VIDEO
|
||||
""":const:`telegram.constants.CHATACTION_UPLOAD_VIDEO`"""
|
||||
UPLOAD_VIDEO_NOTE: str = constants.CHATACTION_UPLOAD_VIDEO_NOTE
|
||||
""":const:`telegram.constants.CHATACTION_UPLOAD_VIDEO_NOTE`"""
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"""This module contains an object that represents a Telegram ChatMember."""
|
||||
import datetime
|
||||
|
||||
from telegram import User, TelegramObject
|
||||
from telegram import User, TelegramObject, constants
|
||||
from telegram.utils.helpers import to_timestamp, from_timestamp
|
||||
|
||||
from telegram.utils.types import JSONDict
|
||||
|
@ -111,19 +111,18 @@ class ChatMember(TelegramObject):
|
|||
may add web page previews to his messages.
|
||||
|
||||
"""
|
||||
|
||||
ADMINISTRATOR: str = 'administrator'
|
||||
""":obj:`str`: 'administrator'"""
|
||||
CREATOR: str = 'creator'
|
||||
""":obj:`str`: 'creator'"""
|
||||
KICKED: str = 'kicked'
|
||||
""":obj:`str`: 'kicked'"""
|
||||
LEFT: str = 'left'
|
||||
""":obj:`str`: 'left'"""
|
||||
MEMBER: str = 'member'
|
||||
""":obj:`str`: 'member'"""
|
||||
RESTRICTED: str = 'restricted'
|
||||
""":obj:`str`: 'restricted'"""
|
||||
ADMINISTRATOR: str = constants.CHATMEMBER_ADMINISTRATOR
|
||||
""":const:`telegram.constants.CHATMEMBER_ADMINISTRATOR`"""
|
||||
CREATOR: str = constants.CHATMEMBER_CREATOR
|
||||
""":const:`telegram.constants.CHATMEMBER_CREATOR`"""
|
||||
KICKED: str = constants.CHATMEMBER_KICKED
|
||||
""":const:`telegram.constants.CHATMEMBER_KICKED`"""
|
||||
LEFT: str = constants.CHATMEMBER_LEFT
|
||||
""":const:`telegram.constants.CHATMEMBER_LEFT`"""
|
||||
MEMBER: str = constants.CHATMEMBER_MEMBER
|
||||
""":const:`telegram.constants.CHATMEMBER_MEMBER`"""
|
||||
RESTRICTED: str = constants.CHATMEMBER_RESTRICTED
|
||||
""":const:`telegram.constants.CHATMEMBER_RESTRICTED`"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
|
@ -39,6 +39,90 @@ Attributes:
|
|||
MAX_MESSAGE_ENTITIES (:obj:`int`): 100 (Beyond this cap telegram will simply ignore further
|
||||
formatting styles)
|
||||
|
||||
The following constants are related to specific classes and are also available
|
||||
as attributes of those classes:
|
||||
|
||||
:class:`telegram.Chat`:
|
||||
|
||||
Attributes:
|
||||
CHAT_PRIVATE (:obj:`str`): 'private'
|
||||
CHAT_GROUP (:obj:`str`): 'group'
|
||||
CHAT_SUPERGROUP (:obj:`str`): 'supergroup'
|
||||
CHAT_CHANNEL (:obj:`str`): 'channel'
|
||||
|
||||
:class:`telegram.ChatAction`:
|
||||
|
||||
Attributes:
|
||||
CHATACTION_FIND_LOCATION (:obj:`str`): 'find_location'
|
||||
CHATACTION_RECORD_AUDIO (:obj:`str`): 'record_audio'
|
||||
CHATACTION_RECORD_VIDEO (:obj:`str`): 'record_video'
|
||||
CHATACTION_RECORD_VIDEO_NOTE (:obj:`str`): 'record_video_note'
|
||||
CHATACTION_TYPING (:obj:`str`): 'typing'
|
||||
CHATACTION_UPLOAD_AUDIO (:obj:`str`): 'upload_audio'
|
||||
CHATACTION_UPLOAD_DOCUMENT (:obj:`str`): 'upload_document'
|
||||
CHATACTION_UPLOAD_PHOTO (:obj:`str`): 'upload_photo'
|
||||
CHATACTION_UPLOAD_VIDEO (:obj:`str`): 'upload_video'
|
||||
CHATACTION_UPLOAD_VIDEO_NOTE (:obj:`str`): 'upload_video_note'
|
||||
|
||||
:class:`telegram.ChatMember`:
|
||||
|
||||
Attributes:
|
||||
CHATMEMBER_ADMINISTRATOR (:obj:`str`): 'administrator'
|
||||
CHATMEMBER_CREATOR (:obj:`str`): 'creator'
|
||||
CHATMEMBER_KICKED (:obj:`str`): 'kicked'
|
||||
CHATMEMBER_LEFT (:obj:`str`): 'left'
|
||||
CHATMEMBER_MEMBER (:obj:`str`): 'member'
|
||||
CHATMEMBER_RESTRICTED (:obj:`str`): 'restricted'
|
||||
|
||||
:class:`telegram.Dice`:
|
||||
|
||||
Attributes:
|
||||
DICE_DICE (:obj:`str`): '🎲'
|
||||
DICE_DARTS (:obj:`str`): '🎯'
|
||||
DICE_BASKETBALL (:obj:`str`): '🏀'
|
||||
DICE_ALL_EMOJI (List[:obj:`str`]): List of all supported base emoji.
|
||||
|
||||
:class:`telegram.MessageEntity`:
|
||||
|
||||
Attributes:
|
||||
MESSAGEENTITY_MENTION (:obj:`str`): 'mention'
|
||||
MESSAGEENTITY_HASHTAG (:obj:`str`): 'hashtag'
|
||||
MESSAGEENTITY_CASHTAG (:obj:`str`): 'cashtag'
|
||||
MESSAGEENTITY_PHONE_NUMBER (:obj:`str`): 'phone_number'
|
||||
MESSAGEENTITY_BOT_COMMAND (:obj:`str`): 'bot_command'
|
||||
MESSAGEENTITY_URL (:obj:`str`): 'url'
|
||||
MESSAGEENTITY_EMAIL (:obj:`str`): 'email'
|
||||
MESSAGEENTITY_BOLD (:obj:`str`): 'bold'
|
||||
MESSAGEENTITY_ITALIC (:obj:`str`): 'italic'
|
||||
MESSAGEENTITY_CODE (:obj:`str`): 'code'
|
||||
MESSAGEENTITY_PRE (:obj:`str`): 'pre'
|
||||
MESSAGEENTITY_TEXT_LINK (:obj:`str`): 'text_link'
|
||||
MESSAGEENTITY_TEXT_MENTION (:obj:`str`): 'text_mention'
|
||||
MESSAGEENTITY_UNDERLINE (:obj:`str`): 'underline'
|
||||
MESSAGEENTITY_STRIKETHROUGH (:obj:`str`): 'strikethrough'
|
||||
MESSAGEENTITY_ALL_TYPES (List[:obj:`str`]): List of all the types of message entity.
|
||||
|
||||
:class:`telegram.ParseMode`:
|
||||
|
||||
Attributes:
|
||||
PARSEMODE_MARKDOWN (:obj:`str`): 'Markdown'
|
||||
PARSEMODE_MARKDOWN_V2 (:obj:`str`): 'MarkdownV2'
|
||||
PARSEMODE_HTML (:obj:`str`): 'HTML'
|
||||
|
||||
:class:`telegram.Poll`:
|
||||
|
||||
Attributes:
|
||||
POLL_REGULAR (:obj:`str`): 'regular'
|
||||
POLL_QUIZ (:obj:`str`): 'quiz'
|
||||
|
||||
:class:`telegram.files.MaskPosition`:
|
||||
|
||||
Attributes:
|
||||
STICKER_FOREHEAD (:obj:`str`): 'forehead'
|
||||
STICKER_EYES (:obj:`str`): 'eyes'
|
||||
STICKER_MOUTH (:obj:`str`): 'mouth'
|
||||
STICKER_CHIN (:obj:`str`): 'chin'
|
||||
|
||||
"""
|
||||
from typing import List
|
||||
|
||||
|
@ -56,3 +140,77 @@ MAX_MESSAGES_PER_SECOND: int = 30
|
|||
MAX_MESSAGES_PER_MINUTE_PER_GROUP: int = 20
|
||||
MAX_MESSAGE_ENTITIES: int = 100
|
||||
MAX_INLINE_QUERY_RESULTS: int = 50
|
||||
|
||||
CHAT_PRIVATE: str = 'private'
|
||||
CHAT_GROUP: str = 'group'
|
||||
CHAT_SUPERGROUP: str = 'supergroup'
|
||||
CHAT_CHANNEL: str = 'channel'
|
||||
|
||||
CHATACTION_FIND_LOCATION: str = 'find_location'
|
||||
CHATACTION_RECORD_AUDIO: str = 'record_audio'
|
||||
CHATACTION_RECORD_VIDEO: str = 'record_video'
|
||||
CHATACTION_RECORD_VIDEO_NOTE: str = 'record_video_note'
|
||||
CHATACTION_TYPING: str = 'typing'
|
||||
CHATACTION_UPLOAD_AUDIO: str = 'upload_audio'
|
||||
CHATACTION_UPLOAD_DOCUMENT: str = 'upload_document'
|
||||
CHATACTION_UPLOAD_PHOTO: str = 'upload_photo'
|
||||
CHATACTION_UPLOAD_VIDEO: str = 'upload_video'
|
||||
CHATACTION_UPLOAD_VIDEO_NOTE: str = 'upload_video_note'
|
||||
|
||||
CHATMEMBER_ADMINISTRATOR: str = 'administrator'
|
||||
CHATMEMBER_CREATOR: str = 'creator'
|
||||
CHATMEMBER_KICKED: str = 'kicked'
|
||||
CHATMEMBER_LEFT: str = 'left'
|
||||
CHATMEMBER_MEMBER: str = 'member'
|
||||
CHATMEMBER_RESTRICTED: str = 'restricted'
|
||||
|
||||
DICE_DICE: str = '🎲'
|
||||
DICE_DARTS: str = '🎯'
|
||||
DICE_BASKETBALL: str = '🏀'
|
||||
DICE_ALL_EMOJI: List[str] = [DICE_DICE, DICE_DARTS, DICE_BASKETBALL]
|
||||
|
||||
MESSAGEENTITY_MENTION: str = 'mention'
|
||||
MESSAGEENTITY_HASHTAG: str = 'hashtag'
|
||||
MESSAGEENTITY_CASHTAG: str = 'cashtag'
|
||||
MESSAGEENTITY_PHONE_NUMBER: str = 'phone_number'
|
||||
MESSAGEENTITY_BOT_COMMAND: str = 'bot_command'
|
||||
MESSAGEENTITY_URL: str = 'url'
|
||||
MESSAGEENTITY_EMAIL: str = 'email'
|
||||
MESSAGEENTITY_BOLD: str = 'bold'
|
||||
MESSAGEENTITY_ITALIC: str = 'italic'
|
||||
MESSAGEENTITY_CODE: str = 'code'
|
||||
MESSAGEENTITY_PRE: str = 'pre'
|
||||
MESSAGEENTITY_TEXT_LINK: str = 'text_link'
|
||||
MESSAGEENTITY_TEXT_MENTION: str = 'text_mention'
|
||||
MESSAGEENTITY_UNDERLINE: str = 'underline'
|
||||
MESSAGEENTITY_STRIKETHROUGH: str = 'strikethrough'
|
||||
MESSAGEENTITY_ALL_TYPES: List[str] = [
|
||||
MESSAGEENTITY_MENTION,
|
||||
MESSAGEENTITY_HASHTAG,
|
||||
MESSAGEENTITY_CASHTAG,
|
||||
MESSAGEENTITY_PHONE_NUMBER,
|
||||
MESSAGEENTITY_BOT_COMMAND,
|
||||
MESSAGEENTITY_URL,
|
||||
MESSAGEENTITY_EMAIL,
|
||||
MESSAGEENTITY_BOLD,
|
||||
MESSAGEENTITY_ITALIC,
|
||||
MESSAGEENTITY_CODE,
|
||||
MESSAGEENTITY_PRE,
|
||||
MESSAGEENTITY_TEXT_LINK,
|
||||
MESSAGEENTITY_TEXT_MENTION,
|
||||
MESSAGEENTITY_UNDERLINE,
|
||||
MESSAGEENTITY_STRIKETHROUGH,
|
||||
]
|
||||
|
||||
PARSEMODE_MARKDOWN: str = 'Markdown'
|
||||
PARSEMODE_MARKDOWN_V2: str = 'MarkdownV2'
|
||||
PARSEMODE_HTML: str = 'HTML'
|
||||
|
||||
POLL_REGULAR: str = 'regular'
|
||||
POLL_QUIZ: str = 'quiz'
|
||||
|
||||
|
||||
STICKER_FOREHEAD: str = 'forehead'
|
||||
STICKER_EYES: str = 'eyes'
|
||||
STICKER_MOUTH: str = 'mouth'
|
||||
STICKER_CHIN: str = 'chin'
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# 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 an object that represents a Telegram Dice."""
|
||||
from telegram import TelegramObject
|
||||
from telegram import TelegramObject, constants
|
||||
from typing import Any, List
|
||||
|
||||
|
||||
|
@ -55,12 +55,11 @@ class Dice(TelegramObject):
|
|||
|
||||
self._id_attrs = (self.value, self.emoji)
|
||||
|
||||
DICE: str = '🎲'
|
||||
""":obj:`str`: '🎲'"""
|
||||
DARTS: str = '🎯'
|
||||
""":obj:`str`: '🎯'"""
|
||||
BASKETBALL = '🏀'
|
||||
""":obj:`str`: '🏀'"""
|
||||
ALL_EMOJI: List[str] = [DICE, DARTS, BASKETBALL]
|
||||
"""List[:obj:`str`]: List of all supported base emoji. Currently :attr:`DICE`,
|
||||
:attr:`DARTS` and :attr:`BASKETBALL`."""
|
||||
DICE: str = constants.DICE_DICE
|
||||
""":const:`telegram.constants.DICE_DICE`"""
|
||||
DARTS: str = constants.DICE_DARTS
|
||||
""":const:`telegram.constants.DICE_DARTS`"""
|
||||
BASKETBALL: str = constants.DICE_BASKETBALL
|
||||
""":const:`telegram.constants.DICE_BASKETBALL`"""
|
||||
ALL_EMOJI: List[str] = constants.DICE_ALL_EMOJI
|
||||
""":const:`telegram.constants.DICE_ALL_EMOJI`"""
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
"""This module contains objects that represents stickers."""
|
||||
|
||||
from telegram import PhotoSize, TelegramObject
|
||||
from telegram import PhotoSize, TelegramObject, constants
|
||||
from telegram.utils.types import JSONDict
|
||||
from typing import Any, Optional, List, TYPE_CHECKING
|
||||
|
||||
|
@ -233,14 +233,14 @@ class MaskPosition(TelegramObject):
|
|||
|
||||
"""
|
||||
|
||||
FOREHEAD: str = 'forehead'
|
||||
""":obj:`str`: 'forehead'"""
|
||||
EYES: str = 'eyes'
|
||||
""":obj:`str`: 'eyes'"""
|
||||
MOUTH: str = 'mouth'
|
||||
""":obj:`str`: 'mouth'"""
|
||||
CHIN: str = 'chin'
|
||||
""":obj:`str`: 'chin'"""
|
||||
FOREHEAD: str = constants.STICKER_FOREHEAD
|
||||
""":const:`telegram.constants.STICKER_FOREHEAD`"""
|
||||
EYES: str = constants.STICKER_EYES
|
||||
""":const:`telegram.constants.STICKER_EYES`"""
|
||||
MOUTH: str = constants.STICKER_MOUTH
|
||||
""":const:`telegram.constants.STICKER_MOUTH`"""
|
||||
CHIN: str = constants.STICKER_CHIN
|
||||
""":const:`telegram.constants.STICKER_CHIN`"""
|
||||
|
||||
def __init__(self, point: str, x_shift: float, y_shift: float, scale: float, **kwargs: Any):
|
||||
self.point = point
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
"""This module contains an object that represents a Telegram MessageEntity."""
|
||||
|
||||
from telegram import User, TelegramObject
|
||||
from telegram import User, TelegramObject, constants
|
||||
from telegram.utils.types import JSONDict
|
||||
from typing import Any, Optional, List, TYPE_CHECKING
|
||||
|
||||
|
@ -90,51 +90,36 @@ class MessageEntity(TelegramObject):
|
|||
|
||||
return cls(**data)
|
||||
|
||||
MENTION: str = 'mention'
|
||||
""":obj:`str`: 'mention'"""
|
||||
HASHTAG: str = 'hashtag'
|
||||
""":obj:`str`: 'hashtag'"""
|
||||
CASHTAG: str = 'cashtag'
|
||||
""":obj:`str`: 'cashtag'"""
|
||||
PHONE_NUMBER: str = 'phone_number'
|
||||
""":obj:`str`: 'phone_number'"""
|
||||
BOT_COMMAND: str = 'bot_command'
|
||||
""":obj:`str`: 'bot_command'"""
|
||||
URL: str = 'url'
|
||||
""":obj:`str`: 'url'"""
|
||||
EMAIL: str = 'email'
|
||||
""":obj:`str`: 'email'"""
|
||||
BOLD: str = 'bold'
|
||||
""":obj:`str`: 'bold'"""
|
||||
ITALIC: str = 'italic'
|
||||
""":obj:`str`: 'italic'"""
|
||||
CODE: str = 'code'
|
||||
""":obj:`str`: 'code'"""
|
||||
PRE: str = 'pre'
|
||||
""":obj:`str`: 'pre'"""
|
||||
TEXT_LINK: str = 'text_link'
|
||||
""":obj:`str`: 'text_link'"""
|
||||
TEXT_MENTION: str = 'text_mention'
|
||||
""":obj:`str`: 'text_mention'"""
|
||||
UNDERLINE: str = 'underline'
|
||||
""":obj:`str`: 'underline'"""
|
||||
STRIKETHROUGH: str = 'strikethrough'
|
||||
""":obj:`str`: 'strikethrough'"""
|
||||
ALL_TYPES: List[str] = [
|
||||
MENTION,
|
||||
HASHTAG,
|
||||
CASHTAG,
|
||||
PHONE_NUMBER,
|
||||
BOT_COMMAND,
|
||||
URL,
|
||||
EMAIL,
|
||||
BOLD,
|
||||
ITALIC,
|
||||
CODE,
|
||||
PRE,
|
||||
TEXT_LINK,
|
||||
TEXT_MENTION,
|
||||
UNDERLINE,
|
||||
STRIKETHROUGH,
|
||||
]
|
||||
"""List[:obj:`str`]: List of all the types."""
|
||||
MENTION: str = constants.MESSAGEENTITY_MENTION
|
||||
""":const:`telegram.constants.MESSAGEENTITY_MENTION`"""
|
||||
HASHTAG: str = constants.MESSAGEENTITY_HASHTAG
|
||||
""":const:`telegram.constants.MESSAGEENTITY_HASHTAG`"""
|
||||
CASHTAG: str = constants.MESSAGEENTITY_CASHTAG
|
||||
""":const:`telegram.constants.MESSAGEENTITY_CASHTAG`"""
|
||||
PHONE_NUMBER: str = constants.MESSAGEENTITY_PHONE_NUMBER
|
||||
""":const:`telegram.constants.MESSAGEENTITY_PHONE_NUMBER`"""
|
||||
BOT_COMMAND: str = constants.MESSAGEENTITY_BOT_COMMAND
|
||||
""":const:`telegram.constants.MESSAGEENTITY_BOT_COMMAND`"""
|
||||
URL: str = constants.MESSAGEENTITY_URL
|
||||
""":const:`telegram.constants.MESSAGEENTITY_URL`"""
|
||||
EMAIL: str = constants.MESSAGEENTITY_EMAIL
|
||||
""":const:`telegram.constants.MESSAGEENTITY_EMAIL`"""
|
||||
BOLD: str = constants.MESSAGEENTITY_BOLD
|
||||
""":const:`telegram.constants.MESSAGEENTITY_BOLD`"""
|
||||
ITALIC: str = constants.MESSAGEENTITY_ITALIC
|
||||
""":const:`telegram.constants.MESSAGEENTITY_ITALIC`"""
|
||||
CODE: str = constants.MESSAGEENTITY_CODE
|
||||
""":const:`telegram.constants.MESSAGEENTITY_CODE`"""
|
||||
PRE: str = constants.MESSAGEENTITY_PRE
|
||||
""":const:`telegram.constants.MESSAGEENTITY_PRE`"""
|
||||
TEXT_LINK: str = constants.MESSAGEENTITY_TEXT_LINK
|
||||
""":const:`telegram.constants.MESSAGEENTITY_TEXT_LINK`"""
|
||||
TEXT_MENTION: str = constants.MESSAGEENTITY_TEXT_MENTION
|
||||
""":const:`telegram.constants.MESSAGEENTITY_TEXT_MENTION`"""
|
||||
UNDERLINE: str = constants.MESSAGEENTITY_UNDERLINE
|
||||
""":const:`telegram.constants.MESSAGEENTITY_UNDERLINE`"""
|
||||
STRIKETHROUGH: str = constants.MESSAGEENTITY_STRIKETHROUGH
|
||||
""":const:`telegram.constants.MESSAGEENTITY_STRIKETHROUGH`"""
|
||||
ALL_TYPES: List[str] = constants.MESSAGEENTITY_ALL_TYPES
|
||||
""":const:`telegram.constants.MESSAGEENTITY_ALL_TYPES`\n
|
||||
List of all the types"""
|
||||
|
|
|
@ -19,18 +19,20 @@
|
|||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
"""This module contains an object that represents a Telegram Message Parse Modes."""
|
||||
|
||||
from telegram import constants
|
||||
|
||||
|
||||
class ParseMode:
|
||||
"""This object represents a Telegram Message Parse Modes."""
|
||||
|
||||
MARKDOWN: str = 'Markdown'
|
||||
""":obj:`str`: 'Markdown'
|
||||
MARKDOWN: str = constants.PARSEMODE_MARKDOWN
|
||||
""":const:`telegram.constants.PARSEMODE_MARKDOWN`\n
|
||||
|
||||
Note:
|
||||
:attr:`MARKDOWN` is a legacy mode, retained by Telegram for backward compatibility.
|
||||
You should use :attr:`MARKDOWN_V2` instead.
|
||||
"""
|
||||
MARKDOWN_V2: str = 'MarkdownV2'
|
||||
""":obj:`str`: 'MarkdownV2'"""
|
||||
HTML: str = 'HTML'
|
||||
""":obj:`str`: 'HTML'"""
|
||||
MARKDOWN_V2: str = constants.PARSEMODE_MARKDOWN_V2
|
||||
""":const:`telegram.constants.PARSEMODE_MARKDOWN_V2`"""
|
||||
HTML: str = constants.PARSEMODE_HTML
|
||||
""":const:`telegram.constants.PARSEMODE_HTML`"""
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
import sys
|
||||
import datetime
|
||||
|
||||
from telegram import TelegramObject, User, MessageEntity
|
||||
from telegram import TelegramObject, User, MessageEntity, constants
|
||||
from telegram.utils.helpers import to_timestamp, from_timestamp
|
||||
from telegram.utils.types import JSONDict
|
||||
from typing import Any, Dict, Optional, List, TYPE_CHECKING
|
||||
|
@ -259,7 +259,7 @@ class Poll(TelegramObject):
|
|||
if entity.type in types
|
||||
}
|
||||
|
||||
REGULAR: str = "regular"
|
||||
""":obj:`str`: 'regular'"""
|
||||
QUIZ: str = "quiz"
|
||||
""":obj:`str`: 'quiz'"""
|
||||
REGULAR: str = constants.POLL_REGULAR
|
||||
""":const:`telegram.constants.POLL_REGULAR`"""
|
||||
QUIZ: str = constants.POLL_QUIZ
|
||||
""":const:`telegram.constants.POLL_QUIZ`"""
|
||||
|
|
Loading…
Add table
Reference in a new issue