- * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3
- * @link https://docs.madelineproto.xyz MadelineProto documentation
- */
-
-namespace danog\\MadelineProto;
-
-class Lang
-{
- public static $lang = %s;
-
- // THIS WILL BE OVERWRITTEN BY $lang["en"]
- public static $current_lang = %s;
-}';
public static function addToLang(string $key, string $value = '', bool $force = false)
{
if (!isset(\danog\MadelineProto\Lang::$lang['en'][$key]) || $force) {
\danog\MadelineProto\Lang::$lang['en'][$key] = $value;
- //\file_put_contents(__DIR__.'/Lang.php', \sprintf(self::$template, \var_export(\danog\MadelineProto\Lang::$lang, true), \var_export(\danog\MadelineProto\Lang::$lang['en'], true)));
}
}
+ /**
+ * Get formatted template string.
+ *
+ * @param string $name Template name
+ * @param string[] ...$params Params
+ *
+ * @return string
+ */
+ protected function template(string $name, ...$params): string
+ {
+ return \sprintf($this->templates[$name], ...$params);
+ }
}
diff --git a/src/danog/MadelineProto/DocsBuilder/Constructors.php b/src/danog/MadelineProto/DocsBuilder/Constructors.php
index 7d8555ab..0312cf54 100644
--- a/src/danog/MadelineProto/DocsBuilder/Constructors.php
+++ b/src/danog/MadelineProto/DocsBuilder/Constructors.php
@@ -19,6 +19,7 @@
namespace danog\MadelineProto\DocsBuilder;
+use danog\MadelineProto\StrTools;
use danog\MadelineProto\Tools;
trait Constructors
@@ -41,15 +42,11 @@ trait Constructors
$data['layer'] = '';
}
$got[$id] = '';
- /*
- if (preg_match('/%/', $type)) {
- $type = $this->TL->getConstructors($this->td)->findByType(str_replace('%', '', $type))['predicate'];
- }*/
$layer = isset($data['layer']) && $data['layer'] !== '' ? '_'.$data['layer'] : '';
- $type = \str_replace(['<', '>'], ['_of_', ''], $data['type']);
- $php_type = \preg_replace('/.*_of_/', '', $type);
- $constructor = \str_replace(['<', '>'], ['_of_', ''], $data['predicate']);
- $php_constructor = \preg_replace('/.*_of_/', '', $constructor);
+ $type = $data['type'];
+ $constructor = $data['predicate'];
+ $php_type = Tools::typeEscape($type);
+ $php_constructor = Tools::typeEscape($constructor);
if (!isset($this->types[$php_type])) {
$this->types[$php_type] = ['constructors' => [], 'methods' => []];
}
@@ -78,7 +75,7 @@ trait Constructors
$param[$type_or_subtype] = '['.Tools::markdownEscape($param[$type_or_subtype]).'](../'.$type_or_bare_type.'/'.$param[$type_or_subtype].'.md)';
$params .= (isset($param['subtype']) ? '\\['.$param[$type_or_subtype].'\\]' : $param[$type_or_subtype]).', ';
}
- $md_constructor = \str_replace('_', '\\_', $constructor.$layer);
+ $md_constructor = StrTools::markdownEscape($constructor.$layer);
$this->docs_constructors[$constructor] = '[$'.$md_constructor.'](../constructors/'.$php_constructor.$layer.'.md) = \\['.$params.'\\];
';
@@ -87,13 +84,13 @@ trait Constructors
| Name | Type | Required |
|----------|---------------|----------|
';
- if (!isset($this->TL->getDescriptions()['constructors'][$data['predicate']])) {
- $this->addToLang('object_'.$data['predicate']);
- if (\danog\MadelineProto\Lang::$lang['en']['object_'.$data['predicate']] !== '') {
- $this->TL->getDescriptions()['constructors'][$data['predicate']]['description'] = \danog\MadelineProto\Lang::$lang['en']['object_'.$data['predicate']];
+ if (!isset($this->TL->getDescriptions()['constructors'][$constructor])) {
+ $this->addToLang('object_'.$constructor);
+ if (\danog\MadelineProto\Lang::$lang['en']['object_'.$constructor] !== '') {
+ $this->TL->getDescriptions()['constructors'][$constructor]['description'] = \danog\MadelineProto\Lang::$lang['en']['object_'.$constructor];
}
}
- if (isset($this->TL->getDescriptions()['constructors'][$data['predicate']]) && !empty($data['params'])) {
+ if (isset($this->TL->getDescriptions()['constructors'][$constructor]) && !empty($data['params'])) {
$table = '### Attributes:
| Name | Type | Required | Description |
@@ -114,16 +111,10 @@ trait Constructors
$param['type'] = 'DecryptedMessage';
}
if ($type === 'DecryptedMessageMedia' && \in_array($param['name'], ['key', 'iv'])) {
- unset(\danog\MadelineProto\Lang::$lang['en']['object_'.$data['predicate'].'_param_'.$param['name'].'_type_'.$param['type']]);
+ unset(\danog\MadelineProto\Lang::$lang['en']['object_'.$constructor.'_param_'.$param['name'].'_type_'.$param['type']]);
continue;
}
$ptype = $param[isset($param['subtype']) ? 'subtype' : 'type'];
- //$type_or_bare_type = 'types';
- /*if (isset($param['subtype'])) {
- if ($param['type'] === 'vector') {
- $type_or_bare_type = 'constructors';
- }
- }*/
if (\preg_match('/%/', $ptype)) {
$ptype = $this->TL->getConstructors($this->td)->findByType(\str_replace('%', '', $ptype))['predicate'];
}
@@ -155,15 +146,15 @@ trait Constructors
if (\in_array($ptype, ['InputEncryptedFile']) && !isset($this->settings['td'])) {
$human_ptype = 'File path or '.$ptype;
}
- $table .= '|'.\str_replace('_', '\\_', $param['name']).'|'.(isset($param['subtype']) ? 'Array of ' : '').'['.\str_replace('_', '\\_', $human_ptype).'](../'.$type_or_bare_type.'/'.$ptype.'.md) | '.(isset($param['pow']) || $this->TL->getConstructors($this->td)->findByPredicate(\lcfirst($param['type']).'Empty') || $data['type'] === 'InputMedia' && $param['name'] === 'mime_type' || $data['type'] === 'DocumentAttribute' && \in_array($param['name'], ['w', 'h', 'duration']) ? 'Optional' : 'Yes').'|';
- if (!isset($this->TL->getDescriptions()['constructors'][$data['predicate']]['params'][$param['name']])) {
- $this->addToLang('object_'.$data['predicate'].'_param_'.$param['name'].'_type_'.$param['type']);
- if (isset($this->TL->getDescriptions()['constructors'][$data['predicate']]['description'])) {
- $this->TL->getDescriptions()['constructors'][$data['predicate']]['params'][$param['name']] = \danog\MadelineProto\Lang::$lang['en']['object_'.$data['predicate'].'_param_'.$param['name'].'_type_'.$param['type']];
+ $table .= '|'.StrTools::markdownEscape($param['name']).'|'.(isset($param['subtype']) ? 'Array of ' : '').'['.StrTools::markdownEscape($human_ptype).'](../'.$type_or_bare_type.'/'.$ptype.'.md) | '.(isset($param['pow']) || $this->TL->getConstructors($this->td)->findByPredicate(\lcfirst($param['type']).'Empty') || $data['type'] === 'InputMedia' && $param['name'] === 'mime_type' || $data['type'] === 'DocumentAttribute' && \in_array($param['name'], ['w', 'h', 'duration']) ? 'Optional' : 'Yes').'|';
+ if (!isset($this->TL->getDescriptions()['constructors'][$constructor]['params'][$param['name']])) {
+ $this->addToLang('object_'.$constructor.'_param_'.$param['name'].'_type_'.$param['type']);
+ if (isset($this->TL->getDescriptions()['constructors'][$constructor]['description'])) {
+ $this->TL->getDescriptions()['constructors'][$constructor]['params'][$param['name']] = \danog\MadelineProto\Lang::$lang['en']['object_'.$constructor.'_param_'.$param['name'].'_type_'.$param['type']];
}
}
- if (isset($this->TL->getDescriptions()['constructors'][$data['predicate']]['params'][$param['name']])) {
- $table .= $this->TL->getDescriptions()['constructors'][$data['predicate']]['params'][$param['name']].'|';
+ if (isset($this->TL->getDescriptions()['constructors'][$constructor]['params'][$param['name']]) && $this->TL->getDescriptions()['constructors'][$constructor]['params'][$param['name']]) {
+ $table .= $this->TL->getDescriptions()['constructors'][$constructor]['params'][$param['name']].'|';
}
$table .= PHP_EOL;
$pptype = \in_array($ptype, ['string', 'bytes']) ? "'".$ptype."'" : $ptype;
@@ -178,18 +169,18 @@ trait Constructors
$hasreplymarkup = true;
}
}
- $params = "['_' => '".$data['predicate']."'".$params.']';
- $lua_params = "{_='".$data['predicate']."'".$lua_params.'}';
- $pwr_params = '{"_": "'.$data['predicate'].'"'.$pwr_params.'}';
- $description = isset($this->TL->getDescriptions()['constructors'][$data['predicate']]) ? $this->TL->getDescriptions()['constructors'][$data['predicate']]['description'] : $constructor.' attributes, type and example';
+ $params = "['_' => '".$constructor."'".$params.']';
+ $lua_params = "{_='".$constructor."'".$lua_params.'}';
+ $pwr_params = '{"_": "'.$constructor.'"'.$pwr_params.'}';
+ $description = isset($this->TL->getDescriptions()['constructors'][$constructor]) ? $this->TL->getDescriptions()['constructors'][$constructor]['description'] : $constructor.' attributes, type and example';
$symFile = \str_replace('.', '_', $constructor.$layer);
$redir = $symFile !== $constructor.$layer ? "\nredirect_from: /API_docs/constructors/{$symFile}.html" : '';
$header = '---
-title: '.$data['predicate'].'
+title: '.$constructor.'
description: '.$description.'
image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png'.$redir.'
---
-# Constructor: '.\str_replace('_', '\\_', $data['predicate'].$layer).'
+# Constructor: '.StrTools::markdownEscape($constructor.$layer).'
[Back to constructors index](index.md)
@@ -199,73 +190,21 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png'.$redi
';
- if (isset($this->TL->getDescriptions()['constructors'][$data['predicate']])) {
- $header .= $this->TL->getDescriptions()['constructors'][$data['predicate']]['description'].PHP_EOL.PHP_EOL;
+ if (isset($this->TL->getDescriptions()['constructors'][$constructor])) {
+ $header .= $this->TL->getDescriptions()['constructors'][$constructor]['description'].PHP_EOL.PHP_EOL;
}
- $type = '### Type: ['.\str_replace('_', '\\_', $php_type).'](../types/'.$php_type.'.md)
+ $type = '### Type: ['.StrTools::markdownEscape($php_type).'](../types/'.$php_type.'.md)
';
$example = '';
if (!isset($this->settings['td'])) {
- $example = '### Example:
-
-```php
-$'.$constructor.$layer.' = '.$params.';
-```
-
-
-Or, if you\'re into Lua:
-
-```lua
-'.$constructor.$layer.'='.$lua_params.'
-
-```
-
-
-';
+ $example = $this->template('constructor-example', $constructor.$layer, $params, $lua_params);
if ($hasreplymarkup) {
- $example .= '
-## Usage of reply_markup
-
-You can provide bot API reply_markup objects here.
-
-
-';
+ $example .= $this->template('reply_markup');
}
if ($hasentities) {
- $example .= '
-## Usage of parseMode:
-
-Set parseMode to html to enable HTML parsing of the message.
-
-Set parseMode to Markdown to enable markown AND html parsing of the message.
-
-The following tags are currently supported:
-
-```html
-
a newline
-bold works ok, internal tags are stripped
-bold
-italic
-italic
-inline fixed-width code
-pre-formatted fixed-width code block
-URL
-Mention by username
-Mention by user id
-Pre tags can have a language attribute
-```
-
-You can also use normal markdown, note that to create mentions you must use the `mention:` syntax like in html:
-
-```markdown
-[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).
-';
+ $example .= $this->template('parse_mode');
}
}
\file_put_contents('constructors/'.$constructor.$layer.'.md', $header.$table.$type.$example);
@@ -275,19 +214,10 @@ MadelineProto supports all html entities supported by [html_entity_decode](http:
$last_namespace = '';
foreach ($this->docs_constructors as $constructor => &$value) {
$new_namespace = \preg_replace('/_.*/', '', $constructor);
- $br = $new_namespace != $last_namespace ? '***
-
' : '';
+ $br = $new_namespace != $last_namespace ? "***\n
" : '';
$value = $br.$value;
$last_namespace = $new_namespace;
}
- \file_put_contents('constructors/'.$this->index, '---
-title: Constructors
-description: List of constructors
-image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
----
-# Constructors
-[Back to API documentation index](..)
-
-'.\implode('', $this->docs_constructors));
+ \file_put_contents('constructors/'.$this->index, $this->template('constructors-index', \implode('', $this->docs_constructors)));
}
}
diff --git a/src/danog/MadelineProto/DocsBuilder/Methods.php b/src/danog/MadelineProto/DocsBuilder/Methods.php
index 81f662fc..cc0094d3 100644
--- a/src/danog/MadelineProto/DocsBuilder/Methods.php
+++ b/src/danog/MadelineProto/DocsBuilder/Methods.php
@@ -19,6 +19,7 @@
namespace danog\MadelineProto\DocsBuilder;
+use danog\MadelineProto\StrTools;
use danog\MadelineProto\Tools;
trait Methods
@@ -56,7 +57,7 @@ trait Methods
$this->logger->logger('Generating methods documentation...', \danog\MadelineProto\Logger::NOTICE);
foreach ($this->TL->getMethods($this->td)->by_id as $id => $data) {
$method = $data['method'];
- $php_method = \str_replace('.', '->', $data['method']);
+ $phpMethod = StrTools::methodEscape($method);
$type = \str_replace(['<', '>'], ['_of_', ''], $data['type']);
$php_type = \preg_replace('/.*_of_/', '', $type);
if (!isset($this->types[$php_type])) {
@@ -74,31 +75,31 @@ trait Methods
$param['name'] = 'message';
$param['type'] = 'DecryptedMessage';
}
- if ($param['name'] === 'chat_id' && $data['method'] !== 'messages.discardEncryption' && !isset($this->settings['td'])) {
+ if ($param['name'] === 'chat_id' && $method !== 'messages.discardEncryption' && !isset($this->settings['td'])) {
$param['type'] = 'InputPeer';
}
$type_or_subtype = isset($param['subtype']) ? 'subtype' : 'type';
$type_or_bare_type = \ctype_upper(Tools::end(\explode('.', $param[$type_or_subtype]))[0]) || \in_array($param[$type_or_subtype], ['!X', 'X', 'bytes', 'true', 'false', 'double', 'string', 'Bool', 'int', 'long', 'int128', 'int256', 'int512', 'int53']) ? 'types' : 'constructors';
$param[$type_or_subtype] = \str_replace(['true', 'false'], ['Bool', 'Bool'], $param[$type_or_subtype]);
- $param[$type_or_subtype] = '['.Tools::markdownEscape($param[$type_or_subtype]).'](../'.$type_or_bare_type.'/'.$param[$type_or_subtype].'.md)';
+ $param[$type_or_subtype] = '['.StrTools::markdownEscape($param[$type_or_subtype]).'](../'.$type_or_bare_type.'/'.$param[$type_or_subtype].'.md)';
$params .= "'".$param['name']."' => ".(isset($param['subtype']) ? '\\['.$param[$type_or_subtype].'\\]' : $param[$type_or_subtype]).', ';
}
- if (!isset($this->td_descriptions['methods'][$data['method']])) {
- $this->addToLang('method_'.$data['method']);
- if (\danog\MadelineProto\Lang::$lang['en']['method_'.$data['method']] !== '') {
- $this->td_descriptions['methods'][$data['method']]['description'] = \danog\MadelineProto\Lang::$lang['en']['method_'.$data['method']];
+ if (!isset($this->td_descriptions['methods'][$method])) {
+ $this->addToLang('method_'.$method);
+ if (\danog\MadelineProto\Lang::$lang['en']['method_'.$method] !== '') {
+ $this->td_descriptions['methods'][$method]['description'] = \danog\MadelineProto\Lang::$lang['en']['method_'.$method];
}
}
- $md_method = '['.$php_method.']('.$method.'.md)';
- $this->docs_methods[$method] = '$MadelineProto->'.$md_method.'(\\['.$params.'\\]) === [$'.\str_replace('_', '\\_', $type).'](../types/'.$php_type.'.md)
+ $md_method = '['.$phpMethod.']('.$method.'.md)';
+ $this->docs_methods[$method] = '$MadelineProto->'.$md_method.'(\\['.$params.'\\]) === [$'.StrTools::markdownEscape($type).'](../types/'.$php_type.'.md)
';
- if (isset($this->td_descriptions['methods'][$data['method']])) {
- $desc = \Parsedown::instance()->line(\trim(\explode("\n", $this->td_descriptions['methods'][$data['method']]['description'])[0], '.'));
+ if (isset($this->td_descriptions['methods'][$method])) {
+ $desc = \Parsedown::instance()->line(\trim(\explode("\n", $this->td_descriptions['methods'][$method]['description'])[0], '.'));
$dom = new \DOMDocument();
$dom->loadHTML(\mb_convert_encoding($desc, 'HTML-ENTITIES', 'UTF-8'));
$desc = $dom->textContent;
- $this->human_docs_methods[$this->td_descriptions['methods'][$data['method']]['description'].': '.$data['method']] = '* '.$desc.': '.$data['method'].'
+ $this->human_docs_methods[$this->td_descriptions['methods'][$method]['description'].': '.$method] = '* '.$desc.': '.$method.'
';
}
@@ -111,7 +112,7 @@ trait Methods
| Name | Type | Required |
|----------|---------------|----------|
';
- if (isset($this->td_descriptions['methods'][$data['method']]) && !empty($data['params'])) {
+ if (isset($this->td_descriptions['methods'][$method]) && !empty($data['params'])) {
$table = '### Parameters:
| Name | Type | Description | Required |
@@ -129,7 +130,7 @@ trait Methods
$param['name'] = 'message';
$param['type'] = 'DecryptedMessage';
}
- if ($param['name'] === 'chat_id' && $data['method'] !== 'messages.discardEncryption' && !isset($this->settings['td'])) {
+ if ($param['name'] === 'chat_id' && $method !== 'messages.discardEncryption' && !isset($this->settings['td'])) {
$param['type'] = 'InputPeer';
}
if ($param['name'] === 'hash' && $param['type'] === 'int') {
@@ -163,16 +164,15 @@ trait Methods
$human_ptype = 'File path or '.$ptype;
}
$type_or_bare_type = \ctype_upper(Tools::end(\explode('.', $param[$type_or_subtype]))[0]) || \in_array($param[$type_or_subtype], ['!X', 'X', 'bytes', 'true', 'false', 'double', 'string', 'Bool', 'int', 'long', 'int128', 'int256', 'int512', 'int53']) ? 'types' : 'constructors';
- if (!isset($this->td_descriptions['methods'][$data['method']]['params'][$param['name']])) {
- $this->addToLang('method_'.$data['method'].'_param_'.$param['name'].'_type_'.$param['type']);
- if (isset($this->td_descriptions['methods'][$data['method']]['description'])) {
- $this->td_descriptions['methods'][$data['method']]['params'][$param['name']] = \danog\MadelineProto\Lang::$lang['en']['method_'.$data['method'].'_param_'.$param['name'].'_type_'.$param['type']];
+ if (!isset($this->td_descriptions['methods'][$method]['params'][$param['name']])) {
+ if (isset($this->td_descriptions['methods'][$method]['description'])) {
+ $this->td_descriptions['methods'][$method]['params'][$param['name']] = \danog\MadelineProto\Lang::$lang['en']['method_'.$method.'_param_'.$param['name'].'_type_'.$param['type']] ?? '';
}
}
- if (isset($this->td_descriptions['methods'][$data['method']])) {
- $table .= '|'.\str_replace('_', '\\_', $param['name']).'|'.(isset($param['subtype']) ? 'Array of ' : '').'['.\str_replace('_', '\\_', $human_ptype).'](../'.$type_or_bare_type.'/'.$ptype.'.md) | '.$this->td_descriptions['methods'][$data['method']]['params'][$param['name']].' | '.(isset($param['pow']) || ($id = $this->TL->getConstructors($this->td)->findByPredicate(\lcfirst($param['type']).'Empty')) && $id['type'] === $param['type'] || ($id = $this->TL->getConstructors($this->td)->findByPredicate('input'.$param['type'].'Empty')) && $id['type'] === $param['type'] ? 'Optional' : 'Yes').'|';
+ if (isset($this->td_descriptions['methods'][$method])) {
+ $table .= '|'.StrTools::markdownEscape($param['name']).'|'.(isset($param['subtype']) ? 'Array of ' : '').'['.StrTools::markdownEscape($human_ptype).'](../'.$type_or_bare_type.'/'.$ptype.'.md) | '.$this->td_descriptions['methods'][$method]['params'][$param['name']].' | '.(isset($param['pow']) || ($id = $this->TL->getConstructors($this->td)->findByPredicate(\lcfirst($param['type']).'Empty')) && $id['type'] === $param['type'] || ($id = $this->TL->getConstructors($this->td)->findByPredicate('input'.$param['type'].'Empty')) && $id['type'] === $param['type'] ? 'Optional' : 'Yes').'|';
} else {
- $table .= '|'.\str_replace('_', '\\_', $param['name']).'|'.(isset($param['subtype']) ? 'Array of ' : '').'['.\str_replace('_', '\\_', $human_ptype).'](../'.$type_or_bare_type.'/'.$ptype.'.md) | '.(isset($param['pow']) || ($id = $this->TL->getConstructors($this->td)->findByPredicate(\lcfirst($param['type']).'Empty')) && $id['type'] === $param['type'] || ($id = $this->TL->getConstructors($this->td)->findByPredicate('input'.$param['type'].'Empty')) && $id['type'] === $param['type'] ? 'Optional' : 'Yes').'|';
+ $table .= '|'.StrTools::markdownEscape($param['name']).'|'.(isset($param['subtype']) ? 'Array of ' : '').'['.StrTools::markdownEscape($human_ptype).'](../'.$type_or_bare_type.'/'.$ptype.'.md) | '.(isset($param['pow']) || ($id = $this->TL->getConstructors($this->td)->findByPredicate(\lcfirst($param['type']).'Empty')) && $id['type'] === $param['type'] || ($id = $this->TL->getConstructors($this->td)->findByPredicate('input'.$param['type'].'Empty')) && $id['type'] === $param['type'] ? 'Optional' : 'Yes').'|';
}
$table .= PHP_EOL;
$pptype = \in_array($ptype, ['string', 'bytes']) ? "'".$ptype."'" : $ptype;
@@ -200,128 +200,41 @@ trait Methods
$pwr_params = "parseMode - string\n";
}
}
- $description = isset($this->td_descriptions['methods'][$data['method']]) ? $this->td_descriptions['methods'][$data['method']]['description'] : $data['method'].' parameters, return type and example';
+ $description = isset($this->td_descriptions['methods'][$method]) ? $this->td_descriptions['methods'][$method]['description'] : $method.' parameters, return type and example';
$symFile = \str_replace('.', '_', $method);
$redir = $symFile !== $method ? "\nredirect_from: /API_docs/methods/{$symFile}.html" : '';
- $header = '---
-title: '.$data['method'].'
-description: '.$description.'
-image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png'.$redir.'
----
-# Method: '.\str_replace('_', '\\_', $data['method']).'
-[Back to methods index](index.md)
-
-
-';
- /*
- if (isset(\danog\MadelineProto\MTProto::DISALLOWED_METHODS[$data['method']])) {
- $header .= '**'.\danog\MadelineProto\MTProto::DISALLOWED_METHODS[$data['method']]."**\n\n\n\n\n";
- file_put_contents('methods/'.$method.'.md', $header);
- continue;
- }*/
+ $header = $this->template('Method', $method, $description, $redir, StrTools::markdownEscape($method));
if ($this->td) {
- $header .= 'YOU CANNOT USE THIS METHOD IN MADELINEPROTO
-
-
-';
+ $header .= "YOU CANNOT USE THIS METHOD IN MADELINEPROTO\n\n\n\n\n";
}
- $header .= isset($this->td_descriptions['methods'][$data['method']]) ? $this->td_descriptions['methods'][$data['method']]['description'].PHP_EOL.PHP_EOL : '';
+ $header .= isset($this->td_descriptions['methods'][$method]) ? $this->td_descriptions['methods'][$method]['description'].PHP_EOL.PHP_EOL : '';
$table .= '
';
- $return = '### Return type: ['.\str_replace('_', '\\_', $type).'](../types/'.$php_type.'.md)
+ $return = '### Return type: ['.StrTools::markdownEscape($type).'](../types/'.$php_type.'.md)
';
- $bot = !\in_array($data['method'], $bots);
+ $bot = !\in_array($method, $bots);
$example = '';
if (!isset($this->settings['td'])) {
$example .= '### Can bots use this method: **'.($bot ? 'YES' : 'NO')."**\n\n\n";
- $example .= \str_replace('[]', '', '### 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();
-
-$'.$type.' = $MadelineProto->'.$php_method.'(['.$params.']);
-```
-
-Or, if you\'re into Lua:
-
-```lua
-'.$type.' = '.$data['method'].'({'.$lua_params.'})
-```
-
-');
+ $example .= \str_replace('[]', '', $this->template('method-example', $type, $phpMethod, $params, $method, $lua_params));
if ($hasreplymarkup) {
- $example .= '
-## Usage of reply_markup
-
-You can provide bot API reply_markup objects here.
-
-
-';
+ $example .= $this->template('reply_markup');
}
if ($hasmessage) {
- $example .= '
-## 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 ['.\str_replace('_', '\\_', $type).'](../types/'.$php_type.'.md) will be returned instead.
-
-
-';
+ $example .= $this->template('chunks', StrTools::markdownEscape($type), $php_type);
}
if ($hasentities) {
- $example .= '
-## Usage of parseMode:
-
-Set parseMode to html to enable HTML parsing of the message.
-
-Set parseMode to Markdown to enable markown AND html parsing of the message.
-
-The following tags are currently supported:
-
-```html
-
a newline
-bold works ok, internal tags are stripped
-bold
-italic
-italic
-underline
-strikethrough
-strikethrough
-strikethrough
-inline fixed-width code
-pre-formatted fixed-width code block
-pre-formatted fixed-width code block
-URL
-Mention by username
-Mention by user id
-Pre tags can have a language attribute
-```
-
-You can also use normal markdown, note that to create mentions you must use the `mention:` syntax like in html:
-
-```markdown
-[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).
-';
+ $example .= $this->template('parse_mode');
}
- if (isset($new['result'][$data['method']])) {
+ if (isset($new['result'][$method])) {
$example .= '### Errors
| Code | Type | Description |
|------|----------|---------------|
';
- foreach ($new['result'][$data['method']] as $error) {
+ foreach ($new['result'][$method] as $error) {
[$error, $code] = $error;
$example .= "|{$code}|{$error}|".$errors['human_result'][$error][0].'|'."\n";
}
@@ -342,75 +255,7 @@ MadelineProto supports all html entities supported by [html_entity_decode](http:
$value = $br.$value;
$last_namespace = $new_namespace;
}
- \file_put_contents('methods/api_'.$this->index, '---
-title: Methods
-description: List of methods
-image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
----
-# Methods
-[Back to API documentation index](..)
-
-[Go to the new description-version method index]('.$this->index.')
-
-$MadelineProto->[logout](https://docs.madelineproto.xyz/logout.html)();
-
-$MadelineProto->[phoneLogin](https://docs.madelineproto.xyz/phoneLogin.html)($number);
-
-$MadelineProto->[completePhoneLogin](https://docs.madelineproto.xyz/completePhoneLogin.html)($code);
-
-$MadelineProto->[complete2FALogin](https://docs.madelineproto.xyz/complete2FAlogin.html)($password);
-
-$MadelineProto->[botLogin](https://docs.madelineproto.xyz/botLogin.html)($token);
-
-
-$MadelineProto->[getDialogs](https://docs.madelineproto.xyz/getDialogs.html)();
-
-$MadelineProto->[getPwrChat](https://docs.madelineproto.xyz/getPwrChat.html)($id);
-
-$MadelineProto->[getInfo](https://docs.madelineproto.xyz/getInfo.html)($id);
-
-$MadelineProto->[getFullInfo](https://docs.madelineproto.xyz/getFullInfo.html)($id);
-
-$MadelineProto->[getSelf](https://docs.madelineproto.xyz/getSelf.html)();
-
-
-$MadelineProto->[requestCall](https://docs.madelineproto.xyz/requestCall.html)($id);
-
-$MadelineProto->[requestSecretChat](https://docs.madelineproto.xyz/requestSecretChat.html)($id);
-
-'.\implode('', $this->docs_methods));
- \file_put_contents('methods/'.$this->index, '---
-title: Methods
-description: What do you want to do?
-image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
----
-# What do you want to do?
-[Go back to API documentation index](..)
-
-[Go to the old code-version method index](api_'.$this->index.')
-
-* [Logout](https://docs.madelineproto.xyz/logout.html)
-
-* [Login](https://docs.madelineproto.xyz/docs/LOGIN.html)
-
-* [Change 2FA password](https://docs.madelineproto.xyz/update2fa.html)
-
-* [Get all chats, broadcast a message to all chats](https://docs.madelineproto.xyz/docs/DIALOGS.html)
-
-* [Get the full participant list of a channel/group/supergroup](https://docs.madelineproto.xyz/getPwrChat.html)
-
-* [Get full info about a user/chat/supergroup/channel](https://docs.madelineproto.xyz/getFullInfo.html)
-
-* [Get info about a user/chat/supergroup/channel](https://docs.madelineproto.xyz/getInfo.html)
-
-* [Get info about the currently logged-in user](https://docs.madelineproto.xyz/getSelf.html)
-
-* [Upload or download files up to 1.5 GB](https://docs.madelineproto.xyz/docs/FILES.html)
-
-* [Make a phone call and play a song](https://docs.madelineproto.xyz/docs/CALLS.html)
-
-* [Create a secret chat bot](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html)
-
-'.\implode('', $this->human_docs_methods));
+ \file_put_contents('methods/api_'.$this->index, $this->template('methods-api-index', $this->index, \implode('', $this->docs_methods)));
+ \file_put_contents('methods/'.$this->index, $this->template('methods-index', $this->index, \implode('', $this->human_docs_methods)));
}
}
diff --git a/src/danog/MadelineProto/InternalDoc.php b/src/danog/MadelineProto/InternalDoc.php
index d49a4120..4fd7599e 100644
--- a/src/danog/MadelineProto/InternalDoc.php
+++ b/src/danog/MadelineProto/InternalDoc.php
@@ -10,13 +10,13 @@ namespace danog\MadelineProto;
interface auth
{
/**
- * You cannot use this method directly, use the phoneLogin method instead (see https://docs.madelineproto.xyz for more info).
+ * Send the verification code for login.
*
* Parameters:
- * * `string` **phone_number** - You cannot use this method directly, use the phoneLogin method instead (see https://docs.madelineproto.xyz for more info)
- * * `int` **api_id** - You cannot use this method directly, use the phoneLogin method instead (see https://docs.madelineproto.xyz for more info)
- * * `string` **api_hash** - You cannot use this method directly, use the phoneLogin method instead (see https://docs.madelineproto.xyz for more info)
- * * `CodeSettings` **settings** - You cannot use this method directly, use the phoneLogin method instead (see https://docs.madelineproto.xyz for more info)
+ * * `string` **phone_number** - Phone number in international format
+ * * `int` **api_id** - Application identifier (see [App configuration](https://core.telegram.org/myapp))
+ * * `string` **api_hash** - Application secret hash (see [App configuration](https://core.telegram.org/myapp))
+ * * `CodeSettings` **settings** - Settings for the code type to send
*
* @param array $params Parameters
*
@@ -25,13 +25,13 @@ interface auth
public function sendCode($params);
/**
- * You cannot use this method directly, use the completeSignup method instead (see https://docs.madelineproto.xyz for more info).
+ * Registers a validated phone number in the system.
*
* Parameters:
- * * `string` **phone_number** - You cannot use this method directly, use the completeSignup method instead (see https://docs.madelineproto.xyz for more info)
- * * `string` **phone_code_hash** - You cannot use this method directly, use the completeSignup method instead (see https://docs.madelineproto.xyz for more info)
- * * `string` **first_name** - You cannot use this method directly, use the completeSignup method instead (see https://docs.madelineproto.xyz for more info)
- * * `string` **last_name** - You cannot use this method directly, use the completeSignup method instead (see https://docs.madelineproto.xyz for more info)
+ * * `string` **phone_number** - Phone number in the international format
+ * * `string` **phone_code_hash** - SMS-message ID
+ * * `string` **first_name** - New user first name
+ * * `string` **last_name** - New user last name
*
* @param array $params Parameters
*
@@ -40,12 +40,12 @@ interface auth
public function signUp($params);
/**
- * You cannot use this method directly, use the completePhoneLogin method instead (see https://docs.madelineproto.xyz for more info).
+ * Signs in a user with a validated phone number.
*
* Parameters:
- * * `string` **phone_number** - You cannot use this method directly, use the completePhoneLogin method instead (see https://docs.madelineproto.xyz for more info)
- * * `string` **phone_code_hash** - You cannot use this method directly, use the completePhoneLogin method instead (see https://docs.madelineproto.xyz for more info)
- * * `string` **phone_code** - You cannot use this method directly, use the completePhoneLogin method instead (see https://docs.madelineproto.xyz for more info)
+ * * `string` **phone_number** - Phone number in the international format
+ * * `string` **phone_code_hash** - SMS-message ID, obtained from [auth.sendCode](https://docs.madelineproto.xyz/API_docs/methods/auth.sendCode.html)
+ * * `string` **phone_code** - Valid numerical code from the SMS-message
*
* @param array $params Parameters
*
@@ -54,7 +54,7 @@ interface auth
public function signIn($params);
/**
- * You cannot use this method directly, use the logout method instead (see https://docs.madelineproto.xyz for more info).
+ * Logs out the user.
*
* @return bool
*/
@@ -70,10 +70,10 @@ interface auth
public function resetAuthorizations();
/**
- * You cannot use this method directly, use $MadelineProto->exportAuthorization() instead, see https://docs.madelineproto.xyz/docs/LOGIN.html.
+ * Returns data for copying authorization to another data-centre.
*
* Parameters:
- * * `int` **dc_id** - You cannot use this method directly, use $MadelineProto->exportAuthorization() instead, see https://docs.madelineproto.xyz/docs/LOGIN.html
+ * * `int` **dc_id** - Number of a target data-centre
*
* @param array $params Parameters
*
@@ -82,11 +82,11 @@ interface auth
public function exportAuthorization($params);
/**
- * You cannot use this method directly, use $MadelineProto->importAuthorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html.
+ * Logs in a user using a key transmitted from his native data-centre.
*
* Parameters:
- * * `int` **id** - You cannot use this method directly, use $MadelineProto->importAuthorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html
- * * `bytes` **bytes** - You cannot use this method directly, use $MadelineProto->importAuthorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html
+ * * `int` **id** - User ID
+ * * `bytes` **bytes** - Authorization key
*
* @param array $params Parameters
*
@@ -95,13 +95,15 @@ interface auth
public function importAuthorization($params);
/**
- * You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info.
+ * Binds a temporary authorization key `temp_auth_key_id` to the permanent authorization key `perm_auth_key_id`. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one.
+ *
+ * For more information, see [Perfect Forward Secrecy](https://core.telegram.org/api/pfs).
*
* Parameters:
- * * `long` **perm_auth_key_id** - You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info
- * * `long` **nonce** - You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info
- * * `int` **expires_at** - You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info
- * * `bytes` **encrypted_message** - You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info
+ * * `long` **perm_auth_key_id** - Permanent auth\_key\_id to bind to
+ * * `long` **nonce** - Random long from [Binding message contents](#binding-message-contents)
+ * * `int` **expires_at** - Unix timestamp to invalidate temporary key, see [Binding message contents](#binding-message-contents)
+ * * `bytes` **encrypted_message** - See [Generating encrypted\_message](#generating-encrypted-message)
*
* @param array $params Parameters
*
@@ -110,12 +112,12 @@ interface auth
public function bindTempAuthKey($params);
/**
- * You cannot use this method directly, use the botLogin method instead (see https://docs.madelineproto.xyz for more info).
+ * Login as a bot.
*
* Parameters:
- * * `int` **api_id** - You cannot use this method directly, use the botLogin method instead (see https://docs.madelineproto.xyz for more info)
- * * `string` **api_hash** - You cannot use this method directly, use the botLogin method instead (see https://docs.madelineproto.xyz for more info)
- * * `string` **bot_auth_token** - You cannot use this method directly, use the botLogin method instead (see https://docs.madelineproto.xyz for more info)
+ * * `int` **api_id** - Application identifier (see. [App configuration](https://core.telegram.org/myapp))
+ * * `string` **api_hash** - Application identifier hash (see. [App configuration](https://core.telegram.org/myapp))
+ * * `string` **bot_auth_token** - Bot token (see [bots](https://core.telegram.org/bots))
*
* @param array $params Parameters
*
@@ -124,10 +126,10 @@ interface auth
public function importBotAuthorization($params);
/**
- * You cannot use this method directly, use the complete2falogin method instead (see https://docs.madelineproto.xyz for more info).
+ * Try logging to an account protected by a [2FA password](https://core.telegram.org/api/srp).
*
* Parameters:
- * * `InputCheckPasswordSRP` **password** - You cannot use this method directly, use the complete2falogin method instead (see https://docs.madelineproto.xyz for more info)
+ * * `InputCheckPasswordSRP` **password** - The account's password (see [SRP](https://core.telegram.org/api/srp))
*
* @param array $params Parameters
*
@@ -184,7 +186,7 @@ interface auth
* Delete all temporary authorization keys **except for** the ones specified.
*
* Parameters:
- * * `[long]` **except_auth_keys** - The temporary authorization keys to keep
+ * * `[long]` **except_auth_keys** - The auth keys that **shouldn't** be dropped.
*
* @param array $params Parameters
*
@@ -193,12 +195,15 @@ interface auth
public function dropTempAuthKeys($params);
/**
+ * Generate a login token, for [login via QR code](https://core.telegram.org/api/qr-login).
+ * The generated login token should be encoded using base64url, then shown as a `tg://login?token=base64encodedtoken` URL in the QR code.
*
+ * For more info, see [login via QR code](https://core.telegram.org/api/qr-login).
*
* Parameters:
- * * `int` **api_id** -
- * * `string` **api_hash** -
- * * `[int]` **except_ids** -.
+ * * `int` **api_id** - Application identifier (see. [App configuration](https://core.telegram.org/myapp))
+ * * `string` **api_hash** - Application identifier hash (see. [App configuration](https://core.telegram.org/myapp))
+ * * `[int]` **except_ids** - List of already logged-in user IDs, to prevent logging in twice with the same user
*
* @param array $params Parameters
*
@@ -207,10 +212,12 @@ interface auth
public function exportLoginToken($params);
/**
+ * Login using a redirected login token, generated in case of DC mismatch during [QR code login](https://core.telegram.org/api/qr-login).
*
+ * For more info, see [login via QR code](https://core.telegram.org/api/qr-login).
*
* Parameters:
- * * `bytes` **token** -.
+ * * `bytes` **token** - Login token
*
* @param array $params Parameters
*
@@ -219,10 +226,14 @@ interface auth
public function importLoginToken($params);
/**
+ * Accept QR code login token, logging in the app that generated it.
*
+ * Returns info about the new session.
+ *
+ * For more info, see [login via QR code](https://core.telegram.org/api/qr-login).
*
* Parameters:
- * * `bytes` **token** -.
+ * * `bytes` **token** - Login token embedded in QR code, for more info, see [login via QR code](https://core.telegram.org/api/qr-login).
*
* @param array $params Parameters
*
@@ -242,7 +253,7 @@ interface account
* * `string` **token** - Device token
* * `Bool` **app_sandbox** - If [(boolTrue)](https://docs.madelineproto.xyz/API_docs/constructors/boolTrue.html) is transmitted, a sandbox-certificate will be used during transmission.
* * `bytes` **secret** - For FCM and APNS VoIP, optional encryption key used to encrypt push notifications
- * * `[int]` **other_uids** - Other UIDs
+ * * `[int]` **other_uids** - List of user identifiers of other users currently using the client
*
* @param array $params Parameters
*
@@ -256,7 +267,7 @@ interface account
* Parameters:
* * `int` **token_type** - Device token type.
**Possible values**:
`1` \- APNS (device token for apple push)
`2` \- FCM (firebase token for google firebase)
`3` \- MPNS (channel URI for microsoft push)
`4` \- Simple push (endpoint for firefox's simple push API)
`5` \- Ubuntu phone (token for ubuntu push)
`6` \- Blackberry (token for blackberry push)
`7` \- Unused
`8` \- WNS (windows push)
`9` \- APNS VoIP (token for apple push VoIP)
`10` \- Web push (web push, see below)
`11` \- MPNS VoIP (token for microsoft push VoIP)
`12` \- Tizen (token for tizen push)
For `10` web push, the token must be a JSON-encoded object containing the keys described in [PUSH updates](https://core.telegram.org/api/push-updates)
* * `string` **token** - Device token
- * * `[int]` **other_uids** - Other UIDs
+ * * `[int]` **other_uids** - List of user identifiers of other users currently using the client
*
* @param array $params Parameters
*
@@ -326,7 +337,7 @@ interface account
* Returns a list of available wallpapers.
*
* Parameters:
- * * `[int]` **hash** - Optional: IDs of previously fetched wallpapers
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -351,7 +362,7 @@ interface account
* Validates a username and checks availability.
*
* Parameters:
- * * `string` **username** - Username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
+ * * `string` **username** - username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
*
* @param array $params Parameters
*
@@ -363,7 +374,7 @@ interface account
* Changes username for the current user.
*
* Parameters:
- * * `string` **username** - Username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
+ * * `string` **username** - username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
*
* @param array $params Parameters
*
@@ -388,7 +399,7 @@ interface account
*
* Parameters:
* * `InputPrivacyKey` **key** - Peers to which the privacy rules apply
- * * `[InputPrivacyRule]` **rules** - Privacy settings
+ * * `[InputPrivacyRule]` **rules** - New privacy rules
*
* @param array $params Parameters
*
@@ -493,10 +504,10 @@ interface account
public function getPassword();
/**
- * You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info).
+ * Get private info associated to the password info (recovery email, telegram [passport](https://core.telegram.org/passport) info & so on).
*
* Parameters:
- * * `InputCheckPasswordSRP` **password** - You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info)
+ * * `InputCheckPasswordSRP` **password** - The password (see [SRP](https://core.telegram.org/api/srp))
*
* @param array $params Parameters
*
@@ -505,11 +516,11 @@ interface account
public function getPasswordSettings($params);
/**
- * You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info).
+ * Set a new 2FA password.
*
* Parameters:
- * * `InputCheckPasswordSRP` **password** - You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info)
- * * `account.PasswordInputSettings` **new_settings** - You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info)
+ * * `InputCheckPasswordSRP` **password** - The old password (see [SRP](https://core.telegram.org/api/srp))
+ * * `account.PasswordInputSettings` **new_settings** - The new password (see [SRP](https://core.telegram.org/api/srp))
*
* @param array $params Parameters
*
@@ -593,7 +604,7 @@ interface account
* Get saved [Telegram Passport](https://core.telegram.org/passport) document, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption).
*
* Parameters:
- * * `[SecureValueType]` **types** - Get telegram passport secure parameters
+ * * `[SecureValueType]` **types** - Requested value types
*
* @param array $params Parameters
*
@@ -618,7 +629,7 @@ interface account
* Delete stored [Telegram Passport](https://core.telegram.org/passport) documents, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption).
*
* Parameters:
- * * `[SecureValueType]` **types** - The values to delete
+ * * `[SecureValueType]` **types** - Document types to delete
*
* @param array $params Parameters
*
@@ -647,7 +658,7 @@ interface account
* * `int` **bot_id** - Bot ID
* * `string` **scope** - Telegram Passport element types requested by the service
* * `string` **public_key** - Service's public key
- * * `[SecureValueHash]` **value_hashes** - Hashes of the encrypted credentials
+ * * `[SecureValueHash]` **value_hashes** - Types of values sent and their hashes
* * `SecureCredentialsEncrypted` **credentials** - Encrypted values
*
* @param array $params Parameters
@@ -899,7 +910,7 @@ interface account
* * `string` **slug** - Unique theme ID
* * `string` **title** - Theme name
* * `InputDocument` **document** - Optional: Theme file
- * * `InputThemeSettings` **settings** - Optional:
+ * * `InputThemeSettings` **settings** - Optional: Theme settings
*
* @param array $params Parameters
*
@@ -916,7 +927,7 @@ interface account
* * `string` **slug** - Optional: Unique theme ID
* * `string` **title** - Optional: Theme name
* * `InputDocument` **document** - Optional: Theme file
- * * `InputThemeSettings` **settings** - Optional:
+ * * `InputThemeSettings` **settings** - Optional: Theme settings
*
* @param array $params Parameters
*
@@ -970,7 +981,7 @@ interface account
*
* Parameters:
* * `string` **format** - Theme format, a string that identifies the theming engines supported by the client
- * * `[int]` **hash** - Optional: Hash for pagination
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -979,10 +990,10 @@ interface account
public function getThemes($params);
/**
- *
+ * Set sensitive content settings (for viewing or hiding NSFW content).
*
* Parameters:
- * * `boolean` **sensitive_enabled** - Optional:.
+ * * `boolean` **sensitive_enabled** - Optional: Enable NSFW content
*
* @param array $params Parameters
*
@@ -991,17 +1002,17 @@ interface account
public function setContentSettings($params);
/**
- *
+ * Get sensitive content settings.
*
* @return account.ContentSettings
*/
public function getContentSettings();
/**
- *
+ * Get info about multiple wallpapers.
*
* Parameters:
- * * `[InputWallPaper]` **wallpapers** -.
+ * * `[InputWallPaper]` **wallpapers** - Wallpapers to fetch info about
*
* @param array $params Parameters
*
@@ -1016,7 +1027,7 @@ interface users
* Returns basic user info according to their identifiers.
*
* Parameters:
- * * `[InputUser]` **id** - The ids of the users
+ * * `[InputUser]` **id** - List of user identifiers
*
* @param array $params Parameters
*
@@ -1025,10 +1036,10 @@ interface users
public function getUsers($params);
/**
- * You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info).
+ * Returns extended user info by ID.
*
* Parameters:
- * * `InputUser` **id** - You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info)
+ * * `InputUser` **id** - User ID
*
* @param array $params Parameters
*
@@ -1043,7 +1054,7 @@ interface users
*
* Parameters:
* * `InputUser` **id** - The user
- * * `[SecureValueError]` **errors** - The errors
+ * * `[SecureValueError]` **errors** - Errors
*
* @param array $params Parameters
*
@@ -1058,7 +1069,7 @@ interface contacts
* Get contact by telegram IDs.
*
* Parameters:
- * * `[int]` **hash** - Optional: Previously fetched IDs
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -1077,7 +1088,7 @@ interface contacts
* Returns the current user's contact list.
*
* Parameters:
- * * `[int]` **hash** - Optional: User IDs of previously cached contacts
+ * * `[int]` **hash** - Optional: If there already is a full contact list on the client, a [hash](https://core.telegram.org/api/offsets#hash-generation) of a the list of contact IDs in ascending order may be passed in this parameter. If the contact set was not changed, [(contacts.contactsNotModified)](https://docs.madelineproto.xyz/API_docs/constructors/contacts.contactsNotModified.html) will be returned.
*
* @param array $params Parameters
*
@@ -1088,8 +1099,10 @@ interface contacts
/**
* Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info.
*
+ * Use [contacts.addContact](https://docs.madelineproto.xyz/API_docs/methods/contacts.addContact.html) to add Telegram contacts without actually using their phone number.
+ *
* Parameters:
- * * `[InputContact]` **contacts** - The numbers to import
+ * * `[InputContact]` **contacts** - List of contacts to import
*
* @param array $params Parameters
*
@@ -1101,7 +1114,7 @@ interface contacts
* Deletes several contacts from the list.
*
* Parameters:
- * * `[InputUser]` **id** - The contacts to delete
+ * * `[InputUser]` **id** - User ID list
*
* @param array $params Parameters
*
@@ -1113,7 +1126,7 @@ interface contacts
* Delete contacts by phone number.
*
* Parameters:
- * * `[string]` **phones** - Phones
+ * * `[string]` **phones** - Phone numbers
*
* @param array $params Parameters
*
@@ -1172,10 +1185,10 @@ interface contacts
public function search($params);
/**
- * You cannot use this method directly, use the resolveUsername, getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info).
+ * Resolve a @username to get peer info.
*
* Parameters:
- * * `string` **username** - You cannot use this method directly, use the resolveUsername, getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info)
+ * * `string` **username** - @username to resolve
*
* @param array $params Parameters
*
@@ -1197,7 +1210,7 @@ interface contacts
* * `boolean` **channels** - Optional: Most frequently visited channels
* * `int` **offset** - Offset for [pagination](https://core.telegram.org/api/offsets)
* * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets)
- * * `[int]` **hash** - Optional: Peer IDs of previously cached peers
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -1247,6 +1260,8 @@ interface contacts
/**
* Add an existing telegram user as contact.
*
+ * Use [contacts.importContacts](https://docs.madelineproto.xyz/API_docs/methods/contacts.importContacts.html) to add contacts by phone number, without knowing their Telegram ID.
+ *
* Parameters:
* * `boolean` **add_phone_privacy_exception** - Optional: Allow the other user to see our phone number?
* * `InputUser` **id** - Telegram ID of the other user
@@ -1276,9 +1291,9 @@ interface contacts
* Get contacts near you.
*
* Parameters:
- * * `boolean` **background** - Optional:
+ * * `boolean` **background** - Optional: While the geolocation of the current user is public, clients should update it in the background every half-an-hour or so, while setting this flag.
Do this only if the new location is more than 1 KM away from the previous one, or if the previous location is unknown.
* * `InputGeoPoint` **geo_point** - Geolocation
- * * `int` **self_expires** - Optional:
+ * * `int` **self_expires** - Optional: If set, the geolocation of the current user will be public for the specified number of seconds; pass 0x7fffffff to disable expiry, 0 to make the current geolocation private; if the flag isn't set, no changes will be applied.
*
* @param array $params Parameters
*
@@ -1293,7 +1308,7 @@ interface messages
* Returns the list of messages by their IDs.
*
* Parameters:
- * * `[InputMessage]` **id** - The IDs of messages to fetch (only for users and normal groups)
+ * * `[InputMessage]` **id** - Message ID list
*
* @param array $params Parameters
*
@@ -1306,12 +1321,12 @@ interface messages
*
* Parameters:
* * `boolean` **exclude_pinned** - Optional: Exclude pinned dialogs
- * * `int` **folder_id** - Optional: Folder ID
+ * * `int` **folder_id** - Optional: [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders)
* * `int` **offset_date** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets)
* * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets)
* * `InputPeer` **offset_peer** - [Offset peer for pagination](https://core.telegram.org/api/offsets)
* * `int` **limit** - Number of list elements to be returned
- * * `[int]` **hash** - Optional: IDs of previously fetched dialogs
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -1325,12 +1340,12 @@ interface messages
* Parameters:
* * `InputPeer` **peer** - Target peer
* * `int` **offset_id** - Only return messages starting from the specified message ID
- * * `int` **offset_date** - Only return messages sent after the specified date
+ * * `int` **offset_date** - Only return messages sent before the specified date
* * `int` **add_offset** - Number of list elements to be skipped, negative values are also accepted.
* * `int` **limit** - Number of results to return
* * `int` **max_id** - If a positive value was transferred, the method will return only messages with IDs less than **max\_id**
* * `int` **min_id** - If a positive value was transferred, the method will return only messages with IDs more than **min\_id**
- * * `[int]` **hash** - Optional: IDs of messages you already fetched
+ * * `[int]` **hash** - Optional: [Result hash](https://core.telegram.org/api/offsets)
*
* @param array $params Parameters
*
@@ -1353,7 +1368,7 @@ interface messages
* * `int` **limit** - [Number of results to return](https://core.telegram.org/api/offsets)
* * `int` **max_id** - [Maximum message ID to return](https://core.telegram.org/api/offsets)
* * `int` **min_id** - [Minimum message ID to return](https://core.telegram.org/api/offsets)
- * * `[int]` **hash** - Optional: The IDs of messages you already fetched
+ * * `[int]` **hash** - Optional: [Hash](https://core.telegram.org/api/offsets)
*
* @param array $params Parameters
*
@@ -1394,7 +1409,7 @@ interface messages
*
* Parameters:
* * `boolean` **revoke** - Optional: Whether to delete messages for all participants of the chat
- * * `[int]` **id** - IDs of messages to delete, use channels->deleteMessages for supergroups
+ * * `[int]` **id** - Message ID list
*
* @param array $params Parameters
*
@@ -1439,7 +1454,7 @@ interface messages
* * `int` **reply_to_msg_id** - Optional: The message ID to which this message will reply to
* * `string` **message** - The message
* * `ReplyMarkup` **reply_markup** - Optional: Reply markup for sending bot buttons
- * * `[MessageEntity]` **entities** - Optional: Entities to send (for styled text)
+ * * `[MessageEntity]` **entities** - Optional: Message [entities](https://core.telegram.org/api/entities) for sending styled text
* * `int` **schedule_date** - Optional: Scheduled message date for scheduled messages
*
* @param array $params Parameters
@@ -1460,7 +1475,7 @@ interface messages
* * `InputMedia` **media** - Attached media
* * `string` **message** - Caption
* * `ReplyMarkup` **reply_markup** - Optional: Reply markup for bot keyboards
- * * `[MessageEntity]` **entities** - Optional: Entities for styled text
+ * * `[MessageEntity]` **entities** - Optional: Message [entities](https://core.telegram.org/api/entities) for styled text
* * `int` **schedule_date** - Optional: Scheduled message date for scheduled messages
*
* @param array $params Parameters
@@ -1478,7 +1493,7 @@ interface messages
* * `boolean` **with_my_score** - Optional: When forwarding games, whether to include your score in the game
* * `boolean` **grouped** - Optional: Whether the specified messages represent an album (grouped media)
* * `InputPeer` **from_peer** - Source of messages
- * * `[int]` **id** - The message IDs
+ * * `[int]` **id** - IDs of messages
* * `InputPeer` **to_peer** - Destination peer
* * `int` **schedule_date** - Optional: Scheduled message date for scheduled messages
*
@@ -1517,7 +1532,7 @@ interface messages
*
* Parameters:
* * `InputPeer` **peer** - Peer
- * * `[int]` **id** - The messages to report
+ * * `[int]` **id** - IDs of messages to report
* * `ReportReason` **reason** - Why are these messages being reported
*
* @param array $params Parameters
@@ -1530,7 +1545,7 @@ interface messages
* Returns chat basic info on their IDs.
*
* Parameters:
- * * `[int]` **id** - The MTProto IDs of chats to fetch info about
+ * * `[int]` **id** - List of chat IDs
*
* @param array $params Parameters
*
@@ -1539,10 +1554,10 @@ interface messages
public function getChats($params);
/**
- * You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info).
+ * Returns full chat info according to its ID.
*
* Parameters:
- * * `InputPeer` **chat_id** - You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info)
+ * * `InputPeer` **chat_id** -
*
* @param array $params Parameters
*
@@ -1554,7 +1569,7 @@ interface messages
* Chanages chat name and sends a service message on it.
*
* Parameters:
- * * `InputPeer` **chat_id** - The ID of the chat
+ * * `InputPeer` **chat_id** -
* * `string` **title** - New chat name, different from the old one
*
* @param array $params Parameters
@@ -1567,7 +1582,7 @@ interface messages
* Changes chat photo and sends a service message on it.
*
* Parameters:
- * * `InputPeer` **chat_id** - The ID of the chat
+ * * `InputPeer` **chat_id** -
* * `InputChatPhoto` **photo** - Photo to be set
*
* @param array $params Parameters
@@ -1580,7 +1595,7 @@ interface messages
* Adds a user to a chat and sends a service message on it.
*
* Parameters:
- * * `InputPeer` **chat_id** - The chat where to invite users
+ * * `InputPeer` **chat_id** -
* * `InputUser` **user_id** - User ID to be added
* * `int` **fwd_limit** - Number of last messages to be forwarded
*
@@ -1594,7 +1609,7 @@ interface messages
* Deletes a user from a chat and sends a service message on it.
*
* Parameters:
- * * `InputPeer` **chat_id** - The ID of the chat
+ * * `InputPeer` **chat_id** -
* * `InputUser` **user_id** - User ID to be deleted
*
* @param array $params Parameters
@@ -1607,7 +1622,7 @@ interface messages
* Creates a new chat.
*
* Parameters:
- * * `[InputUser]` **users** - The users to add to the chat
+ * * `[InputUser]` **users** - List of user IDs to be invited
* * `string` **title** - Chat name
*
* @param array $params Parameters
@@ -1617,11 +1632,11 @@ interface messages
public function createChat($params);
/**
- * You cannot use this method directly, instead use $MadelineProto->getDhConfig();.
+ * Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length.
*
* Parameters:
- * * `int` **version** - You cannot use this method directly, instead use $MadelineProto->getDhConfig();
- * * `int` **random_length** - You cannot use this method directly, instead use $MadelineProto->getDhConfig();
+ * * `int` **version** - Value of the **version** parameter from [messages.dhConfig](https://docs.madelineproto.xyz/API_docs/constructors/messages.dhConfig.html), avialable at the client
+ * * `int` **random_length** - Length of the required random sequence
*
* @param array $params Parameters
*
@@ -1630,11 +1645,11 @@ interface messages
public function getDhConfig($params);
/**
- * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats.
+ * Sends a request to start a secret chat to the user.
*
* Parameters:
- * * `InputUser` **user_id** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats
- * * `bytes` **g_a** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats
+ * * `InputUser` **user_id** - User ID
+ * * `bytes` **g_a** - `A = g ^ a mod p`, see [Wikipedia](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange)
*
* @param array $params Parameters
*
@@ -1643,12 +1658,12 @@ interface messages
public function requestEncryption($params);
/**
- * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats.
+ * Confirms creation of a secret chat.
*
* Parameters:
- * * `InputEncryptedChat` **peer** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats
- * * `bytes` **g_b** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats
- * * `long` **key_fingerprint** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats
+ * * `InputEncryptedChat` **peer** - Secret chat ID
+ * * `bytes` **g_b** - `B = g ^ b mod p`, see [Wikipedia](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange)
+ * * `long` **key_fingerprint** - 64-bit fingerprint of the received key
*
* @param array $params Parameters
*
@@ -1657,10 +1672,10 @@ interface messages
public function acceptEncryption($params);
/**
- * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats.
+ * Cancels a request for creation and/or delete info on secret chat.
*
* Parameters:
- * * `int` **chat_id** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats
+ * * `int` **chat_id** - Secret chat ID
*
* @param array $params Parameters
*
@@ -1699,7 +1714,7 @@ interface messages
*
* Parameters:
* * `InputEncryptedChat` **peer** - Secret chat ID
- * * `DecryptedMessage` **message** - The message to send
+ * * `DecryptedMessage` **message** -
*
* @param array $params Parameters
*
@@ -1712,7 +1727,7 @@ interface messages
*
* Parameters:
* * `InputEncryptedChat` **peer** - Secret chat ID
- * * `DecryptedMessage` **message** - The message with the file
+ * * `DecryptedMessage` **message** -
* * `InputEncryptedFile` **file** - File attachment for the secret chat
*
* @param array $params Parameters
@@ -1726,7 +1741,7 @@ interface messages
*
* Parameters:
* * `InputEncryptedChat` **peer** - Secret chat ID
- * * `DecryptedMessage` **message** - The service message
+ * * `DecryptedMessage` **message** -
*
* @param array $params Parameters
*
@@ -1735,10 +1750,10 @@ interface messages
public function sendEncryptedService($params);
/**
- * You cannot use this method directly.
+ * Confirms receipt of messages in a secret chat by client, cancels push notifications.
*
* Parameters:
- * * `int` **max_qts** - You cannot use this method directly
+ * * `int` **max_qts** - Maximum qts value available at the client
*
* @param array $params Parameters
*
@@ -1762,7 +1777,7 @@ interface messages
* Notifies the sender about the recipient having listened a voice message or watched a video.
*
* Parameters:
- * * `[int]` **id** - The messages to mark as read (only users and normal chats, not supergroups)
+ * * `[int]` **id** - Message ID list
*
* @param array $params Parameters
*
@@ -1775,7 +1790,7 @@ interface messages
*
* Parameters:
* * `string` **emoticon** - The emoji
- * * `[int]` **hash** - Optional: the hash parameter of the previous result of this method
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -1787,7 +1802,7 @@ interface messages
* Get all installed stickers.
*
* Parameters:
- * * `[int]` **hash** - Optional: The hash parameter of the previous result of this method
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -1800,7 +1815,7 @@ interface messages
*
* Parameters:
* * `string` **message** - Message from which to extract the preview
- * * `[MessageEntity]` **entities** - Optional: Entities for styled text
+ * * `[MessageEntity]` **entities** - Optional: [Message entities for styled text](https://core.telegram.org/api/entities)
*
* @param array $params Parameters
*
@@ -1900,7 +1915,7 @@ interface messages
*
* Parameters:
* * `InputPeer` **peer** - Peer where the message was found
- * * `[int]` **id** - The IDs messages to get
+ * * `[int]` **id** - ID of message
* * `Bool` **increment** - Whether to mark the message as viewed and increment the view counter
*
* @param array $params Parameters
@@ -1913,7 +1928,7 @@ interface messages
* Make a user admin in a [legacy group](https://core.telegram.org/api/channel).
*
* Parameters:
- * * `InputPeer` **chat_id** - The chat ID (no supergroups)
+ * * `InputPeer` **chat_id** -
* * `InputUser` **user_id** - The user to make admin
* * `Bool` **is_admin** - Whether to make him admin
*
@@ -1927,7 +1942,7 @@ interface messages
* Turn a [legacy group into a supergroup](https://core.telegram.org/api/channel).
*
* Parameters:
- * * `InputPeer` **chat_id** - The chat to convert
+ * * `InputPeer` **chat_id** -
*
* @param array $params Parameters
*
@@ -1939,7 +1954,7 @@ interface messages
* Search for messages and peers globally.
*
* Parameters:
- * * `int` **folder_id** - Optional: Folder where to search
+ * * `int` **folder_id** - Optional: [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders)
* * `string` **q** - Query
* * `int` **offset_rate** - Initially 0, then set to the [`next_rate` parameter of messages.messagesSlice](https://docs.madelineproto.xyz/API_docs/constructors/messages.messagesSlice.html)
* * `InputPeer` **offset_peer** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets)
@@ -1957,7 +1972,7 @@ interface messages
*
* Parameters:
* * `boolean` **masks** - Optional: Reorder mask stickersets
- * * `[long]` **order** - The order
+ * * `[long]` **order** - New stickerset order by stickerset IDs
*
* @param array $params Parameters
*
@@ -1996,7 +2011,7 @@ interface messages
* Get saved GIFs.
*
* Parameters:
- * * `[int]` **hash** - Optional: the hash parameter of the previous result of this method
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -2040,7 +2055,7 @@ interface messages
* * `boolean` **gallery** - Optional: Set this flag if the results are composed of media files
* * `boolean` **private** - Optional: Set this flag if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
* * `long` **query_id** - Unique identifier for the answered query
- * * `[InputBotInlineResult]` **results** - Results
+ * * `[InputBotInlineResult]` **results** - Vector of results for the inline query
* * `int` **cache_time** - The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
* * `string` **next_offset** - Optional: Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes.
* * `InlineBotSwitchPM` **switch_pm** - Optional: If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter.
@@ -2094,7 +2109,7 @@ interface messages
* * `string` **message** - Optional: New message
* * `InputMedia` **media** - Optional: New attached media
* * `ReplyMarkup` **reply_markup** - Optional: Reply markup for inline keyboards
- * * `[MessageEntity]` **entities** - Optional: The new entities (for styled text)
+ * * `[MessageEntity]` **entities** - Optional: [Message entities for styled text](https://core.telegram.org/api/entities)
* * `int` **schedule_date** - Optional: Scheduled message date for scheduled messages
*
* @param array $params Parameters
@@ -2112,7 +2127,7 @@ interface messages
* * `string` **message** - Optional: Message
* * `InputMedia` **media** - Optional: Media
* * `ReplyMarkup` **reply_markup** - Optional: Reply markup for inline keyboards
- * * `[MessageEntity]` **entities** - Optional: The new entities (for styled text)
+ * * `[MessageEntity]` **entities** - Optional: [Message entities for styled text](https://core.telegram.org/api/entities)
*
* @param array $params Parameters
*
@@ -2155,7 +2170,7 @@ interface messages
* Get dialog info of specified peers.
*
* Parameters:
- * * `[InputDialogPeer]` **peers** - The peers
+ * * `[InputDialogPeer]` **peers** - Peers
*
* @param array $params Parameters
*
@@ -2171,7 +2186,7 @@ interface messages
* * `int` **reply_to_msg_id** - Optional: Message ID the message should reply to
* * `InputPeer` **peer** - Destination of the message that should be sent
* * `string` **message** - The draft
- * * `[MessageEntity]` **entities** - Optional: The entities (for styled text)
+ * * `[MessageEntity]` **entities** - Optional: Message [entities](https://core.telegram.org/api/entities) for styled text
*
* @param array $params Parameters
*
@@ -2190,7 +2205,7 @@ interface messages
* Get featured stickers.
*
* Parameters:
- * * `[int]` **hash** - Optional: the hash parameter of the previous result of this method
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -2202,7 +2217,7 @@ interface messages
* Mark new featured stickers as read.
*
* Parameters:
- * * `[long]` **id** - The stickers to mark as read
+ * * `[long]` **id** - IDs of stickersets to mark as read
*
* @param array $params Parameters
*
@@ -2215,7 +2230,7 @@ interface messages
*
* Parameters:
* * `boolean` **attached** - Optional: Get stickers recently attached to photo or video files
- * * `[int]` **hash** - Optional: IDs the hash parameter of the previous result of this method
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -2267,7 +2282,7 @@ interface messages
* Get installed mask stickers.
*
* Parameters:
- * * `[int]` **hash** - Optional: the hash parameter of the previous result of this method
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -2365,7 +2380,7 @@ interface messages
* Get all chats, channels and supergroups.
*
* Parameters:
- * * `[int]` **except_ids** - Do not fetch these chats (MTProto id)
+ * * `[int]` **except_ids** - Except these chats/channels/supergroups
*
* @param array $params Parameters
*
@@ -2378,7 +2393,7 @@ interface messages
*
* Parameters:
* * `string` **url** - URL of IV page to fetch
- * * `[int]` **hash** - Optional: the hash parameter of the previous result of this method
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -2404,8 +2419,8 @@ interface messages
*
* Parameters:
* * `boolean` **force** - Optional: If set, dialogs pinned server-side but not present in the `order` field will be unpinned.
- * * `int` **folder_id** - Folder ID
- * * `[InputDialogPeer]` **order** - New order
+ * * `int` **folder_id** - [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders)
+ * * `[InputDialogPeer]` **order** - New dialog order
*
* @param array $params Parameters
*
@@ -2417,7 +2432,7 @@ interface messages
* Get pinned dialogs.
*
* Parameters:
- * * `int` **folder_id** - Folder ID
+ * * `int` **folder_id** - [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders)
*
* @param array $params Parameters
*
@@ -2431,7 +2446,7 @@ interface messages
* Parameters:
* * `long` **query_id** - Unique identifier for the query to be answered
* * `string` **error** - Optional: Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
- * * `[ShippingOption]` **shipping_options** - Optional: Shipping options
+ * * `[ShippingOption]` **shipping_options** - Optional: A vector of available shipping options.
*
* @param array $params Parameters
*
@@ -2485,7 +2500,7 @@ interface messages
* Get faved stickers.
*
* Parameters:
- * * `[int]` **hash** - Optional: the hash parameter of the previous result of this method
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -2541,7 +2556,7 @@ interface messages
* Parameters:
* * `InputPeer` **peer** - User
* * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets)
- * * `[int]` **hash** - Optional: IDs of locations you already fetched
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -2558,7 +2573,7 @@ interface messages
* * `boolean` **clear_draft** - Optional: Whether to clear [drafts](https://core.telegram.org/api/drafts)
* * `InputPeer` **peer** - The destination chat
* * `int` **reply_to_msg_id** - Optional: The message to reply to
- * * `[InputSingleMedia]` **multi_media** - The album
+ * * `[InputSingleMedia]` **multi_media** - The medias to send
* * `int` **schedule_date** - Optional: Scheduled message date for scheduled messages
*
* @param array $params Parameters
@@ -2586,7 +2601,7 @@ interface messages
* Parameters:
* * `boolean` **exclude_featured** - Optional: Exclude featured stickersets from results
* * `string` **q** - Query string
- * * `[int]` **hash** - Optional: The IDs of stickersets you already fetched
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -2648,7 +2663,7 @@ interface messages
* Parameters:
* * `InputPeer` **peer** - The chat where the poll was sent
* * `int` **msg_id** - The message ID of the poll
- * * `[bytes]` **options** - Options
+ * * `[bytes]` **options** - The options that were chosen
*
* @param array $params Parameters
*
@@ -2775,7 +2790,7 @@ interface messages
*
* Parameters:
* * `InputPeer` **peer** - Peer where to search
- * * `[MessagesFilter]` **filters** - Filters
+ * * `[MessagesFilter]` **filters** - Search filters
*
* @param array $params Parameters
*
@@ -2829,7 +2844,7 @@ interface messages
*
* Parameters:
* * `InputPeer` **peer** - Peer
- * * `[int]` **hash** - Optional: Hash
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -2842,7 +2857,7 @@ interface messages
*
* Parameters:
* * `InputPeer` **peer** - Peer
- * * `[int]` **id** - ID
+ * * `[int]` **id** - IDs of scheduled messages
*
* @param array $params Parameters
*
@@ -2855,7 +2870,7 @@ interface messages
*
* Parameters:
* * `InputPeer` **peer** - Peer
- * * `[int]` **id** - ID
+ * * `[int]` **id** - Scheduled message IDs
*
* @param array $params Parameters
*
@@ -2868,7 +2883,7 @@ interface messages
*
* Parameters:
* * `InputPeer` **peer** - Peer
- * * `[int]` **id** - ID
+ * * `[int]` **id** - Scheduled message IDs
*
* @param array $params Parameters
*
@@ -2877,14 +2892,14 @@ interface messages
public function deleteScheduledMessages($params);
/**
- *
+ * Get poll results for non-anonymous polls.
*
* Parameters:
- * * `InputPeer` **peer** -
- * * `int` **id** -
- * * `bytes` **option** - Optional:
- * * `string` **offset** - Optional:
- * * `int` **limit** -.
+ * * `InputPeer` **peer** - Chat where the poll was sent
+ * * `int` **id** - Message ID
+ * * `bytes` **option** - Optional: Get only results for the specified poll `option`
+ * * `string` **offset** - Optional: Offset for results, taken from the `next_offset` field of [messages.votesList](https://docs.madelineproto.xyz/API_docs/constructors/messages.votesList.html), initially an empty string.
Note: if no more results are available, the method call will return an empty `next_offset`; thus, avoid providing the `next_offset` returned in [messages.votesList](https://docs.madelineproto.xyz/API_docs/constructors/messages.votesList.html) if it is empty, to avoid an infinite loop.
+ * * `int` **limit** - Number of results to return
*
* @param array $params Parameters
*
@@ -2893,13 +2908,13 @@ interface messages
public function getPollVotes($params);
/**
- *
+ * Apply changes to multiple stickersets.
*
* Parameters:
- * * `boolean` **uninstall** - Optional:
- * * `boolean` **archive** - Optional:
- * * `boolean` **unarchive** - Optional:
- * * `[InputStickerSet]` **stickersets** -.
+ * * `boolean` **uninstall** - Optional: Uninstall the specified stickersets
+ * * `boolean` **archive** - Optional: Archive the specified stickersets
+ * * `boolean` **unarchive** - Optional: Unarchive the specified stickersets
+ * * `[InputStickerSet]` **stickersets** - Stickersets to act upon
*
* @param array $params Parameters
*
@@ -2908,25 +2923,25 @@ interface messages
public function toggleStickerSets($params);
/**
- *
+ * Get [folders](https://core.telegram.org/api/folders).
*
* @return of DialogFilter[]
*/
public function getDialogFilters();
/**
- *
+ * Get [suggested folders](https://core.telegram.org/api/folders).
*
* @return of DialogFilterSuggested[]
*/
public function getSuggestedDialogFilters();
/**
- *
+ * Update [folder](https://core.telegram.org/api/folders).
*
* Parameters:
- * * `int` **id** -
- * * `DialogFilter` **filter** - Optional:.
+ * * `int` **id** - [Folder](https://core.telegram.org/api/folders) ID
+ * * `DialogFilter` **filter** - Optional: [Folder](https://core.telegram.org/api/folders) info
*
* @param array $params Parameters
*
@@ -2935,35 +2950,49 @@ interface messages
public function updateDialogFilter($params);
/**
- *
+ * Reorder [folders](https://core.telegram.org/api/folders).
*
* Parameters:
- * * `[int]` **order** -.
+ * * `[int]` **order** - New [folder](https://core.telegram.org/api/folders) order
*
* @param array $params Parameters
*
* @return bool
*/
public function updateDialogFiltersOrder($params);
+
+ /**
+ * Method for fetching previously featured stickers.
+ *
+ * Parameters:
+ * * `int` **offset** - Offset
+ * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets)
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
+ *
+ * @param array $params Parameters
+ *
+ * @return messages.FeaturedStickers
+ */
+ public function getOldFeaturedStickers($params);
}
interface updates
{
/**
- * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates.
+ * Returns a current state of updates.
*
* @return updates.State
*/
public function getState();
/**
- * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates.
+ * Get new [updates](https://core.telegram.org/api/updates).
*
* Parameters:
- * * `int` **pts** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates
- * * `int` **pts_total_limit** - Optional: You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates
- * * `int` **date** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates
- * * `int` **qts** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates
+ * * `int` **pts** - PTS, see [updates](https://core.telegram.org/api/updates).
+ * * `int` **pts_total_limit** - Optional: For fast updating: if provided and `pts + pts_total_limit < remote pts`, [updates.differenceTooLong](https://docs.madelineproto.xyz/API_docs/constructors/updates.differenceTooLong.html) will be returned.
Simply tells the server to not return the difference if it is bigger than `pts_total_limit`
If the remote pts is too big (> ~4000000), this field will default to 1000000
+ * * `int` **date** - date, see [updates](https://core.telegram.org/api/updates).
+ * * `int` **qts** - QTS, see [updates](https://core.telegram.org/api/updates).
*
* @param array $params Parameters
*
@@ -2972,14 +3001,14 @@ interface updates
public function getDifference($params);
/**
- * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates.
+ * Returns the difference between the current state of updates of a certain channel and transmitted.
*
* Parameters:
- * * `boolean` **force** - Optional: You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates
- * * `InputChannel` **channel** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates
- * * `ChannelMessagesFilter` **filter** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates
- * * `int` **pts** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates
- * * `int` **limit** - You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates
+ * * `boolean` **force** - Optional: Set to true to skip some possibly unneeded updates and reduce server-side load
+ * * `InputChannel` **channel** - The channel
+ * * `ChannelMessagesFilter` **filter** - Messsage filter
+ * * `int` **pts** - Persistent timestamp (see [updates](https://core.telegram.org/api/updates))
+ * * `int` **limit** - How many updates to fetch, max `100000`
Ordinary (non-bot) users are supposed to pass `10-100`
*
* @param array $params Parameters
*
@@ -3018,7 +3047,7 @@ interface photos
* Deletes profile photos.
*
* Parameters:
- * * `[InputPhoto]` **id** - The profile photos to delete
+ * * `[InputPhoto]` **id** - Input photos to delete
*
* @param array $params Parameters
*
@@ -3045,12 +3074,12 @@ interface photos
interface upload
{
/**
- * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info.
+ * Saves a part of file for futher sending to one of the methods.
*
* Parameters:
- * * `long` **file_id** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `int` **file_part** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `bytes` **bytes** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
+ * * `long` **file_id** - Random file identifier created by the client
+ * * `int` **file_part** - Numerical order of a part
+ * * `bytes` **bytes** - Binary data, contend of a part
*
* @param array $params Parameters
*
@@ -3059,14 +3088,14 @@ interface upload
public function saveFilePart($params);
/**
- * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info.
+ * Returns content of a whole file or its part.
*
* Parameters:
- * * `boolean` **precise** - Optional: You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `boolean` **cdn_supported** - Optional:
- * * `InputFileLocation` **location** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `int` **offset** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `int` **limit** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
+ * * `boolean` **precise** - Optional: Disable some checks on limit and offset values, useful for example to stream videos by keyframes
+ * * `boolean` **cdn_supported** - Optional: Whether the current client supports [CDN downloads](https://core.telegram.org/cdn)
+ * * `InputFileLocation` **location** - File location
+ * * `int` **offset** - Number of bytes to be skipped
+ * * `int` **limit** - Number of bytes to be returned
*
* @param array $params Parameters
*
@@ -3075,13 +3104,13 @@ interface upload
public function getFile($params);
/**
- * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info.
+ * Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods.
*
* Parameters:
- * * `long` **file_id** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `int` **file_part** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `int` **file_total_parts** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `bytes` **bytes** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
+ * * `long` **file_id** - Random file id, created by the client
+ * * `int` **file_part** - Part sequence number
+ * * `int` **file_total_parts** - Total number of parts
+ * * `bytes` **bytes** - Binary data, part contents
*
* @param array $params Parameters
*
@@ -3104,12 +3133,12 @@ interface upload
public function getWebFile($params);
/**
- * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info.
+ * Download a [CDN](https://core.telegram.org/cdn) file.
*
* Parameters:
- * * `bytes` **file_token** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `int` **offset** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `int` **limit** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
+ * * `bytes` **file_token** - File token
+ * * `int` **offset** - Offset of chunk to download
+ * * `int` **limit** - Length of chunk to download
*
* @param array $params Parameters
*
@@ -3118,11 +3147,11 @@ interface upload
public function getCdnFile($params);
/**
- * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info.
+ * Request a reupload of a certain file to a [CDN DC](https://core.telegram.org/cdn).
*
* Parameters:
- * * `bytes` **file_token** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `bytes` **request_token** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
+ * * `bytes` **file_token** - File token
+ * * `bytes` **request_token** - Request token
*
* @param array $params Parameters
*
@@ -3131,11 +3160,11 @@ interface upload
public function reuploadCdnFile($params);
/**
- * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info.
+ * Get SHA256 hashes for verifying downloaded [CDN](https://core.telegram.org/cdn) files.
*
* Parameters:
- * * `bytes` **file_token** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `int` **offset** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
+ * * `bytes` **file_token** - File
+ * * `int` **offset** - Offset from which to start getting hashes
*
* @param array $params Parameters
*
@@ -3144,11 +3173,11 @@ interface upload
public function getCdnFileHashes($params);
/**
- * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info.
+ * Get SHA256 hashes for verifying downloaded files.
*
* Parameters:
- * * `InputFileLocation` **location** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
- * * `int` **offset** - You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info
+ * * `InputFileLocation` **location** - File
+ * * `int` **offset** - Offset from which to get file hashes
*
* @param array $params Parameters
*
@@ -3160,7 +3189,7 @@ interface upload
interface help
{
/**
- * Returns current configuration, icluding data center configuration.
+ * Returns current configuration, including data center configuration.
*
* @return Config
*/
@@ -3186,7 +3215,7 @@ interface help
public function getAppUpdate($params);
/**
- * Returns text of a text message with an invitation.
+ * Returns localized text of a text message with an invitation.
*
* @return help.InviteText
*/
@@ -3201,6 +3230,7 @@ interface help
/**
* Get changelog of current app.
+ * Typically, an [updates](https://docs.madelineproto.xyz/API_docs/constructors/updates.html) constructor will be returned, containing one or more [updateServiceNotification](https://docs.madelineproto.xyz/API_docs/constructors/updateServiceNotification.html) updates with app-specific changelogs.
*
* Parameters:
* * `string` **prev_app_version** - Previous app version
@@ -3243,13 +3273,6 @@ interface help
*/
public function getRecentMeUrls($params);
- /**
- * Get promotion info of the currently-used MTProxy.
- *
- * @return help.ProxyData
- */
- public function getProxyData();
-
/**
* Look for updates of telegram's terms of service.
*
@@ -3282,7 +3305,7 @@ interface help
public function getDeepLinkInfo($params);
/**
- * Get app-specific configuration.
+ * Get app-specific configuration, see [client configuration](https://core.telegram.org/api/config#client-configuration) for more info on the result.
*
* @return JSONValue
*/
@@ -3292,7 +3315,7 @@ interface help
* Saves logs of application on the server.
*
* Parameters:
- * * `[InputAppEvent]` **events** - Event list
+ * * `[InputAppEvent]` **events** - List of input events
*
* @param array $params Parameters
*
@@ -3304,7 +3327,7 @@ interface help
* Get [passport](https://core.telegram.org/passport) configuration.
*
* Parameters:
- * * `[int]` **hash** - Optional: Hash
+ * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation)
*
* @param array $params Parameters
*
@@ -3337,13 +3360,32 @@ interface help
* Parameters:
* * `InputUser` **user_id** - User
* * `string` **message** - Message
- * * `[MessageEntity]` **entities** - Entities
+ * * `[MessageEntity]` **entities** - [Message entities for styled text](https://core.telegram.org/api/entities)
*
* @param array $params Parameters
*
* @return help.UserInfo
*/
public function editUserInfo($params);
+
+ /**
+ * Get MTProxy/Public Service Announcement information.
+ *
+ * @return help.PromoData
+ */
+ public function getPromoData();
+
+ /**
+ * Hide MTProxy/Public Service Announcement information.
+ *
+ * Parameters:
+ * * `InputPeer` **peer** - Peer to hide
+ *
+ * @param array $params Parameters
+ *
+ * @return bool
+ */
+ public function hidePromoData($params);
}
interface channels
@@ -3366,7 +3408,7 @@ interface channels
*
* Parameters:
* * `InputChannel` **channel** - [Channel/supergroup](https://core.telegram.org/api/channel)
- * * `[int]` **id** - The IDs of messages to delete
+ * * `[int]` **id** - IDs of messages to delete
*
* @param array $params Parameters
*
@@ -3393,7 +3435,7 @@ interface channels
* Parameters:
* * `InputChannel` **channel** - Supergroup
* * `InputUser` **user_id** - ID of the user that sent the spam messages
- * * `[int]` **id** - The IDs of messages to report
+ * * `[int]` **id** - IDs of spam messages
*
* @param array $params Parameters
*
@@ -3406,7 +3448,7 @@ interface channels
*
* Parameters:
* * `InputChannel` **channel** - Channel/supergroup
- * * `[InputMessage]` **id** - The message IDs
+ * * `[InputMessage]` **id** - IDs of messages to get
*
* @param array $params Parameters
*
@@ -3422,7 +3464,7 @@ interface channels
* * `ChannelParticipantsFilter` **filter** - Which participant types to fetch
* * `int` **offset** - [Offset](https://core.telegram.org/api/offsets)
* * `int` **limit** - [Limit](https://core.telegram.org/api/offsets)
- * * `[int]` **hash** - Optional: IDs of previously fetched participants
+ * * `[int]` **hash** - Optional: [Hash](https://core.telegram.org/api/offsets)
*
* @param array $params Parameters
*
@@ -3447,7 +3489,7 @@ interface channels
* Get info about [channels/supergroups](https://core.telegram.org/api/channel).
*
* Parameters:
- * * `[InputChannel]` **id** - The channel/supergroup MTProto IDs
+ * * `[InputChannel]` **id** - IDs of channels/supergroups to get info about
*
* @param array $params Parameters
*
@@ -3456,10 +3498,10 @@ interface channels
public function getChannels($params);
/**
- * You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info).
+ * Get full info about a channel.
*
* Parameters:
- * * `InputChannel` **channel** - You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info)
+ * * `InputChannel` **channel** - The channel to get info about
*
* @param array $params Parameters
*
@@ -3580,7 +3622,7 @@ interface channels
*
* Parameters:
* * `InputChannel` **channel** - Channel/supergroup
- * * `[InputUser]` **users** - The users to add
+ * * `[InputUser]` **users** - Users to invite
*
* @param array $params Parameters
*
@@ -3661,7 +3703,7 @@ interface channels
* * `InputChannel` **channel** - Channel
* * `string` **q** - Search query, can be empty
* * `ChannelAdminLogEventsFilter` **events_filter** - Optional: Event filter
- * * `[InputUser]` **admins** - Optional: Fetch only actions from these admins
+ * * `[InputUser]` **admins** - Optional: Only show events from these admins
* * `long` **max_id** - Maximum ID of message to return (see [pagination](https://core.telegram.org/api/offsets))
* * `long` **min_id** - Minimum ID of message to return (see [pagination](https://core.telegram.org/api/offsets))
* * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets)
@@ -3690,7 +3732,7 @@ interface channels
*
* Parameters:
* * `InputChannel` **channel** - [Channel/supergroup](https://core.telegram.org/api/channel)
- * * `[int]` **id** - List of message IDs
+ * * `[int]` **id** - IDs of messages whose contents should be marked as read
*
* @param array $params Parameters
*
@@ -3798,7 +3840,7 @@ interface channels
public function toggleSlowMode($params);
/**
- *
+ * Get inactive channels and supergroups.
*
* @return messages.InactiveChats
*/
@@ -3832,6 +3874,18 @@ interface bots
* @return bool
*/
public function answerWebhookJSONQuery($params);
+
+ /**
+ * Set bot command list.
+ *
+ * Parameters:
+ * * `[BotCommand]` **commands** - Bot commands
+ *
+ * @param array $params Parameters
+ *
+ * @return bool
+ */
+ public function setBotCommands($params);
}
interface payments
@@ -3910,10 +3964,10 @@ interface payments
public function clearSavedInfo($params);
/**
- *
+ * Get info about a credit card.
*
* Parameters:
- * * `string` **number** -.
+ * * `string` **number** - Credit card number
*
* @param array $params Parameters
*
@@ -3929,10 +3983,12 @@ interface stickers
*
* Parameters:
* * `boolean` **masks** - Optional: Whether this is a mask stickerset
+ * * `boolean` **animated** - Optional: Whether this is an animated stickerset
* * `InputUser` **user_id** - Stickerset owner
* * `string` **title** - Stickerset name, `1-64` chars
* * `string` **short_name** - Sticker set name. Can contain only English letters, digits and underscores. Must end with *"*by*"* (** is case insensitive); 1-64 characters
- * * `[InputStickerSetItem]` **stickers** - The stickers to add
+ * * `InputDocument` **thumb** - Optional: Thumbnail
+ * * `[InputStickerSetItem]` **stickers** - Stickers
*
* @param array $params Parameters
*
@@ -3977,6 +4033,19 @@ interface stickers
* @return messages.StickerSet
*/
public function addStickerToSet($params);
+
+ /**
+ * Set stickerset thumbnail.
+ *
+ * Parameters:
+ * * `InputStickerSet` **stickerset** - Stickerset
+ * * `InputDocument` **thumb** - Thumbnail
+ *
+ * @param array $params Parameters
+ *
+ * @return messages.StickerSet
+ */
+ public function setStickerSetThumb($params);
}
interface phone
@@ -3989,13 +4058,13 @@ interface phone
public function getCallConfig();
/**
- * You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls.
+ * Start a telegram phone call.
*
* Parameters:
- * * `boolean` **video** - Optional: You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `InputUser` **user_id** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `bytes` **g_a_hash** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `PhoneCallProtocol` **protocol** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
+ * * `boolean` **video** - Optional: Whether to start a video call
+ * * `InputUser` **user_id** - Destination of the phone call
+ * * `bytes` **g_a_hash** - [Parameter for E2E encryption key exchange »](https://core.telegram.org/api/end-to-end/voice-calls)
+ * * `PhoneCallProtocol` **protocol** - Phone call settings
*
* @param array $params Parameters
*
@@ -4004,12 +4073,12 @@ interface phone
public function requestCall($params);
/**
- * You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls.
+ * Accept incoming call.
*
* Parameters:
- * * `InputPhoneCall` **peer** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `bytes` **g_b** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `PhoneCallProtocol` **protocol** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
+ * * `InputPhoneCall` **peer** - The call to accept
+ * * `bytes` **g_b** - [Parameter for E2E encryption key exchange »](https://core.telegram.org/api/end-to-end/voice-calls)
+ * * `PhoneCallProtocol` **protocol** - Phone call settings
*
* @param array $params Parameters
*
@@ -4018,13 +4087,13 @@ interface phone
public function acceptCall($params);
/**
- * You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls.
+ * [Complete phone call E2E encryption key exchange »](https://core.telegram.org/api/end-to-end/voice-calls).
*
* Parameters:
- * * `InputPhoneCall` **peer** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `bytes` **g_a** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `long` **key_fingerprint** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `PhoneCallProtocol` **protocol** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
+ * * `InputPhoneCall` **peer** - The phone call
+ * * `bytes` **g_a** - [Parameter for E2E encryption key exchange »](https://core.telegram.org/api/end-to-end/voice-calls)
+ * * `long` **key_fingerprint** - Key fingerprint
+ * * `PhoneCallProtocol` **protocol** - Phone call settings
*
* @param array $params Parameters
*
@@ -4045,14 +4114,14 @@ interface phone
public function receivedCall($params);
/**
- * You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls.
+ * Refuse or end running call.
*
* Parameters:
- * * `boolean` **video** - Optional: You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `InputPhoneCall` **peer** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `int` **duration** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `PhoneCallDiscardReason` **reason** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
- * * `long` **connection_id** - You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls
+ * * `boolean` **video** - Optional: Whether this is a video call
+ * * `InputPhoneCall` **peer** - The phone call
+ * * `int` **duration** - Call duration
+ * * `PhoneCallDiscardReason` **reason** - Why was the call discarded
+ * * `long` **connection_id** - Preferred libtgvoip relay ID
*
* @param array $params Parameters
*
@@ -4110,7 +4179,7 @@ interface langpack
* Parameters:
* * `string` **lang_pack** - Language pack name
* * `string` **lang_code** - Language code
- * * `[string]` **keys** - Keys
+ * * `[string]` **keys** - Strings to get
*
* @param array $params Parameters
*
@@ -4161,10 +4230,10 @@ interface langpack
interface folders
{
/**
- * Edit peers in folder.
+ * Edit peers in [peer folder](https://core.telegram.org/api/folders#peer-folders).
*
* Parameters:
- * * `[InputFolderPeer]` **folder_peers** - New folder peers
+ * * `[InputFolderPeer]` **folder_peers** - New peer list
*
* @param array $params Parameters
*
@@ -4173,10 +4242,10 @@ interface folders
public function editPeerFolders($params);
/**
- * Delete a folder.
+ * Delete a [peer folder](https://core.telegram.org/api/folders#peer-folders).
*
* Parameters:
- * * `int` **folder_id** - Folder to delete
+ * * `int` **folder_id** - [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders)
*
* @param array $params Parameters
*
@@ -4188,11 +4257,11 @@ interface folders
interface stats
{
/**
- *
+ * Get [channel statistics](https://core.telegram.org/api/stats).
*
* Parameters:
- * * `boolean` **dark** - Optional:
- * * `InputChannel` **channel** -.
+ * * `boolean` **dark** - Optional: Whether to enable dark theme for graph colors
+ * * `InputChannel` **channel** - The channel
*
* @param array $params Parameters
*
@@ -4201,11 +4270,11 @@ interface stats
public function getBroadcastStats($params);
/**
- *
+ * Load [channel statistics graph](https://core.telegram.org/api/stats) asynchronously.
*
* Parameters:
- * * `string` **token** -
- * * `long` **x** - Optional:.
+ * * `string` **token** - Graph token from [statsGraphAsync](https://docs.madelineproto.xyz/API_docs/constructors/statsGraphAsync.html) constructor
+ * * `long` **x** - Optional: Zoom value, if required
*
* @param array $params Parameters
*
@@ -4285,12 +4354,12 @@ class InternalDoc extends APIFactory
*
* @param array $user User info
*
- * @return \Generator
- * @throws Exception
+ * @return \Generator
+ * @throws \danog\MadelineProto\Exception
*/
- public function addUser(array $user): \Generator
+ public function addUser(array $user, array $extra = [])
{
- yield from $this->API->addUser($user);
+ return $this->__call(__FUNCTION__, [$user, $extra]);
}
/**
* Call promise $b after promise $a.
@@ -4298,6 +4367,8 @@ class InternalDoc extends APIFactory
* @param \Generator|Promise $a Promise A
* @param \Generator|Promise $b Promise B
*
+ * @psalm-suppress InvalidScope
+ *
* @return Promise
*/
public function after($a, $b)
@@ -4400,6 +4471,8 @@ class InternalDoc extends APIFactory
* @param ?\Generator|Promise $actual Promise to resolve instead of $promise
* @param string $file File
*
+ * @psalm-suppress InvalidScope
+ *
* @return Promise|mixed
*/
public function callFork($promise, $actual = null, $file = '')
@@ -4733,7 +4806,7 @@ class InternalDoc extends APIFactory
* @param integer $operation Locking mode
* @param float $polling Polling interval
*
- * @return Promise
+ * @return Promise
*/
public function flock(string $file, int $operation, float $polling = 0.1)
{
@@ -4757,9 +4830,9 @@ class InternalDoc extends APIFactory
*
* @return \Generator
*/
- public function fullChatLastUpdated($id): \Generator
+ public function fullChatLastUpdated($id, array $extra = [])
{
- return yield from $this->API->fullChatLastUpdated($id);
+ return $this->__call(__FUNCTION__, [$id, $extra]);
}
/**
* Get info about the logged-in user, not cached.
@@ -5115,6 +5188,11 @@ class InternalDoc extends APIFactory
{
return $this->__call(__FUNCTION__, [$extra]);
}
+
+ public function getSessionId(\danog\MadelineProto\MTProto $madelineProto): string
+ {
+ return \danog\MadelineProto\MTProto::getSessionId($madelineProto);
+ }
/**
* Return current settings array.
*
@@ -5139,6 +5217,8 @@ class InternalDoc extends APIFactory
* @param object $obj Object
* @param string $var Attribute name
*
+ * @psalm-suppress InvalidScope
+ *
* @return mixed
* @access public
*/
@@ -5215,6 +5295,11 @@ class InternalDoc extends APIFactory
{
return \danog\MadelineProto\Tools::inflateStripped($stripped);
}
+
+ public function initDb(\danog\MadelineProto\MTProto $MadelineProto, bool $reset = false, array $extra = [])
+ {
+ return $this->__call(__FUNCTION__, [$MadelineProto, $reset, $extra]);
+ }
/**
* Whether this is altervista.
*
@@ -5293,11 +5378,11 @@ class InternalDoc extends APIFactory
*
* @param string $hwat String to escape
*
- * @return void
+ * @return string
*/
public function markdownEscape(string $hwat): string
{
- return \danog\MadelineProto\Tools::markdownEscape($hwat);
+ return \danog\MadelineProto\StrTools::markdownEscape($hwat);
}
/**
* Telegram UTF-8 multibyte split.
@@ -5369,6 +5454,17 @@ class InternalDoc extends APIFactory
{
return $this->__call(__FUNCTION__, [$method, $args, $aargs, $extra]);
}
+ /**
+ * Escape method name.
+ *
+ * @param string $method Method name
+ *
+ * @return string
+ */
+ public function methodEscape(string $method): string
+ {
+ return \danog\MadelineProto\StrTools::methodEscape($method);
+ }
/**
* Convert double to binary version.
*
@@ -5476,7 +5572,7 @@ class InternalDoc extends APIFactory
*
* @param string $prompt Prompt
*
- * @return Promise
+ * @return Promise
*/
public function readLine(string $prompt = '')
{
@@ -5561,6 +5657,8 @@ class InternalDoc extends APIFactory
* @param \Throwable $e Exception
* @param string $file File where the strand started
*
+ * @psalm-suppress InvalidScope
+ *
* @return void
*/
public function rethrow(\Throwable $e, $file = ''): void
@@ -5649,6 +5747,8 @@ class InternalDoc extends APIFactory
* @param string $var Attribute name
* @param mixed $val Attribute value
*
+ * @psalm-suppress InvalidScope
+ *
* @return mixed
* @access public
*/
@@ -5784,7 +5884,7 @@ class InternalDoc extends APIFactory
*/
public function toCamelCase(string $input): string
{
- return \danog\MadelineProto\Tools::toCamelCase($input);
+ return \danog\MadelineProto\StrTools::toCamelCase($input);
}
/**
* Convert to snake_case.
@@ -5795,7 +5895,7 @@ class InternalDoc extends APIFactory
*/
public function toSnakeCase(string $input): string
{
- return \danog\MadelineProto\Tools::toSnakeCase($input);
+ return \danog\MadelineProto\StrTools::toSnakeCase($input);
}
/**
* Convert MTProto channel ID to bot API channel ID.
@@ -5808,6 +5908,17 @@ class InternalDoc extends APIFactory
{
return $this->__call(__FUNCTION__, [$id]);
}
+ /**
+ * Escape type name.
+ *
+ * @param string $type String to escape
+ *
+ * @return string
+ */
+ public function typeEscape(string $type): string
+ {
+ return \danog\MadelineProto\StrTools::typeEscape($type);
+ }
/**
* Unpack binary double.
*
diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php
index aeb69538..9eec3e06 100644
--- a/src/danog/MadelineProto/MTProto.php
+++ b/src/danog/MadelineProto/MTProto.php
@@ -32,8 +32,8 @@ use danog\MadelineProto\Loop\Generic\PeriodicLoop;
use danog\MadelineProto\Loop\Update\FeedLoop;
use danog\MadelineProto\Loop\Update\SeqLoop;
use danog\MadelineProto\Loop\Update\UpdateLoop;
-use danog\MadelineProto\MTProtoTools\GarbageCollector;
use danog\MadelineProto\MTProtoTools\CombinedUpdatesState;
+use danog\MadelineProto\MTProtoTools\GarbageCollector;
use danog\MadelineProto\MTProtoTools\MinDatabase;
use danog\MadelineProto\MTProtoTools\ReferenceDatabase;
use danog\MadelineProto\MTProtoTools\UpdatesState;
@@ -91,7 +91,7 @@ class MTProto extends AsyncConstruct implements TLCallback
*
* @var int
*/
- const V = 139;
+ const V = 141;
/**
* String release version.
*
@@ -128,12 +128,6 @@ class MTProto extends AsyncConstruct implements TLCallback
* @var int
*/
const LOGGED_IN = 3;
- /**
- * Disallowed methods.
- *
- * @var array
- */
- const DISALLOWED_METHODS = ['account.updatePasswordSettings' => 'You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info)', 'account.getPasswordSettings' => 'You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info)', 'messages.receivedQueue' => 'You cannot use this method directly', 'messages.getDhConfig' => 'You cannot use this method directly, instead use $MadelineProto->getDhConfig();', 'auth.bindTempAuthKey' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'auth.exportAuthorization' => 'You cannot use this method directly, use $MadelineProto->exportAuthorization() instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'auth.importAuthorization' => 'You cannot use this method directly, use $MadelineProto->importAuthorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'auth.logOut' => 'You cannot use this method directly, use the logout method instead (see https://docs.madelineproto.xyz for more info)', 'auth.importBotAuthorization' => 'You cannot use this method directly, use the botLogin method instead (see https://docs.madelineproto.xyz for more info)', 'auth.sendCode' => 'You cannot use this method directly, use the phoneLogin method instead (see https://docs.madelineproto.xyz for more info)', 'auth.signIn' => 'You cannot use this method directly, use the completePhoneLogin method instead (see https://docs.madelineproto.xyz for more info)', 'auth.checkPassword' => 'You cannot use this method directly, use the complete2falogin method instead (see https://docs.madelineproto.xyz for more info)', 'auth.signUp' => 'You cannot use this method directly, use the completeSignup method instead (see https://docs.madelineproto.xyz for more info)', 'users.getFullUser' => 'You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info)', 'channels.getFullChannel' => 'You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info)', 'messages.getFullChat' => 'You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info)', 'contacts.resolveUsername' => 'You cannot use this method directly, use the resolveUsername, getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info)', 'messages.acceptEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'messages.discardEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'messages.requestEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'phone.requestCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.acceptCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.confirmCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.discardCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'updates.getChannelDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'updates.getDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'updates.getState' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'upload.getCdnFile' => 'You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.getFileHashes' => 'You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.getCdnFileHashes' => 'You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.reuploadCdnFile' => 'You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.getFile' => 'You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.saveFilePart' => 'You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.saveBigFilePart' => 'You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info'];
/**
* Bad message error codes.
*
@@ -289,7 +283,7 @@ class MTProto extends AsyncConstruct implements TLCallback
public $chats;
/**
- * Cache of usernames for chats
+ * Cache of usernames for chats.
*
* @var DbArray|Promise[]
*/
@@ -422,7 +416,7 @@ class MTProto extends AsyncConstruct implements TLCallback
private $TL;
/**
- * List of properties stored in database (memory or external)
+ * List of properties stored in database (memory or external).
* @see DbPropertiesFabric
* @var array
*/
@@ -781,7 +775,6 @@ class MTProto extends AsyncConstruct implements TLCallback
}
yield from $this->initDb($this);
-
}
/**
@@ -1226,18 +1219,17 @@ class MTProto extends AsyncConstruct implements TLCallback
'lang_pack' => $lang_pack,
], 'tl_schema' => [
// TL scheme files
- 'layer' => 112,
+ 'layer' => 113,
// layer version
'src' => [
- 'mtproto' => __DIR__.'/../../../schemas/TL_mtproto_v1.tl',
// mtproto TL scheme
- 'telegram' => __DIR__.'/../../../schemas/TL_telegram_v112.tl',
+ 'mtproto' => __DIR__.'/TL_mtproto_v1.tl',
// telegram TL scheme
- 'secret' => __DIR__.'/../../../schemas/TL_secret.tl',
+ 'telegram' => __DIR__.'/TL_telegram_v113.tl',
// secret chats TL scheme
- 'calls' => __DIR__.'/../../../schemas/TL_calls.tl',
- // calls TL scheme
- 'botAPI' => __DIR__.'/../../../schemas/TL_botAPI.tl',
+ 'secret' => __DIR__.'/schemas/TL_secret.tl',
+ // bot API TL scheme
+ 'botAPI' => __DIR__.'/schemas/TL_botAPI.tl',
],
], 'logger' => [
// Logger settings
@@ -1289,7 +1281,7 @@ class MTProto extends AsyncConstruct implements TLCallback
/**
* Where internal database will be stored?
* memory - session file
- * mysql - mysql database
+ * mysql - mysql database.
*/
'db' => [
'type' => 'memory',
@@ -1531,7 +1523,7 @@ class MTProto extends AsyncConstruct implements TLCallback
$this->updates = [];
$this->secret_chats = [];
- yield from $this->initDb($this,true);
+ yield from $this->initDb($this, true);
$this->tos = ['expires' => 0, 'accepted' => true];
$this->referenceDatabase = new ReferenceDatabase($this);
diff --git a/src/danog/MadelineProto/MTProtoTools/GarbageCollector.php b/src/danog/MadelineProto/MTProtoTools/GarbageCollector.php
index 55ee2a4d..1f3463ed 100644
--- a/src/danog/MadelineProto/MTProtoTools/GarbageCollector.php
+++ b/src/danog/MadelineProto/MTProtoTools/GarbageCollector.php
@@ -7,53 +7,53 @@ use danog\MadelineProto\Logger;
class GarbageCollector
{
- /**
- * Ensure only one instance of GarbageCollector
- * when multiple instances of MadelineProto running.
- * @var bool
- */
- public static bool $lock = false;
+ /**
+ * Ensure only one instance of GarbageCollector
+ * when multiple instances of MadelineProto running.
+ * @var bool
+ */
+ public static bool $lock = false;
- /**
- * How often will check memory
- * @var int
- */
- public static int $checkIntervalMs = 1000;
+ /**
+ * How often will check memory.
+ * @var int
+ */
+ public static int $checkIntervalMs = 1000;
- /**
- * Next cleanup will be triggered when memory consumption will increase by this amount
- * @var int
- */
- public static int $memoryDiffMb = 1;
+ /**
+ * Next cleanup will be triggered when memory consumption will increase by this amount.
+ * @var int
+ */
+ public static int $memoryDiffMb = 1;
- /**
- * Memory consumption after last cleanup
- * @var int
- */
- private static int $memoryConsumption = 0;
+ /**
+ * Memory consumption after last cleanup.
+ * @var int
+ */
+ private static int $memoryConsumption = 0;
- public static function start(): void
- {
- if (static::$lock) {
- return;
- }
- static::$lock = true;
+ public static function start(): void
+ {
+ if (static::$lock) {
+ return;
+ }
+ static::$lock = true;
- Loop::repeat(static::$checkIntervalMs, static function() {
- $currentMemory = static::getMemoryConsumption();
- if ($currentMemory > static::$memoryConsumption + static::$memoryDiffMb) {
- gc_collect_cycles();
- static::$memoryConsumption = static::getMemoryConsumption();
- $cleanedMemory = $currentMemory - static::$memoryConsumption;
- Logger::log("gc_collect_cycles done. Cleaned memory: $cleanedMemory Mb", Logger::NOTICE);
- }
- });
- }
+ Loop::repeat(static::$checkIntervalMs, static function () {
+ $currentMemory = static::getMemoryConsumption();
+ if ($currentMemory > static::$memoryConsumption + static::$memoryDiffMb) {
+ \gc_collect_cycles();
+ static::$memoryConsumption = static::getMemoryConsumption();
+ $cleanedMemory = $currentMemory - static::$memoryConsumption;
+ Logger::log("gc_collect_cycles done. Cleaned memory: $cleanedMemory Mb", Logger::NOTICE);
+ }
+ });
+ }
- private static function getMemoryConsumption(): int
- {
- $memory = round(memory_get_usage()/1024/1024, 1);
- Logger::log("Memory consumption: $memory Mb", Logger::VERBOSE);
- return (int) $memory;
- }
-}
\ No newline at end of file
+ private static function getMemoryConsumption(): int
+ {
+ $memory = \round(\memory_get_usage()/1024/1024, 1);
+ Logger::log("Memory consumption: $memory Mb", Logger::VERBOSE);
+ return (int) $memory;
+ }
+}
diff --git a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php
index 461c67d4..9ecbec28 100644
--- a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php
+++ b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php
@@ -208,7 +208,7 @@ trait PeerHandler
private function cacheChatUsername(int $id, array $chat)
{
if ($id && !empty($chat['username'])) {
- $this->usernames[strtolower($chat['username'])] = $id;
+ $this->usernames[\strtolower($chat['username'])] = $id;
}
}
diff --git a/src/danog/MadelineProto/RPCErrorException.php b/src/danog/MadelineProto/RPCErrorException.php
index dd660e15..6d4eb228 100644
--- a/src/danog/MadelineProto/RPCErrorException.php
+++ b/src/danog/MadelineProto/RPCErrorException.php
@@ -23,7 +23,7 @@ class RPCErrorException extends \Exception
{
use TL\PrettyException;
/**
- * RPC error code
+ * RPC error code.
*/
public string $rpc = '';
private $fetched = false;
diff --git a/src/danog/MadelineProto/StrTools.php b/src/danog/MadelineProto/StrTools.php
new file mode 100644
index 00000000..c3fc7448
--- /dev/null
+++ b/src/danog/MadelineProto/StrTools.php
@@ -0,0 +1,88 @@
+.
+ *
+ * @author Daniil Gentili
+ * @copyright 2016-2020 Daniil Gentili
+ * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3
+ *
+ * @link https://docs.madelineproto.xyz MadelineProto documentation
+ */
+
+namespace danog\MadelineProto;
+
+/**
+ * Some tools.
+ */
+abstract class StrTools
+{
+ /**
+ * Convert to camelCase.
+ *
+ * @param string $input String
+ *
+ * @return string
+ */
+ public static function toCamelCase(string $input): string
+ {
+ return \lcfirst(\str_replace('_', '', \ucwords($input, '_')));
+ }
+ /**
+ * Convert to snake_case.
+ *
+ * @param string $input String
+ *
+ * @return string
+ */
+ public static function toSnakeCase(string $input): string
+ {
+ \preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches);
+ $ret = $matches[0];
+ foreach ($ret as &$match) {
+ $match = $match == \strtoupper($match) ? \strtolower($match) : \lcfirst($match);
+ }
+ return \implode('_', $ret);
+ }
+ /**
+ * Escape string for markdown.
+ *
+ * @param string $hwat String to escape
+ *
+ * @return string
+ */
+ public static function markdownEscape(string $hwat): string
+ {
+ return \str_replace('_', '\\_', $hwat);
+ }
+ /**
+ * Escape type name.
+ *
+ * @param string $type String to escape
+ *
+ * @return string
+ */
+ public static function typeEscape(string $type): string
+ {
+ $type = \str_replace(['<', '>'], ['_of_', ''], $type);
+ return \preg_replace('/.*_of_/', '', $type);
+ }
+ /**
+ * Escape method name.
+ *
+ * @param string $method Method name
+ *
+ * @return string
+ */
+ public static function methodEscape(string $method): string
+ {
+ return \str_replace('.', '->', $method);
+ }
+}
diff --git a/src/danog/MadelineProto/Stream/Common/BufferedRawStream.php b/src/danog/MadelineProto/Stream/Common/BufferedRawStream.php
index 8ff699f2..cd769bfa 100644
--- a/src/danog/MadelineProto/Stream/Common/BufferedRawStream.php
+++ b/src/danog/MadelineProto/Stream/Common/BufferedRawStream.php
@@ -208,7 +208,7 @@ class BufferedRawStream implements BufferedStreamInterface, BufferInterface, Raw
return $this->write($data);
}
/**
- * Get remaining data from buffer
+ * Get remaining data from buffer.
*
* @return string
*/
@@ -217,8 +217,8 @@ class BufferedRawStream implements BufferedStreamInterface, BufferInterface, Raw
$size = \fstat($this->memory_stream)['size'];
$offset = \ftell($this->memory_stream);
$buffer_length = $size - $offset;
- $data = fread($this->memory_stream, $buffer_length);
- fclose($this->memory_stream);
+ $data = \fread($this->memory_stream, $buffer_length);
+ \fclose($this->memory_stream);
$this->memory_stream = null;
return $data;
}
diff --git a/src/danog/MadelineProto/Stream/Common/UdpBufferedStream.php b/src/danog/MadelineProto/Stream/Common/UdpBufferedStream.php
index da17267e..11de3357 100644
--- a/src/danog/MadelineProto/Stream/Common/UdpBufferedStream.php
+++ b/src/danog/MadelineProto/Stream/Common/UdpBufferedStream.php
@@ -30,7 +30,6 @@ use danog\MadelineProto\Stream\BufferedStreamInterface;
use danog\MadelineProto\Stream\ConnectionContext;
use danog\MadelineProto\Stream\RawStreamInterface;
use danog\MadelineProto\Stream\ReadBufferInterface;
-use danog\MadelineProto\Stream\StreamInterface;
use danog\MadelineProto\Stream\Transport\DefaultStream;
use danog\MadelineProto\Stream\WriteBufferInterface;
@@ -135,7 +134,7 @@ class UdpBufferedStream extends DefaultStream implements BufferedStreamInterface
private RawStreamInterface $stream;
private string $data = '';
/**
- * Constructor function
+ * Constructor function.
*
* @param integer $length
* @param string $append
@@ -172,7 +171,7 @@ class UdpBufferedStream extends DefaultStream implements BufferedStreamInterface
throw new Exception('Tried to send too much out of frame data, cannot append');
}
}
- return new Success(strlen($data));
+ return new Success(\strlen($data));
}
});
}
diff --git a/src/danog/MadelineProto/TL_botAPI.tl b/src/danog/MadelineProto/TL_botAPI.tl
new file mode 100644
index 00000000..8c6dfdd0
--- /dev/null
+++ b/src/danog/MadelineProto/TL_botAPI.tl
@@ -0,0 +1,19 @@
+bot_thumbnail#0 dc_id:int id:long access_hash:long volume_id:long = File;
+bot_profile_photo#1 dc_id:int id:long access_hash:long volume_id:long = File;
+bot_photo#2 dc_id:int id:long access_hash:long volume_id:long = File;
+
+bot_voice#3 dc_id:int id:long access_hash:long = File;
+bot_video#4 dc_id:int id:long access_hash:long = File;
+bot_document#5 dc_id:int id:long access_hash:long = File;
+bot_encrypted#6 dc_id:int id:long access_hash:long = File;
+bot_temp#7 dc_id:int id:long access_hash:long = File;
+bot_sticker#8 dc_id:int id:long access_hash:long = File;
+bot_audio#9 dc_id:int id:long access_hash:long = File;
+bot_gif#A dc_id:int id:long access_hash:long = File;
+bot_encrypted_thumbnail#B dc_id:int id:long access_hash:long = File;
+bot_wallpaper#C dc_id:int id:long access_hash:long = File;
+bot_video_note#D dc_id:int id:long access_hash:long = File;
+bot_secure_raw#F dc_id:int id:long access_hash:long = File;
+bot_secure#10 dc_id:int id:long access_hash:long = File;
+bot_background#11 dc_id:int id:long access_hash:long = File;
+bot_size#12 dc_id:int id:long access_hash:long = File;
diff --git a/src/danog/MadelineProto/TL_mtproto_v1.tl b/src/danog/MadelineProto/TL_mtproto_v1.tl
new file mode 100644
index 00000000..16e7f39c
--- /dev/null
+++ b/src/danog/MadelineProto/TL_mtproto_v1.tl
@@ -0,0 +1,86 @@
+resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector = ResPQ;
+
+vector {t:Type} # [ t ] = Vector t;
+
+p_q_inner_data_dc#a9f55f95 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data;
+p_q_inner_data_temp_dc#56fddf88 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data;
+
+p_q_inner_data pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data;
+p_q_inner_data_temp pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data;
+
+server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params;
+server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;
+
+server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data;
+
+client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data;
+
+dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;
+dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer;
+dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer;
+
+bind_auth_key_inner#75a3f765 nonce:long temp_auth_key_id:long perm_auth_key_id:long temp_session_id:long expires_at:int = BindAuthKeyInner;
+
+rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult;
+rpc_error#2144ca19 error_code:int error_message:string = RpcError;
+
+rpc_answer_unknown#5e2ad36e = RpcDropAnswer;
+rpc_answer_dropped_running#cd78e586 = RpcDropAnswer;
+rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer;
+
+future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt;
+future_salts#ae500895 req_msg_id:long now:int salts:vector = FutureSalts;
+
+pong#347773c5 msg_id:long ping_id:long = Pong;
+
+destroy_session_ok#e22045fc session_id:long = DestroySessionRes;
+destroy_session_none#62d350c9 session_id:long = DestroySessionRes;
+
+new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession;
+
+msg_container#73f1f8dc messages:vector<%Message> = MessageContainer;
+message msg_id:long seqno:int bytes:int body:Object = Message;
+msg_copy#e06046b2 orig_message:Message = MessageCopy;
+
+gzip_packed#3072cfa1 packed_data:bytes = Object;
+
+msgs_ack#62d6b459 msg_ids:Vector = MsgsAck;
+
+bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification;
+bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification;
+
+msg_resend_ans_req#8610baeb msg_ids:Vector = MsgResendReq;
+msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq;
+msgs_state_req#da69fb52 msg_ids:Vector = MsgsStateReq;
+msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo;
+msgs_all_info#8cc0d131 msg_ids:Vector info:string = MsgsAllInfo;
+msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo;
+msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo;
+
+rsa_public_key n:string e:string = RSAPublicKey;
+
+http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait;
+
+---functions---
+
+req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;
+
+req_pq nonce:int128 = ResPQ;
+
+req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params;
+
+set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer;
+
+rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer;
+get_future_salts#b921bd04 num:int = FutureSalts;
+ping#7abe77ec ping_id:long = Pong;
+ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong;
+destroy_session#e7512126 session_id:long = DestroySessionRes;
+
+//test.useGzipPacked = GzipPacked;
+//test.useServerDhInnerData = Server_DH_inner_data;
+//test.useNewSessionCreated = NewSession;
+//test.useMsgsAck = MsgsAck;
+//test.useBadMsgNotification = BadMsgNotification;
+
+//test.useOther key:rsa_public_key p_q_data:P_Q_inner_data dh_data:client_DH_inner_data = RpcError;
diff --git a/src/danog/MadelineProto/TL_secret.tl b/src/danog/MadelineProto/TL_secret.tl
new file mode 100644
index 00000000..3ff3f13d
--- /dev/null
+++ b/src/danog/MadelineProto/TL_secret.tl
@@ -0,0 +1,76 @@
+===8===
+decryptedMessage#1f814f1f random_id:long random_bytes:bytes message:string media:DecryptedMessageMedia = DecryptedMessage;
+decryptedMessageService#aa48327d random_id:long random_bytes:bytes action:DecryptedMessageAction = DecryptedMessage;
+decryptedMessageMediaEmpty#89f5c4a = DecryptedMessageMedia;
+decryptedMessageMediaPhoto#32798a8c thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaVideo#4cee6ef3 thumb:bytes thumb_w:int thumb_h:int duration:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaGeoPoint#35480a59 lat:double long:double = DecryptedMessageMedia;
+decryptedMessageMediaContact#588a0a97 phone_number:string first_name:string last_name:string user_id:int = DecryptedMessageMedia;
+decryptedMessageActionSetMessageTTL#a1733aec ttl_seconds:int = DecryptedMessageAction;
+decryptedMessageMediaDocument#b095434b thumb:bytes thumb_w:int thumb_h:int file_name:string mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaAudio#6080758f duration:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageActionReadMessages#c4f40be random_ids:Vector = DecryptedMessageAction;
+decryptedMessageActionDeleteMessages#65614304 random_ids:Vector = DecryptedMessageAction;
+decryptedMessageActionScreenshotMessages#8ac1f475 random_ids:Vector = DecryptedMessageAction;
+decryptedMessageActionFlushHistory#6719e45c = DecryptedMessageAction;
+
+===17===
+decryptedMessage#204d3878 random_id:long ttl:int message:string media:DecryptedMessageMedia = DecryptedMessage;
+decryptedMessageService#73164160 random_id:long action:DecryptedMessageAction = DecryptedMessage;
+decryptedMessageMediaVideo#524a415d thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaAudio#57e0a9cb duration:int mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageLayer#1be31789 random_bytes:bytes layer:int in_seq_no:int out_seq_no:int message:DecryptedMessage = DecryptedMessageLayer;
+sendMessageTypingAction#16bf744e = SendMessageAction;
+sendMessageCancelAction#fd5ec8f5 = SendMessageAction;
+sendMessageRecordVideoAction#a187d66f = SendMessageAction;
+sendMessageUploadVideoAction#92042ff7 = SendMessageAction;
+sendMessageRecordAudioAction#d52f73f7 = SendMessageAction;
+sendMessageUploadAudioAction#e6ac8a6f = SendMessageAction;
+sendMessageUploadPhotoAction#990a3c1a = SendMessageAction;
+sendMessageUploadDocumentAction#8faee98e = SendMessageAction;
+sendMessageGeoLocationAction#176f8ba1 = SendMessageAction;
+sendMessageChooseContactAction#628cbc6f = SendMessageAction;
+decryptedMessageActionResend#511110b0 start_seq_no:int end_seq_no:int = DecryptedMessageAction;
+decryptedMessageActionNotifyLayer#f3048883 layer:int = DecryptedMessageAction;
+decryptedMessageActionTyping#ccb27641 action:SendMessageAction = DecryptedMessageAction;
+
+===20===
+decryptedMessageActionRequestKey#f3c9611b exchange_id:long g_a:bytes = DecryptedMessageAction;
+decryptedMessageActionAcceptKey#6fe1735b exchange_id:long g_b:bytes key_fingerprint:long = DecryptedMessageAction;
+decryptedMessageActionAbortKey#dd05ec6b exchange_id:long = DecryptedMessageAction;
+decryptedMessageActionCommitKey#ec2e0b9b exchange_id:long key_fingerprint:long = DecryptedMessageAction;
+decryptedMessageActionNoop#a82fdd63 = DecryptedMessageAction;
+
+===23===
+documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
+documentAttributeAnimated#11b58939 = DocumentAttribute;
+documentAttributeSticker#fb0a5727 = DocumentAttribute;
+documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute;
+documentAttributeAudio#51448e5 duration:int = DocumentAttribute;
+documentAttributeFilename#15590068 file_name:string = DocumentAttribute;
+photoSizeEmpty#e17e23c type:string = PhotoSize;
+photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize;
+photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;
+fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation;
+fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation;
+decryptedMessageMediaExternalDocument#fa95b0dd id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector = DecryptedMessageMedia;
+
+===45===
+decryptedMessage#36b091de flags:# random_id:long ttl:int message:string media:flags.9?DecryptedMessageMedia entities:flags.7?Vector via_bot_name:flags.11?string reply_to_random_id:flags.3?long = DecryptedMessage;
+decryptedMessageMediaPhoto#f1fa8d78 thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes caption:string = DecryptedMessageMedia;
+decryptedMessageMediaVideo#970c8c0e thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes caption:string = DecryptedMessageMedia;
+decryptedMessageMediaDocument#7afe8ae2 thumb:bytes thumb_w:int thumb_h:int mime_type:string size:int key:bytes iv:bytes attributes:Vector caption:string = DecryptedMessageMedia;
+
+===46===
+decryptedMessageMediaVenue#8a0df56f lat:double long:double title:string address:string provider:string venue_id:string = DecryptedMessageMedia;
+documentAttributeAudio#ded218e0 duration:int title:string performer:string = DocumentAttribute;
+decryptedMessageMediaWebPage#e50511d8 url:string = DecryptedMessageMedia;
+
+===55===
+documentAttributeSticker#3a556302 alt:string stickerset:InputStickerSet = DocumentAttribute;
+
+===66===
+documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true duration:int w:int h:int = DocumentAttribute;
+
+===73===
+decryptedMessage#91cc4674 flags:# random_id:long ttl:int message:string media:flags.9?DecryptedMessageMedia entities:flags.7?Vector via_bot_name:flags.11?string reply_to_random_id:flags.3?long grouped_id:flags.17?long = DecryptedMessage;
diff --git a/src/danog/MadelineProto/TL_telegram_v113.tl b/src/danog/MadelineProto/TL_telegram_v113.tl
new file mode 100644
index 00000000..03a6bdb3
--- /dev/null
+++ b/src/danog/MadelineProto/TL_telegram_v113.tl
@@ -0,0 +1,1469 @@
+boolFalse#bc799737 = Bool;
+boolTrue#997275b5 = Bool;
+
+true#3fedd339 = True;
+
+vector#1cb5c415 {t:Type} # [ t ] = Vector t;
+
+error#c4b9f9bb code:int text:string = Error;
+
+null#56730bcc = Null;
+
+inputPeerEmpty#7f3b18ea = InputPeer;
+inputPeerSelf#7da07ec9 = InputPeer;
+inputPeerChat#179be863 chat_id:int = InputPeer;
+inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer;
+inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer;
+inputPeerUserFromMessage#17bae2e6 peer:InputPeer msg_id:int user_id:int = InputPeer;
+inputPeerChannelFromMessage#9c95f7bb peer:InputPeer msg_id:int channel_id:int = InputPeer;
+
+inputUserEmpty#b98886cf = InputUser;
+inputUserSelf#f7c1b13f = InputUser;
+inputUser#d8292816 user_id:int access_hash:long = InputUser;
+inputUserFromMessage#2d117597 peer:InputPeer msg_id:int user_id:int = InputUser;
+
+inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact;
+
+inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile;
+inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile;
+
+inputMediaEmpty#9664f57f = InputMedia;
+inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia;
+inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia;
+inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia;
+inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia;
+inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia;
+inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia;
+inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia;
+inputMediaGifExternal#4843b0fd url:string q:string = InputMedia;
+inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia;
+inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia;
+inputMediaGame#d33f43f3 id:InputGame = InputMedia;
+inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia;
+inputMediaGeoLive#ce4e82fd flags:# stopped:flags.0?true geo_point:InputGeoPoint period:flags.1?int = InputMedia;
+inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector solution:flags.1?string solution_entities:flags.1?Vector = InputMedia;
+inputMediaDice#e66fbf7b emoticon:string = InputMedia;
+
+inputChatPhotoEmpty#1ca48f57 = InputChatPhoto;
+inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto;
+inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto;
+
+inputGeoPointEmpty#e4c123d6 = InputGeoPoint;
+inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint;
+
+inputPhotoEmpty#1cd7bf0d = InputPhoto;
+inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto;
+
+inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation;
+inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation;
+inputDocumentFileLocation#bad07584 id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
+inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;
+inputTakeoutFileLocation#29be5899 = InputFileLocation;
+inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
+inputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation;
+inputPeerPhotoFileLocation#27d69997 flags:# big:flags.0?true peer:InputPeer volume_id:long local_id:int = InputFileLocation;
+inputStickerSetThumb#dbaeae9 stickerset:InputStickerSet volume_id:long local_id:int = InputFileLocation;
+
+peerUser#9db1bc6d user_id:int = Peer;
+peerChat#bad0e5bb chat_id:int = Peer;
+peerChannel#bddde532 channel_id:int = Peer;
+
+storage.fileUnknown#aa963b05 = storage.FileType;
+storage.filePartial#40bc6f52 = storage.FileType;
+storage.fileJpeg#7efe0e = storage.FileType;
+storage.fileGif#cae1aadf = storage.FileType;
+storage.filePng#a4f63c0 = storage.FileType;
+storage.filePdf#ae1e508d = storage.FileType;
+storage.fileMp3#528a0677 = storage.FileType;
+storage.fileMov#4b09ebbc = storage.FileType;
+storage.fileMp4#b3cea0e4 = storage.FileType;
+storage.fileWebp#1081464c = storage.FileType;
+
+userEmpty#200250ba id:int = User;
+user#938458c1 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
+
+userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
+userProfilePhoto#ecd75d8c photo_id:long photo_small:FileLocation photo_big:FileLocation dc_id:int = UserProfilePhoto;
+
+userStatusEmpty#9d05049 = UserStatus;
+userStatusOnline#edb93949 expires:int = UserStatus;
+userStatusOffline#8c703f was_online:int = UserStatus;
+userStatusRecently#e26f42f1 = UserStatus;
+userStatusLastWeek#7bf09fc = UserStatus;
+userStatusLastMonth#77ebc742 = UserStatus;
+
+chatEmpty#9ba2d800 id:int = Chat;
+chat#3bda1bde flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
+chatForbidden#7328bdb id:int title:string = Chat;
+channel#d31a961e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
+channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat;
+
+chatFull#1b7c9db3 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int = ChatFull;
+channelFull#f0e6672a flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_view_stats:flags.12?true can_set_location:flags.16?true has_scheduled:flags.19?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int = ChatFull;
+
+chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant;
+chatParticipantCreator#da13538a user_id:int = ChatParticipant;
+chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant;
+
+chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants;
+chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants;
+
+chatPhotoEmpty#37c1011c = ChatPhoto;
+chatPhoto#475cdbd5 photo_small:FileLocation photo_big:FileLocation dc_id:int = ChatPhoto;
+
+messageEmpty#83e5de54 id:int = Message;
+message#452c0e65 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector = Message;
+messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message;
+
+messageMediaEmpty#3ded6320 = MessageMedia;
+messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
+messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;
+messageMediaContact#cbf24940 phone_number:string first_name:string last_name:string vcard:string user_id:int = MessageMedia;
+messageMediaUnsupported#9f84f49e = MessageMedia;
+messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia;
+messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;
+messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia;
+messageMediaGame#fdb19008 game:Game = MessageMedia;
+messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia;
+messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia;
+messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
+messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;
+
+messageActionEmpty#b6aef7b0 = MessageAction;
+messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction;
+messageActionChatEditTitle#b5a1ce5a title:string = MessageAction;
+messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction;
+messageActionChatDeletePhoto#95e3fbef = MessageAction;
+messageActionChatAddUser#488a7337 users:Vector = MessageAction;
+messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction;
+messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction;
+messageActionChannelCreate#95d2ac92 title:string = MessageAction;
+messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction;
+messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction;
+messageActionPinMessage#94bd38ed = MessageAction;
+messageActionHistoryClear#9fbab604 = MessageAction;
+messageActionGameScore#92a72876 game_id:long score:int = MessageAction;
+messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction;
+messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction;
+messageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction;
+messageActionScreenshotTaken#4792929b = MessageAction;
+messageActionCustomAction#fae69f56 message:string = MessageAction;
+messageActionBotAllowed#abe9affe domain:string = MessageAction;
+messageActionSecureValuesSentMe#1b287353 values:Vector credentials:SecureCredentialsEncrypted = MessageAction;
+messageActionSecureValuesSent#d95c6154 types:Vector = MessageAction;
+messageActionContactSignUp#f3f25f76 = MessageAction;
+
+dialog#2c171f72 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog;
+dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
+
+photoEmpty#2331b22d id:long = Photo;
+photo#d07504a5 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector dc_id:int = Photo;
+
+photoSizeEmpty#e17e23c type:string = PhotoSize;
+photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize;
+photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;
+photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;
+
+geoPointEmpty#1117dd5f = GeoPoint;
+geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint;
+
+auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode;
+
+auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization;
+auth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization;
+
+auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization;
+
+inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer;
+inputNotifyUsers#193b4417 = InputNotifyPeer;
+inputNotifyChats#4a95e84e = InputNotifyPeer;
+inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer;
+
+inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = InputPeerNotifySettings;
+
+peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings;
+
+peerSettings#818426cd flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true = PeerSettings;
+
+wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper;
+wallPaperNoFile#8af40b25 flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper;
+
+inputReportReasonSpam#58dbcab8 = ReportReason;
+inputReportReasonViolence#1e22c78d = ReportReason;
+inputReportReasonPornography#2e59d922 = ReportReason;
+inputReportReasonChildAbuse#adf44ee3 = ReportReason;
+inputReportReasonOther#e1746d0a text:string = ReportReason;
+inputReportReasonCopyright#9b89f93a = ReportReason;
+inputReportReasonGeoIrrelevant#dbd4feed = ReportReason;
+
+userFull#edf17c12 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int = UserFull;
+
+contact#f911c994 user_id:int mutual:Bool = Contact;
+
+importedContact#d0028438 user_id:int client_id:long = ImportedContact;
+
+contactBlocked#561bc879 user_id:int date:int = ContactBlocked;
+
+contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus;
+
+contacts.contactsNotModified#b74ba9d2 = contacts.Contacts;
+contacts.contacts#eae87e42 contacts:Vector saved_count:int users:Vector = contacts.Contacts;
+
+contacts.importedContacts#77d01c3b imported:Vector popular_invites:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts;
+
+contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked;
+contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked;
+
+messages.dialogs#15ba6c40 dialogs:Vector