leaveChat#

Returns: bool

class aiogram.methods.leave_chat.LeaveChat(*, chat_id: Union[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: Union[int, str]#

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

build_request(bot: Bot) Request[source]#

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(...)