mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Refactor type unions with ResultChatMemberUnion and ResultMenuButtonUnion
Replaced verbose type definitions of chat member and menu button unions with `ResultChatMemberUnion` and `ResultMenuButtonUnion` for improved readability and maintainability. Updated relevant methods, modules, and documentation to use the new type aliases consistently.
This commit is contained in:
parent
f7c0e3d614
commit
28941439cf
11 changed files with 55 additions and 108 deletions
|
|
@ -2,7 +2,7 @@
|
|||
getChatAdministrators
|
||||
#####################
|
||||
|
||||
Returns: :obj:`list[Union[ChatMemberOwner, ChatMemberAdministrator, ChatMemberMember, ChatMemberRestricted, ChatMemberLeft, ChatMemberBanned]]`
|
||||
Returns: :obj:`list[ResultChatMemberUnion]`
|
||||
|
||||
.. automodule:: aiogram.methods.get_chat_administrators
|
||||
:members:
|
||||
|
|
@ -19,7 +19,7 @@ As bot method
|
|||
|
||||
.. code-block::
|
||||
|
||||
result: list[Union[ChatMemberOwner, ChatMemberAdministrator, ChatMemberMember, ChatMemberRestricted, ChatMemberLeft, ChatMemberBanned]] = await bot.get_chat_administrators(...)
|
||||
result: list[ResultChatMemberUnion] = await bot.get_chat_administrators(...)
|
||||
|
||||
|
||||
Method as object
|
||||
|
|
@ -35,7 +35,7 @@ With specific bot
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
result: list[Union[ChatMemberOwner, ChatMemberAdministrator, ChatMemberMember, ChatMemberRestricted, ChatMemberLeft, ChatMemberBanned]] = await bot(GetChatAdministrators(...))
|
||||
result: list[ResultChatMemberUnion] = await bot(GetChatAdministrators(...))
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
getChatMember
|
||||
#############
|
||||
|
||||
Returns: :obj:`Union[ChatMemberOwner, ChatMemberAdministrator, ChatMemberMember, ChatMemberRestricted, ChatMemberLeft, ChatMemberBanned]`
|
||||
Returns: :obj:`ResultChatMemberUnion`
|
||||
|
||||
.. automodule:: aiogram.methods.get_chat_member
|
||||
:members:
|
||||
|
|
@ -19,7 +19,7 @@ As bot method
|
|||
|
||||
.. code-block::
|
||||
|
||||
result: Union[ChatMemberOwner, ChatMemberAdministrator, ChatMemberMember, ChatMemberRestricted, ChatMemberLeft, ChatMemberBanned] = await bot.get_chat_member(...)
|
||||
result: ResultChatMemberUnion = await bot.get_chat_member(...)
|
||||
|
||||
|
||||
Method as object
|
||||
|
|
@ -35,7 +35,7 @@ With specific bot
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
result: Union[ChatMemberOwner, ChatMemberAdministrator, ChatMemberMember, ChatMemberRestricted, ChatMemberLeft, ChatMemberBanned] = await bot(GetChatMember(...))
|
||||
result: ResultChatMemberUnion = await bot(GetChatMember(...))
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
getChatMenuButton
|
||||
#################
|
||||
|
||||
Returns: :obj:`Union[MenuButtonDefault, MenuButtonWebApp, MenuButtonCommands]`
|
||||
Returns: :obj:`ResultMenuButtonUnion`
|
||||
|
||||
.. automodule:: aiogram.methods.get_chat_menu_button
|
||||
:members:
|
||||
|
|
@ -19,7 +19,7 @@ As bot method
|
|||
|
||||
.. code-block::
|
||||
|
||||
result: Union[MenuButtonDefault, MenuButtonWebApp, MenuButtonCommands] = await bot.get_chat_menu_button(...)
|
||||
result: ResultMenuButtonUnion = await bot.get_chat_menu_button(...)
|
||||
|
||||
|
||||
Method as object
|
||||
|
|
@ -35,4 +35,4 @@ With specific bot
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
result: Union[MenuButtonDefault, MenuButtonWebApp, MenuButtonCommands] = await bot(GetChatMenuButton(...))
|
||||
result: ResultMenuButtonUnion = await bot(GetChatMenuButton(...))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue