Add missing shortcuts, new enums, reworked old stuff (#1070)

* Render shortcuts

* Render docs

* Added enumerations

* Added docs

* Use enums, removed Helper

* Bump butcher

* Added InputMediaType enum

* Added MaskPositionPoint, InlineQueryResultType enums

* Update texts

* Added StickerType enum

* Cover tests

* Update docs

* Fixed imports

* Re-enabled all pre-commit hooks
This commit is contained in:
Alex Root Junior 2022-12-04 03:05:49 +02:00 committed by GitHub
parent 3438d2446d
commit 3ea73fbbbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
370 changed files with 19735 additions and 8380 deletions

View file

@ -1,13 +1,35 @@
from .bot_command_scope_type import BotCommandScopeType
from .chat_action import ChatAction
from .chat_member_status import ChatMemberStatus
from .chat_type import ChatType
from .content_type import ContentType
from .dice_emoji import DiceEmoji
from .inline_query_result_type import InlineQueryResultType
from .input_media_type import InputMediaType
from .mask_position_point import MaskPositionPoint
from .menu_button_type import MenuButtonType
from .message_entity_type import MessageEntityType
from .parse_mode import ParseMode
from .poll_type import PollType
from .sticker_type import StickerType
from .topic_icon_color import TopicIconColor
from .update_type import UpdateType
__all__ = (
"BotCommandScopeType",
"ChatAction",
"ChatMemberStatus",
"ChatType",
"ContentType",
"DiceEmoji",
"InlineQueryResultType",
"InputMediaType",
"MaskPositionPoint",
"MenuButtonType",
"MessageEntityType",
"ParseMode",
"PollType",
"StickerType",
"TopicIconColor",
"UpdateType",
)

View file

@ -0,0 +1,17 @@
from enum import Enum
class BotCommandScopeType(str, Enum):
"""
This object represents the scope to which bot commands are applied.
Source: https://core.telegram.org/bots/api#botcommandscope
"""
DEFAULT = "default"
ALL_PRIVATE_CHATS = "all_private_chats"
ALL_GROUP_CHATS = "all_group_chats"
ALL_CHAT_ADMINISTRATORS = "all_chat_administrators"
CHAT = "chat"
CHAT_ADMINISTRATORS = "chat_administrators"
CHAT_MEMBER = "chat_member"

View file

@ -0,0 +1,32 @@
from enum import Enum
class ChatAction(str, Enum):
"""
This object represents bot actions.
Choose one, depending on what the user is about to receive:
- typing for text messages,
- upload_photo for photos,
- record_video or upload_video for videos,
- record_voice or upload_voice for voice notes,
- upload_document for general files,
- choose_sticker for stickers,
- find_location for location data,
- record_video_note or upload_video_note for video notes.
Source: https://core.telegram.org/bots/api#sendchataction
"""
TYPING = "typing"
UPLOAD_PHOTO = "upload_photo"
RECORD_VIDEO = "record_video"
UPLOAD_VIDEO = "upload_video"
RECORD_VOICE = "record_voice"
UPLOAD_VOICE = "upload_voice"
UPLOAD_DOCUMENT = "upload_document"
CHOOSE_STICKER = "choose_sticker"
FIND_LOCATION = "find_location"
RECORD_VIDEO_NOTE = "record_video_note"
UPLOAD_VIDEO_NOTE = "upload_video_note"

View file

@ -0,0 +1,16 @@
from enum import Enum
class ChatMemberStatus(str, Enum):
"""
This object represents chat member status.
Source: https://core.telegram.org/bots/api#chatmember
"""
CREATOR = "creator"
ADMINISTRATOR = "administrator"
MEMBER = "member"
RESTRICTED = "restricted"
LEFT = "left"
KICKED = "kicked"

View file

@ -3,9 +3,12 @@ from enum import Enum
class ChatType(str, Enum):
"""
Type of chat
This object represents a chat type
Source: https://core.telegram.org/bots/api#chat
"""
SENDER = "sender"
PRIVATE = "private"
GROUP = "group"
SUPERGROUP = "supergroup"

View file

@ -3,7 +3,7 @@ from enum import Enum
class ContentType(str, Enum):
"""
Message content type
This object represents a type of content in message
"""
UNKNOWN = "unknown"

View file

@ -4,6 +4,8 @@ from enum import Enum
class DiceEmoji(str, Enum):
"""
Emoji on which the dice throw animation is based
Source: https://core.telegram.org/bots/api#dice
"""
DICE = "🎲"

View file

@ -0,0 +1,23 @@
from enum import Enum
class InlineQueryResultType(str, Enum):
"""
The part of the face relative to which the mask should be placed.
Source: https://core.telegram.org/bots/api#maskposition
"""
AUDIO = "audio"
DOCUMENT = "document"
GIF = "gif"
MPEG = "mpeg"
PHOTO = "photo"
STICKER = "sticker"
VIDEO = "video"
VOICE = "voice"
ARTICLE = "article"
CONTACT = "contact"
GAME = "game"
LOCATION = "location"
VENUE = "venue"

View file

@ -0,0 +1,15 @@
from enum import Enum
class InputMediaType(str, Enum):
"""
This object represents input media type
Source: https://core.telegram.org/bots/api#inputmedia
"""
ANIMATION = "animation"
AUDIO = "audio"
DOCUMENT = "document"
PHOTO = "photo"
VIDEO = "video"

View file

@ -0,0 +1,14 @@
from enum import Enum
class MaskPositionPoint(str, Enum):
"""
The part of the face relative to which the mask should be placed.
Source: https://core.telegram.org/bots/api#maskposition
"""
FOREHEAD = "forehead"
EYES = "eyes"
MOUTH = "mouth"
CHIN = "chin"

View file

@ -0,0 +1,13 @@
from enum import Enum
class MenuButtonType(str, Enum):
"""
This object represents an type of Menu button
Source: https://core.telegram.org/bots/api#menubuttondefault
"""
DEFAULT = "default"
COMMANDS = "commands"
WEB_APP = "web_app"

View file

@ -0,0 +1,27 @@
from enum import Enum
class MessageEntityType(str, Enum):
"""
This object represents type of message entity
Source: https://core.telegram.org/bots/api#messageentity
"""
MENTION = "mention"
HASHTAG = "hashtag"
CASHTAG = "cashtag"
BOT_COMMAND = "bot_command"
URL = "url"
EMAIL = "email"
PHONE_NUMBER = "phone_number"
BOLD = "bold"
ITALIC = "italic"
UNDERLINE = "underline"
STRIKETHROUGH = "strikethrough"
SPOILER = "spoiler"
CODE = "code"
PRE = "pre"
TEXT_LINK = "text_link"
TEXT_MENTION = "text_mention"
CUSTOM_EMOJI = "custom_emoji"

View file

@ -0,0 +1,13 @@
from enum import Enum
class ParseMode(str, Enum):
"""
Formatting options
Source: https://core.telegram.org/bots/api#formatting-options
"""
MARKDOWN_V2 = "MarkdownV2"
MARKDOWN = "Markdown"
HTML = "HTML"

View file

@ -0,0 +1,12 @@
from enum import Enum
class PollType(str, Enum):
"""
This object represents poll type
Source: https://core.telegram.org/bots/api#poll
"""
REGULAR = "regular"
QUIZ = "quiz"

View file

@ -0,0 +1,13 @@
from enum import Enum
class StickerType(str, Enum):
"""
The part of the face relative to which the mask should be placed.
Source: https://core.telegram.org/bots/api#maskposition
"""
REGULAR = "regular"
MASK = "mask"
CUSTOM_EMOJI = "custom_emoji"

View file

@ -3,7 +3,9 @@ from enum import Enum
class UpdateType(str, Enum):
"""
Known update types
This object represents the complete list of allowed update types
Source: https://core.telegram.org/bots/api#update
"""
MESSAGE = "message"