2019-06-23 13:07:51 +02:00
|
|
|
---
|
|
|
|
title: messages.updatePinnedMessage
|
2019-12-27 17:48:04 +01:00
|
|
|
description: Pin a message
|
2019-06-23 13:07:51 +02:00
|
|
|
image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
|
2019-12-27 18:46:25 +01:00
|
|
|
redirect_from: /API_docs/methods/messages_updatePinnedMessage.html
|
2019-06-23 13:07:51 +02:00
|
|
|
---
|
|
|
|
# Method: messages.updatePinnedMessage
|
|
|
|
[Back to methods index](index.md)
|
|
|
|
|
|
|
|
|
2019-12-27 17:48:04 +01:00
|
|
|
Pin a message
|
2019-06-23 13:07:51 +02:00
|
|
|
|
|
|
|
### Parameters:
|
|
|
|
|
|
|
|
| Name | Type | Description | Required |
|
|
|
|
|----------|---------------|-------------|----------|
|
2019-12-27 17:48:04 +01:00
|
|
|
|silent|[Bool](../types/Bool.md) | Pin the message silently, without triggering a notification | Optional|
|
|
|
|
|peer|[Username, chat ID, Update, Message or InputPeer](../types/InputPeer.md) | The peer where to pin the message | Optional|
|
|
|
|
|id|[int](../types/int.md) | The message to pin, can be 0 to unpin any currently pinned messages | Yes|
|
2019-06-23 13:07:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
### Return type: [Updates](../types/Updates.md)
|
|
|
|
|
|
|
|
### Can bots use this method: **YES**
|
|
|
|
|
|
|
|
|
|
|
|
### MadelineProto Example ([now async for huge speed and parallelism!](https://docs.madelineproto.xyz/docs/ASYNC.html)):
|
|
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
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:
|
|
|
|
|
|
|
|
```lua
|
|
|
|
Updates = messages.updatePinnedMessage({silent=Bool, peer=InputPeer, id=int, })
|
|
|
|
```
|
|
|
|
|
2019-12-27 17:48:04 +01:00
|
|
|
### Errors
|
|
|
|
|
|
|
|
| Code | Type | Description |
|
|
|
|
|------|----------|---------------|
|
|
|
|
|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|
|
2020-01-10 14:18:02 +01:00
|
|
|
|400|MESSAGE_ID_INVALID|The provided message id is invalid|
|
|
|
|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|
|
2019-12-27 17:48:04 +01:00
|
|
|
|
|
|
|
|