Skip to main content

messages.updatePinnedMessage

Pin a message

func (c *Client) MessagesUpdatePinnedMessage(ctx context.Context, request *MessagesUpdatePinnedMessageRequest) (UpdatesClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.MessagesUpdatePinnedMessage(ctx, &tg.MessagesUpdatePinnedMessageRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UpdatesClass
return nil
})

Parameters

NameTypeRequiredDescription
SilentboolPin the message silently, without triggering a notification
UnpinboolWhether the message should unpinned or pinned
PmOnesideboolWhether the message should only be pinned on the local side of a one-to-one chat
PeerInputPeerClassyesThe peer where to pin the message
IDintyesThe message to pin or unpin

Returns

UpdatesClass

Possible errors

CodeTypeDescription
400BOT_ONESIDE_NOT_AVAILBots can't pin messages in PM just for themselves.
400BUSINESS_CONNECTION_INVALIDThe connection_id passed to the wrapping invokeWithBusinessConnection call is invalid.
400BUSINESS_PEER_INVALIDMessages can't be set to the specified peer through the current business connection.
400CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
400CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
400CHAT_INVALIDInvalid chat.
400CHAT_NOT_MODIFIEDNo changes were made to chat information because the new information you passed is identical to the current information.
403CHAT_WRITE_FORBIDDENYou can't write in this chat.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400MESSAGE_ID_INVALIDThe provided message id is invalid.
400PEER_ID_INVALIDThe provided peer id is invalid.
400PIN_RESTRICTEDYou can't pin messages.
400USER_BANNED_IN_CHANNELYou're banned from sending messages in supergroups/channels.

References