1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-12-15 19:56:56 +01:00
MadelineProto/old_docs/API_docs_v55/methods/messages_saveDraft.md

107 lines
3.1 KiB
Markdown
Raw Normal View History

---
2017-01-19 23:02:27 +01:00
title: messages.saveDraft
2018-03-23 16:23:49 +01:00
description: Save a message draft
---
2017-01-19 23:02:27 +01:00
## Method: messages.saveDraft
[Back to methods index](index.md)
2018-03-23 16:23:49 +01:00
Save a message draft
### Parameters:
2018-03-23 16:23:49 +01:00
| Name | Type | Required | Description |
|----------|---------------|----------|-------------|
|no\_webpage|[CLICK ME Bool](../types/Bool.md) | Optional|Disable webpage preview|
|reply\_to\_msg\_id|[CLICK ME int](../types/int.md) | Optional|Reply to message by ID|
|peer|[Username, chat ID, Update, Message or InputPeer](../types/InputPeer.md) | Optional|The chat|
|message|[CLICK ME string](../types/string.md) | Yes|The message|
|entities|Array of [CLICK ME MessageEntity](../types/MessageEntity.md) | Optional|The entities (for styled text)|
2018-03-23 12:35:00 +01:00
|parse\_mode| [string](../types/string.md) | Optional |Whether to parse HTML or Markdown markup in the message|
### Return type: [Bool](../types/Bool.md)
2017-08-28 12:44:50 +02:00
### Can bots use this method: **NO**
2017-11-03 17:39:50 +01:00
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PEER_ID_INVALID|The provided peer id is invalid|
2018-03-20 19:57:36 +01:00
### MadelineProto Example:
```
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();
$Bool = $MadelineProto->messages->saveDraft(['no_webpage' => Bool, 'reply_to_msg_id' => int, 'peer' => InputPeer, 'message' => 'string', 'entities' => [MessageEntity, MessageEntity], 'parse_mode' => 'string', ]);
2017-02-13 04:33:06 +01:00
```
2018-03-20 19:57:36 +01:00
### [PWRTelegram HTTP API](https://pwrtelegram.xyz) example (NOT FOR MadelineProto):
2017-07-23 16:11:02 +02:00
2017-07-23 16:34:36 +02:00
2017-07-23 16:11:02 +02:00
### As a user:
POST/GET to `https://api.pwrtelegram.xyz/userTOKEN/messages.saveDraft`
Parameters:
parse_mode - string
2017-07-23 16:40:54 +02:00
2017-07-23 16:11:02 +02:00
Or, if you're into Lua:
```
2017-07-23 16:33:46 +02:00
Bool = messages.saveDraft({no_webpage=Bool, reply_to_msg_id=int, peer=InputPeer, message='string', entities={MessageEntity}, parse_mode='string', })
```
## Return value
If the length of the provided message is bigger than 4096, the message will be split in chunks and the method will be called multiple times, with the same parameters (except for the message), and an array of [Bool](../types/Bool.md) will be returned instead.
2017-02-13 04:33:06 +01:00
## Usage of parse_mode:
Set parse_mode to html to enable HTML parsing of the message.
Set parse_mode to Markdown to enable markown AND html parsing of the message.
The following tags are currently supported:
```
<br>a newline
2017-02-16 20:04:57 +01:00
<b><i>bold works ok, internal tags are stripped</i> </b>
2017-02-13 04:33:06 +01:00
<strong>bold</strong>
<em>italic</em>
<i>italic</i>
<code>inline fixed-width code</code>
<pre>pre-formatted fixed-width code block</pre>
<a href="https://github.com">URL</a>
<a href="mention:@danogentili">Mention by username</a>
<a href="mention:186785362">Mention by user id</a>
<pre language="json">Pre tags can have a language attribute</pre>
```
You can also use normal markdown, note that to create mentions you must use the `mention:` syntax like in html:
```
[Mention by username](mention:@danogentili)
[Mention by user id](mention:186785362)
```
MadelineProto supports all html entities supported by [html_entity_decode](http://php.net/manual/en/function.html-entity-decode.php).