getChat
getChat
Возвращает информацию о чате.
chat = await bot.get_chat(chat_id)
Параметры
| Параметр | Тип | Описание |
|---|---|---|
chat_id | int | ID чата |
Возвращает: Chat
| Поле | Тип | Описание |
|---|---|---|
id | int | ID чата |
type | str | Тип чата: direct, group, channel |
title | str или None | Название |
username | str или None | @username |
member_count | int или 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 просмотр