MadelineProtoDocs/old_docs/API_docs_v42/methods/messages.updatePinnedMessage.md
2020-09-12 12:47:38 +02:00

1.8 KiB

title description image redirect_from
messages.updatePinnedMessage Pin a message https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png /API_docs/methods/messages_updatePinnedMessage.html

Method: messages.updatePinnedMessage

Back to methods index

Pin a message

Parameters:

Name Type Description Required
silent Bool Pin the message silently, without triggering a notification Optional
peer Username, chat ID, Update, Message or InputPeer The peer where to pin the message Optional
id int The message to pin, can be 0 to unpin any currently pinned messages Yes

Return type: Updates

Can bots use this method: YES

MadelineProto Example (now async for huge speed and parallelism!):

if (!file_exists('madeline.php')) {
    copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();

$Updates = $MadelineProto->messages->updatePinnedMessage(['silent' => Bool, 'peer' => InputPeer, 'id' => int, ]);

Or, if you're into Lua:

Updates = messages.updatePinnedMessage({silent=Bool, peer=InputPeer, id=int, })

Errors

Code Type Description
400 CHANNEL_PRIVATE You haven't joined this channel/supergroup
400 CHAT_ADMIN_REQUIRED You must be an admin in this chat to do this
400 CHAT_NOT_MODIFIED The pinned message wasn't modified
400 MESSAGE_ID_INVALID The provided message id is invalid
400 PIN_RESTRICTED You can't pin messages
403 CHAT_WRITE_FORBIDDEN You can't write in this chat