mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
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:
parent
3438d2446d
commit
3ea73fbbbd
370 changed files with 19735 additions and 8380 deletions
|
|
@ -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",
|
||||
)
|
||||
|
|
|
|||
17
aiogram/enums/bot_command_scope_type.py
Normal file
17
aiogram/enums/bot_command_scope_type.py
Normal 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"
|
||||
32
aiogram/enums/chat_action.py
Normal file
32
aiogram/enums/chat_action.py
Normal 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"
|
||||
16
aiogram/enums/chat_member_status.py
Normal file
16
aiogram/enums/chat_member_status.py
Normal 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"
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 = "🎲"
|
||||
|
|
|
|||
23
aiogram/enums/inline_query_result_type.py
Normal file
23
aiogram/enums/inline_query_result_type.py
Normal 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"
|
||||
15
aiogram/enums/input_media_type.py
Normal file
15
aiogram/enums/input_media_type.py
Normal 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"
|
||||
14
aiogram/enums/mask_position_point.py
Normal file
14
aiogram/enums/mask_position_point.py
Normal 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"
|
||||
13
aiogram/enums/menu_button_type.py
Normal file
13
aiogram/enums/menu_button_type.py
Normal 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"
|
||||
27
aiogram/enums/message_entity_type.py
Normal file
27
aiogram/enums/message_entity_type.py
Normal 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"
|
||||
13
aiogram/enums/parse_mode.py
Normal file
13
aiogram/enums/parse_mode.py
Normal 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"
|
||||
12
aiogram/enums/poll_type.py
Normal file
12
aiogram/enums/poll_type.py
Normal 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"
|
||||
13
aiogram/enums/sticker_type.py
Normal file
13
aiogram/enums/sticker_type.py
Normal 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"
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue