pinChatMessage()
Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns True on success.
parameters
| parameter | type | required | description |
|---|---|---|---|
business_connection_id | string | optional | Unique identifier of the business connection on behalf of which the message will be pinned |
chat_id | number | string | required | Unique identifier for the target chat or username of the target channel in the format @username |
message_id | number | required | Identifier of a message to pin |
disable_notification | boolean | optional | Pass True if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats. |
returns
boolean
usage in yaebal
not (yet) hard-typed on Api — call it through the generic .call<T>() escape hatch documented in @yaebal/types.
import type { PinChatMessageParams } from "@yaebal/types";
await bot.api.call<boolean>("pinChatMessage", {
chat_id: 123456789,
message_id: 1,
} satisfies PinChatMessageParams);context shortcut
also available as ctx.pin() on
10
context types — see @yaebal/contexts.
/** Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns *True* on success. */
ctx.pin(params: Omit<PinChatMessageParams, "chat_id" | "message_id">)official Bot API docs: https://core.telegram.org/bots/api/#pinchatmessage