mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added enumerations
This commit is contained in:
parent
964418f4f0
commit
3beecf851b
30 changed files with 289 additions and 27 deletions
16
.butcher/enums/BotCommandScopeType.yml
Normal file
16
.butcher/enums/BotCommandScopeType.yml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
name: BotCommandScopeType
|
||||
description: |
|
||||
This object represents the scope to which bot commands are applied.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#botcommandscope
|
||||
multi_parse:
|
||||
attribute: type
|
||||
regexp: "must be ([a-z_]+)"
|
||||
entities:
|
||||
- BotCommandScopeDefault
|
||||
- BotCommandScopeAllPrivateChats
|
||||
- BotCommandScopeAllGroupChats
|
||||
- BotCommandScopeAllChatAdministrators
|
||||
- BotCommandScopeChat
|
||||
- BotCommandScopeChatAdministrators
|
||||
- BotCommandScopeChatMember
|
||||
22
.butcher/enums/ChatActions.yml
Normal file
22
.butcher/enums/ChatActions.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
name: ChatAction
|
||||
description: |
|
||||
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
|
||||
parse:
|
||||
format: rst
|
||||
entity: sendChatAction
|
||||
category: methods
|
||||
attribute: action
|
||||
regexp: '\*([a-z_]+)\*'
|
||||
15
.butcher/enums/ChatMemberStatus.yml
Normal file
15
.butcher/enums/ChatMemberStatus.yml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
name: ChatMemberStatus
|
||||
description: |
|
||||
This object represents chat member status.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#chatmember
|
||||
multi_parse:
|
||||
attribute: status
|
||||
regexp: "'([a-z_]+)'"
|
||||
entities:
|
||||
- ChatMemberOwner
|
||||
- ChatMemberAdministrator
|
||||
- ChatMemberMember
|
||||
- ChatMemberRestricted
|
||||
- ChatMemberLeft
|
||||
- ChatMemberBanned
|
||||
9
.butcher/enums/ChatType.yml
Normal file
9
.butcher/enums/ChatType.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
name: ChatType
|
||||
description: |
|
||||
This object represents a chat type
|
||||
|
||||
Source: https://core.telegram.org/bots/api#chat
|
||||
parse:
|
||||
entity: Chat
|
||||
attribute: type
|
||||
regexp: "'([a-z]+)'"
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
name: ContentType
|
||||
description: "Message content type"
|
||||
description:
|
||||
This object represents a type of content in message
|
||||
static:
|
||||
UNKNOWN: unknown
|
||||
ANY: any
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
name: DiceEmoji
|
||||
description: "Emoji on which the dice throw animation is based"
|
||||
description: |
|
||||
Emoji on which the dice throw animation is based
|
||||
|
||||
Source: https://core.telegram.org/bots/api#dice
|
||||
static:
|
||||
DICE: 🎲
|
||||
DART: 🎯
|
||||
13
.butcher/enums/MenuButtonType.yml
Normal file
13
.butcher/enums/MenuButtonType.yml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
name: MenuButtonType
|
||||
description: |
|
||||
This object represents an type of Menu button
|
||||
|
||||
Source: https://core.telegram.org/bots/api#menubuttondefault
|
||||
multi_parse:
|
||||
format: rst
|
||||
attribute: type
|
||||
regexp: '\*([a-z_]+)\*'
|
||||
entities:
|
||||
- MenuButtonDefault
|
||||
- MenuButtonCommands
|
||||
- MenuButtonWebApp
|
||||
10
.butcher/enums/MessageEntityType.yml
Normal file
10
.butcher/enums/MessageEntityType.yml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
name: MessageEntityType
|
||||
description: |
|
||||
This object represents type of message entity
|
||||
|
||||
Source: https://core.telegram.org/bots/api#messageentity
|
||||
parse:
|
||||
entity: MessageEntity
|
||||
category: types
|
||||
attribute: type
|
||||
regexp: "'([a-z_]+)'"
|
||||
9
.butcher/enums/ParseMode.yml
Normal file
9
.butcher/enums/ParseMode.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
name: ParseMode
|
||||
description: |
|
||||
Formatting options
|
||||
|
||||
Source: https://core.telegram.org/bots/api#formatting-options
|
||||
static:
|
||||
MARKDOWN_V2: MarkdownV2
|
||||
MARKDOWN: Markdown
|
||||
HTML: HTML
|
||||
9
.butcher/enums/PollType.yml
Normal file
9
.butcher/enums/PollType.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
name: PollType
|
||||
description: |
|
||||
This object represents poll type
|
||||
|
||||
Source: https://core.telegram.org/bots/api#poll
|
||||
parse:
|
||||
entity: Poll
|
||||
attribute: type
|
||||
regexp: "'([a-z]+)'"
|
||||
9
.butcher/enums/UpdateType.yml
Normal file
9
.butcher/enums/UpdateType.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
name: UpdateType
|
||||
description: |
|
||||
This object represents the complete list of allowed update types
|
||||
|
||||
Source: https://core.telegram.org/bots/api#update
|
||||
extract:
|
||||
entity: Update
|
||||
exclude:
|
||||
- update_id
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
name: ChatType
|
||||
description: "Type of chat"
|
||||
parse:
|
||||
entity: Chat
|
||||
attribute: type
|
||||
regexp: "'([a-z]+)'"
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
name: UpdateType
|
||||
description: Known update types
|
||||
extract:
|
||||
entity: Update
|
||||
exclude:
|
||||
- update_id
|
||||
|
|
@ -33,17 +33,17 @@ repos:
|
|||
args: [ '--config=.flake8' ]
|
||||
files: *files
|
||||
|
||||
- repo: https://github.com/floatingpurr/sync_with_poetry
|
||||
rev: 0.2.0
|
||||
hooks:
|
||||
- id: sync_with_poetry
|
||||
# - repo: https://github.com/floatingpurr/sync_with_poetry
|
||||
# rev: 0.2.0
|
||||
# hooks:
|
||||
# - id: sync_with_poetry
|
||||
|
||||
- repo: https://github.com/python-poetry/poetry
|
||||
rev: '1.2.1'
|
||||
hooks:
|
||||
- id: poetry-check
|
||||
- id: poetry-lock
|
||||
args: [ "--no-update" ]
|
||||
# - id: poetry-lock
|
||||
# args: [ "--no-update" ]
|
||||
- id: poetry-export
|
||||
args: [ "-f", "requirements.txt", "--without-hashes", "-o", "requirements/base.txt" ]
|
||||
- id: poetry-export
|
||||
|
|
|
|||
|
|
@ -1,13 +1,27 @@
|
|||
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 .menu_button_type import MenuButtonType
|
||||
from .message_entity_type import MessageEntityType
|
||||
from .parse_mode import ParseMode
|
||||
from .poll_type import PollType
|
||||
from .topic_icon_color import TopicIconColor
|
||||
from .update_type import UpdateType
|
||||
|
||||
__all__ = (
|
||||
"BotCommandScopeType",
|
||||
"ChatAction",
|
||||
"ChatMemberStatus",
|
||||
"ChatType",
|
||||
"ContentType",
|
||||
"DiceEmoji",
|
||||
"MenuButtonType",
|
||||
"MessageEntityType",
|
||||
"ParseMode",
|
||||
"PollType",
|
||||
"TopicIconColor",
|
||||
"UpdateType",
|
||||
)
|
||||
|
|
|
|||
18
aiogram/enums/bot_command_scope_type.py
Normal file
18
aiogram/enums/bot_command_scope_type.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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"
|
||||
ALL = "all"
|
||||
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,7 +3,9 @@ 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
|
||||
"""
|
||||
|
||||
PRIVATE = "private"
|
||||
|
|
|
|||
|
|
@ -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 = "🎲"
|
||||
|
|
|
|||
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"
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -8,8 +8,15 @@ Here is list of all available enums:
|
|||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
bot_command_scope_type
|
||||
chat_action
|
||||
chat_member_status
|
||||
chat_type
|
||||
content_type
|
||||
dice_emoji
|
||||
menu_button_type
|
||||
message_entity_type
|
||||
parse_mode
|
||||
poll_type
|
||||
topic_icon_color
|
||||
update_type
|
||||
|
|
|
|||
|
|
@ -1272,7 +1272,7 @@ msgstr ""
|
|||
|
||||
#: ../../../HISTORY.rst:139
|
||||
msgid ""
|
||||
"Added is_chat_creator method to ChatMemberStatus (`#394 "
|
||||
"Added is_chat_creator method to ChatMemberStatus.yml (`#394 "
|
||||
"<https://github.com/aiogram/aiogram/issues/394>`_)"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -1765,7 +1765,7 @@ msgstr ""
|
|||
#: ../../../HISTORY.rst:287
|
||||
msgid ""
|
||||
":code:`is_member` and :code:`is_admin` methods of :code:`ChatMember` and "
|
||||
":code:`ChatMemberStatus` was renamed to :code:`is_chat_member` and "
|
||||
":code:`ChatMemberStatus.yml` was renamed to :code:`is_chat_member` and "
|
||||
":code:`is_chat_admin`"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
|||
|
|
@ -1272,7 +1272,7 @@ msgstr ""
|
|||
|
||||
#: ../../../HISTORY.rst:139
|
||||
msgid ""
|
||||
"Added is_chat_creator method to ChatMemberStatus (`#394 "
|
||||
"Added is_chat_creator method to ChatMemberStatus.yml (`#394 "
|
||||
"<https://github.com/aiogram/aiogram/issues/394>`_)"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -1765,7 +1765,7 @@ msgstr ""
|
|||
#: ../../../HISTORY.rst:287
|
||||
msgid ""
|
||||
":code:`is_member` and :code:`is_admin` methods of :code:`ChatMember` and "
|
||||
":code:`ChatMemberStatus` was renamed to :code:`is_chat_member` and "
|
||||
":code:`ChatMemberStatus.yml` was renamed to :code:`is_chat_member` and "
|
||||
":code:`is_chat_admin`"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue