leaveChat¶
Returns: bool
- class aiogram.methods.leave_chat.LeaveChat(*, chat_id: int | str, **extra_data: Any)[source]¶
Use this method for your bot to leave a group, supergroup or channel. Returns
True
on success.Source: https://core.telegram.org/bots/api#leavechat
- 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: bool = await bot.leave_chat(...)
Method as object¶
Imports:
from aiogram.methods.leave_chat import LeaveChat
alias:
from aiogram.methods import LeaveChat
With specific bot¶
result: bool = await bot(LeaveChat(...))
As reply into Webhook in handler¶
return LeaveChat(...)