🌙

getChat

getChat

Возвращает информацию о чате.

chat = await bot.get_chat(chat_id)

Параметры

ПараметрТипОписание
chat_idintID чата

Возвращает: Chat

ПолеТипОписание
idintID чата
typestrТип чата: direct, group, channel
titlestr или NoneНазвание
usernamestr или None@username
member_countint или NoneЧисло участников

Пример

@dp.message(filters.command("info"))
async def info(msg):
    chat = await bot.get_chat(msg.chat.id)
    await msg.answer(f"Чат ID: {chat.id}\nТип: {chat.type}\nУчастников: {chat.member_count}")
1 просмотр