banChatSenderChat

Returns: bool

class aiogram.methods.ban_chat_sender_chat.BanChatSenderChat(*, chat_id: int | str, sender_chat_id: int, **extra_data: Any)[source]

Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won’t be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.

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

chat_id: int | str

Unique identifier for the target chat or username of the target 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.

sender_chat_id: int

Unique identifier of the target sender chat

Usage

As bot method

result: bool = await bot.ban_chat_sender_chat(...)

Method as object

Imports:

  • from aiogram.methods.ban_chat_sender_chat import BanChatSenderChat

  • alias: from aiogram.methods import BanChatSenderChat

With specific bot

result: bool = await bot(BanChatSenderChat(...))

As reply into Webhook in handler

return BanChatSenderChat(...)

As shortcut from received object