getChatMember

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

class aiogram.methods.get_chat_member.GetChatMember(*, chat_id: int | str, user_id: int, **extra_data: Any)[source]

Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a aiogram.types.chat_member.ChatMember object on success.

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

chat_id: int | str

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

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_post_init(context: Any, /) None

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

user_id: int

Unique identifier of the target user

Usage

As bot method

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

Method as object

Imports:

  • from aiogram.methods.get_chat_member import GetChatMember

  • alias: from aiogram.methods import GetChatMember

With specific bot

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

As shortcut from received object