Available methods

banChatSenderChat()

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.

parameters

parametertyperequireddescription
chat_idnumber | stringrequiredUnique identifier for the target chat or username of the target channel in the format @username
sender_chat_idnumberrequiredUnique identifier of the target sender chat

returns

boolean

usage in yaebal

not (yet) hard-typed on Api — call it through the generic .call<T>() escape hatch documented in @yaebal/types.

bot.ts
import type { BanChatSenderChatParams } from "@yaebal/types";

await bot.api.call<boolean>("banChatSenderChat", {
  chat_id: 123456789,
  sender_chat_id: 1,
} satisfies BanChatSenderChatParams);

context shortcut

also available as ctx.banChatSenderChat() on 16 context types — see @yaebal/contexts.

context shortcut
/** Use this method to ban a channel chat in a supergroup or a channel. Until the chat is [unbanned](https://core.telegram.org/bots/api/#unbanchatsenderchat), 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. */
ctx.banChatSenderChat(params: Omit<BanChatSenderChatParams, "chat_id">)