From 8783c4922e048d67425f874dacd860f6174982be Mon Sep 17 00:00:00 2001 From: JRoot Junior Date: Mon, 9 Feb 2026 20:27:30 +0200 Subject: [PATCH] Add `ButtonStyle` enum to represent button styles in the Telegram API --- .butcher/enums/ButtonStyle.yml | 9 +++++++++ aiogram/enums/__init__.py | 2 ++ aiogram/enums/button_style.py | 13 +++++++++++++ docs/api/enums/button_style.rst | 9 +++++++++ docs/api/enums/index.rst | 1 + 5 files changed, 34 insertions(+) create mode 100644 .butcher/enums/ButtonStyle.yml create mode 100644 aiogram/enums/button_style.py create mode 100644 docs/api/enums/button_style.rst diff --git a/.butcher/enums/ButtonStyle.yml b/.butcher/enums/ButtonStyle.yml new file mode 100644 index 00000000..7922d310 --- /dev/null +++ b/.butcher/enums/ButtonStyle.yml @@ -0,0 +1,9 @@ +name: ButtonStyle +description: | + This object represents a button style (inline- or reply-keyboard). + + Source: https://core.telegram.org/bots/api#chat +parse: + entity: InlineKeyboardButton + attribute: style + regexp: "'([a-z]+)'" diff --git a/aiogram/enums/__init__.py b/aiogram/enums/__init__.py index aa9d6b4a..1a6e5326 100644 --- a/aiogram/enums/__init__.py +++ b/aiogram/enums/__init__.py @@ -1,4 +1,5 @@ from .bot_command_scope_type import BotCommandScopeType +from .button_style import ButtonStyle from .chat_action import ChatAction from .chat_boost_source_type import ChatBoostSourceType from .chat_member_status import ChatMemberStatus @@ -36,6 +37,7 @@ from .update_type import UpdateType __all__ = ( "BotCommandScopeType", + "ButtonStyle", "ChatAction", "ChatBoostSourceType", "ChatMemberStatus", diff --git a/aiogram/enums/button_style.py b/aiogram/enums/button_style.py new file mode 100644 index 00000000..6aeffd58 --- /dev/null +++ b/aiogram/enums/button_style.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class ButtonStyle(str, Enum): + """ + This object represents a button style (inline- or reply-keyboard). + + Source: https://core.telegram.org/bots/api#chat + """ + + DANGER = "danger" + SUCCESS = "success" + PRIMARY = "primary" diff --git a/docs/api/enums/button_style.rst b/docs/api/enums/button_style.rst new file mode 100644 index 00000000..d9ac08ca --- /dev/null +++ b/docs/api/enums/button_style.rst @@ -0,0 +1,9 @@ +########### +ButtonStyle +########### + + +.. automodule:: aiogram.enums.button_style + :members: + :member-order: bysource + :undoc-members: True diff --git a/docs/api/enums/index.rst b/docs/api/enums/index.rst index be84c782..8082a207 100644 --- a/docs/api/enums/index.rst +++ b/docs/api/enums/index.rst @@ -11,6 +11,7 @@ Here is list of all available enums: :maxdepth: 1 bot_command_scope_type + button_style chat_action chat_boost_source_type chat_member_status