getChatAdministrators

Returns: list[Union[ChatMemberOwner, ChatMemberAdministrator, ChatMemberMember, ChatMemberRestricted, ChatMemberLeft, ChatMemberBanned]]

class aiogram.methods.get_chat_administrators.GetChatAdministrators(*, chat_id: int | str, **extra_data: Any)[source]

Use this method to get a list of administrators in a chat, which aren’t bots. Returns an Array of aiogram.types.chat_member.ChatMember objects.

Source: https://core.telegram.org/bots/api#getchatadministrators

chat_id: int | str

Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

Usage

As bot method

result: list[Union[ChatMemberOwner, ChatMemberAdministrator, ChatMemberMember, ChatMemberRestricted, ChatMemberLeft, ChatMemberBanned]] = await bot.get_chat_administrators(...)

Method as object

Imports:

  • from aiogram.methods.get_chat_administrators import GetChatAdministrators

  • alias: from aiogram.methods import GetChatAdministrators

With specific bot

result: list[Union[ChatMemberOwner, ChatMemberAdministrator, ChatMemberMember, ChatMemberRestricted, ChatMemberLeft, ChatMemberBanned]] = await bot(GetChatAdministrators(...))

As shortcut from received object