Update to layer 110

This commit is contained in:
Daniil Gentili 2020-03-06 13:09:52 +01:00
parent c0af617862
commit 5232d477b4
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
10 changed files with 267 additions and 54 deletions

View File

@ -177,6 +177,7 @@ You can find examples for nearly every MadelineProto function in
* [SignalLoop](https://docs.madelineproto.xyz/docs/ASYNC.html#signalloop)
* [ResumableSignalLoop](https://docs.madelineproto.xyz/docs/ASYNC.html#resumablesignalloop)
* [GenericLoop](https://docs.madelineproto.xyz/docs/ASYNC.html#genericloop)
* [PeriodicLoop](https://docs.madelineproto.xyz/docs/ASYNC.html#periodicloop)
* [Using methods](https://docs.madelineproto.xyz/docs/USING_METHODS.html)
* [FULL API Documentation with descriptions](https://docs.madelineproto.xyz/API_docs/methods/)
* [Logout](https://docs.madelineproto.xyz/logout.html)

2
docs

@ -1 +1 @@
Subproject commit aba1bf55122500b13163d9589404d4cb7ca49c1b
Subproject commit 1e1967391fe643b6ecc0e6f22a800386cbd22e5d

View File

@ -142,4 +142,4 @@ $settings = \json_decode(\getenv('MTPROTO_SETTINGS'), true) ?: [];
$MadelineProto = new \danog\MadelineProto\API('s.madeline', $settings);
// Reduce boilerplate with new wrapper method
$MadelineProto->startAndLoop(MyEventHandler::class);
$MadelineProto->startAndLoop(SecretHandler::class);

View File

@ -191,6 +191,44 @@ interface auth
* @return bool
*/
public function dropTempAuthKeys($params);
/**
*
*
* Parameters:
* * `int` **api_id** -
* * `string` **api_hash** -
* * `[int]` **except_ids** -.
*
* @param array $params Parameters
*
* @return auth.LoginToken
*/
public function exportLoginToken($params);
/**
*
*
* Parameters:
* * `bytes` **token** -.
*
* @param array $params Parameters
*
* @return auth.LoginToken
*/
public function importLoginToken($params);
/**
*
*
* Parameters:
* * `bytes` **token** -.
*
* @param array $params Parameters
*
* @return Authorization
*/
public function acceptLoginToken($params);
}
interface account
@ -858,9 +896,10 @@ interface account
* Create a theme.
*
* Parameters:
* * `string` **slug** - Unique theme ID
* * `string` **title** - Theme name
* * `InputDocument` **document** - Theme file
* * `string` **slug** - Unique theme ID
* * `string` **title** - Theme name
* * `InputDocument` **document** - Optional: Theme file
* * `InputThemeSettings` **settings** - Optional:
*
* @param array $params Parameters
*
@ -872,11 +911,12 @@ interface account
* Update theme.
*
* Parameters:
* * `string` **format** - Theme format, a string that identifies the theming engines supported by the client
* * `InputTheme` **theme** - Theme to update
* * `string` **slug** - Optional: Unique theme ID
* * `string` **title** - Optional: Theme name
* * `InputDocument` **document** - Optional: Theme file
* * `string` **format** - Theme format, a string that identifies the theming engines supported by the client
* * `InputTheme` **theme** - Theme to update
* * `string` **slug** - Optional: Unique theme ID
* * `string` **title** - Optional: Theme name
* * `InputDocument` **document** - Optional: Theme file
* * `InputThemeSettings` **settings** - Optional:
*
* @param array $params Parameters
*
@ -937,6 +977,37 @@ interface account
* @return account.Themes
*/
public function getThemes($params);
/**
*
*
* Parameters:
* * `boolean` **sensitive_enabled** - Optional:.
*
* @param array $params Parameters
*
* @return bool
*/
public function setContentSettings($params);
/**
*
*
* @return account.ContentSettings
*/
public function getContentSettings();
/**
*
*
* Parameters:
* * `[InputWallPaper]` **wallpapers** -.
*
* @param array $params Parameters
*
* @return of WallPaper[]
*/
public function getMultiWallPapers($params);
}
interface users
@ -1205,7 +1276,9 @@ interface contacts
* Get contacts near you.
*
* Parameters:
* * `InputGeoPoint` **geo_point** - Geolocation
* * `boolean` **background** - Optional:
* * `InputGeoPoint` **geo_point** - Geolocation
* * `int` **self_expires** - Optional:
*
* @param array $params Parameters
*
@ -2802,6 +2875,37 @@ interface messages
* @return Updates
*/
public function deleteScheduledMessages($params);
/**
*
*
* Parameters:
* * `InputPeer` **peer** -
* * `int` **id** -
* * `bytes` **option** - Optional:
* * `string` **offset** - Optional:
* * `int` **limit** -.
*
* @param array $params Parameters
*
* @return messages.VotesList
*/
public function getPollVotes($params);
/**
*
*
* Parameters:
* * `boolean` **uninstall** - Optional:
* * `boolean` **archive** - Optional:
* * `boolean` **unarchive** - Optional:
* * `[InputStickerSet]` **stickersets** -.
*
* @param array $params Parameters
*
* @return bool
*/
public function toggleStickerSets($params);
}
interface updates
@ -2919,10 +3023,11 @@ interface upload
* You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info.
*
* 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
* * `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: 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
*
* @param array $params Parameters
*
@ -3652,6 +3757,13 @@ interface channels
* @return Updates
*/
public function toggleSlowMode($params);
/**
*
*
* @return messages.InactiveChats
*/
public function getInactiveChannels();
}
interface bots
@ -3757,6 +3869,18 @@ interface payments
* @return bool
*/
public function clearSavedInfo($params);
/**
*
*
* Parameters:
* * `string` **number** -.
*
* @param array $params Parameters
*
* @return payments.BankCardData
*/
public function getBankCardData($params);
}
interface stickers
@ -5420,19 +5544,32 @@ class InternalDoc extends APIFactory
\danog\MadelineProto\MTProto::setVar($obj, $var, $val);
}
/**
* Discard call.
* Accept call from VoIP instance.
*
* @param array $call Call
* @param string $reason Discard reason
* @param array $rating Rating
* @param boolean $need_debug Need debug?
* @param \danog\MadelineProto\VoIP $instance Call instance
* @param array $user User
*
* @return \Generator
* @return mixed
*/
public function discardCall(array $call, array $reason, array $rating = [
], bool $need_debug = true, array $extra = [])
public function acceptCallFrom($instance, $user, array $extra = [])
{
return $this->__call(__FUNCTION__, [$call, $reason, $rating, $need_debug, $extra]);
return $this->__call(__FUNCTION__, [$instance, $user, $extra]);
}
/**
* Undocumented function.
*
* @param \danog\MadelineProto\VoIP $instance Call instance
* @param array $call Call info
* @param array $reason Discard reason
* @param array $rating Rating
* @param boolean $need_debug Needs debug?
*
* @return mixed
*/
public function discardCallFrom($instance, $call, $reason, $rating = [
], $need_debug = true, array $extra = [])
{
return $this->__call(__FUNCTION__, [$instance, $call, $reason, $rating, $need_debug, $extra]);
}
/**
* Request VoIP call.
@ -5500,6 +5637,21 @@ class InternalDoc extends APIFactory
{
return $this->API->getCall($call);
}
/**
* Discard call.
*
* @param array $call Call
* @param string $reason Discard reason
* @param array $rating Rating
* @param boolean $need_debug Need debug?
*
* @return \Generator
*/
public function discardCall(array $call, array $reason, array $rating = [
], bool $need_debug = true, array $extra = [])
{
return $this->__call(__FUNCTION__, [$call, $reason, $rating, $need_debug, $extra]);
}
/**
* Check state of calls.
*
@ -5709,18 +5861,18 @@ class InternalDoc extends APIFactory
*
* @return void
*/
public function stop(): void
public function stop(array $extra = [])
{
$this->API->stop();
return $this->__call(__FUNCTION__, [$extra]);
}
/**
* Restart update loop.
*
* @return void
*/
public function restart(): void
public function restart(array $extra = [])
{
$this->API->restart();
return $this->__call(__FUNCTION__, [$extra]);
}
/**
* Start MadelineProto's update handling loop in background.
@ -5738,9 +5890,9 @@ class InternalDoc extends APIFactory
*
* @return void
*/
public function closeConnection($message = 'OK!'): void
public function closeConnection($message = 'OK!', array $extra = [])
{
$this->API->closeConnection($message);
return $this->__call(__FUNCTION__, [$message, $extra]);
}
/**
* Set NOOP update handler, ignoring all updates.

View File

@ -5731,6 +5731,28 @@ Contains the reason why access to a certain object must be restricted. Clients a
'object_messages.votesList_param_votes_type_Vector t' => '',
'object_messages.votesList_param_users_type_Vector t' => '',
'object_messages.votesList_param_next_offset_type_string' => '',
'method_test.useError' => '',
'method_test.useConfigSimple' => '',
'method_contacts.getLocated_param_background_type_true' => '',
'method_contacts.getLocated_param_self_expires_type_int' => '',
'method_messages.toggleStickerSets' => '',
'method_messages.toggleStickerSets_param_uninstall_type_true' => '',
'method_messages.toggleStickerSets_param_archive_type_true' => '',
'method_messages.toggleStickerSets_param_unarchive_type_true' => '',
'method_messages.toggleStickerSets_param_stickersets_type_Vector t' => '',
'method_payments.getBankCardData' => '',
'method_payments.getBankCardData_param_number_type_string' => '',
'object_messageEntityBankCard' => '',
'object_messageEntityBankCard_param_offset_type_int' => '',
'object_messageEntityBankCard_param_length_type_int' => '',
'object_peerSelfLocated' => '',
'object_peerSelfLocated_param_expires_type_int' => '',
'object_bankCardOpenUrl' => '',
'object_bankCardOpenUrl_param_url_type_string' => '',
'object_bankCardOpenUrl_param_name_type_string' => '',
'object_payments.bankCardData' => '',
'object_payments.bankCardData_param_title_type_string' => '',
'object_payments.bankCardData_param_open_urls_type_Vector t' => '',
],
];
@ -11303,5 +11325,27 @@ Contains the reason why access to a certain object must be restricted. Clients a
'object_messages.votesList_param_votes_type_Vector t' => '',
'object_messages.votesList_param_users_type_Vector t' => '',
'object_messages.votesList_param_next_offset_type_string' => '',
'method_test.useError' => '',
'method_test.useConfigSimple' => '',
'method_contacts.getLocated_param_background_type_true' => '',
'method_contacts.getLocated_param_self_expires_type_int' => '',
'method_messages.toggleStickerSets' => '',
'method_messages.toggleStickerSets_param_uninstall_type_true' => '',
'method_messages.toggleStickerSets_param_archive_type_true' => '',
'method_messages.toggleStickerSets_param_unarchive_type_true' => '',
'method_messages.toggleStickerSets_param_stickersets_type_Vector t' => '',
'method_payments.getBankCardData' => '',
'method_payments.getBankCardData_param_number_type_string' => '',
'object_messageEntityBankCard' => '',
'object_messageEntityBankCard_param_offset_type_int' => '',
'object_messageEntityBankCard_param_length_type_int' => '',
'object_peerSelfLocated' => '',
'object_peerSelfLocated_param_expires_type_int' => '',
'object_bankCardOpenUrl' => '',
'object_bankCardOpenUrl_param_url_type_string' => '',
'object_bankCardOpenUrl_param_name_type_string' => '',
'object_payments.bankCardData' => '',
'object_payments.bankCardData_param_title_type_string' => '',
'object_payments.bankCardData_param_open_urls_type_Vector t' => '',
];
}

View File

@ -87,7 +87,7 @@ class MTProto extends AsyncConstruct implements TLCallback
*
* @var int
*/
const V = 135;
const V = 136;
/**
* String release version.
*
@ -1189,12 +1189,12 @@ class MTProto extends AsyncConstruct implements TLCallback
'lang_pack' => $lang_pack,
], 'tl_schema' => [
// TL scheme files
'layer' => 109,
'layer' => 110,
// layer version
'src' => [
'mtproto' => __DIR__.'/TL_mtproto_v1.tl',
// mtproto TL scheme
'telegram' => __DIR__.'/TL_telegram_v109.tl',
'telegram' => __DIR__.'/TL_telegram_v110.tl',
// telegram TL scheme
'secret' => __DIR__.'/TL_secret.tl',
// secret chats TL scheme

View File

@ -85,7 +85,7 @@ trait Events
$this->settings['updates']['callback'] = [$this, 'eventUpdateHandler'];
$this->settings['updates']['handle_updates'] = true;
$this->settings['updates']['run_callback'] = true;
if (method_exists($this->event_handler_instance, 'onStart')) {
if (\method_exists($this->event_handler_instance, 'onStart')) {
Tools::callFork($this->event_handler_instance->onStart());
}
if ($this->inited()) {

View File

@ -16,11 +16,13 @@
*
* @link https://docs.madelineproto.xyz MadelineProto documentation
*/
namespace danog\MadelineProto\Wrappers;
use Amp\Promise;
use danog\MadelineProto\Shutdown;
use danog\MadelineProto\Tools;
/**
* Manages logging in and out.
*/
@ -40,7 +42,7 @@ trait Loop
*
* @return mixed
*/
public function loop($callback = null) : \Generator
public function loop($callback = null): \Generator
{
if (\is_callable($callback)) {
$this->logger->logger('Running async callable');
@ -114,7 +116,7 @@ trait Loop
$this->logger->logger("Added unlock callback with id $id!");
if ($needs_restart) {
$this->logger->logger("Adding restart callback!");
$id = Shutdown::addCallback(static function () use(&$logger) {
$id = Shutdown::addCallback(static function () use (&$logger) {
$address = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'tls' : 'tcp') . '://' . $_SERVER['SERVER_NAME'];
$port = $_SERVER['SERVER_PORT'];
$uri = $_SERVER['REQUEST_URI'];
@ -191,7 +193,7 @@ trait Loop
*
* @return Promise
*/
public function loopFork() : Promise
public function loopFork(): Promise
{
return Tools::callFork($this->loop());
}

View File

@ -42,7 +42,7 @@ class FileIdTest extends TestCase
}
/**
* Teardown
* Teardown.
*
* @return void
*/

View File

@ -38,6 +38,30 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
---
'.\str_replace('<img', '<amp-img', \file_get_contents('README.md')));
$layer_list = '';
$tempRes = \glob("$d/src/danog/MadelineProto/TL_telegram_*");
$res = [];
foreach ($tempRes as $file) {
$layer = \preg_replace(['/.*telegram_v/', '/\..+/'], '', $file);
$res[$layer] = $file;
}
\ksort($res);
foreach (\array_slice($res, 0, -1) as $layer => $file) {
$layer = "v$layer";
$docs[] = [
'tl_schema' => ['telegram' => $file],
'title' => 'MadelineProto API documentation (layer '.$layer.')',
'description' => 'MadelineProto API documentation (layer '.$layer.')',
'output_dir' => "$d/docs/old_docs/API_docs_".$layer,
'readme' => true,
];
$layer_list .= '[Layer '.$layer.'](API_docs_'.$layer.'/)
';
}
$layer = \array_keys($res);
$layer = \end($layer);
$docs = [
/* [
'tl_schema' => ['td' => "$d/src/danog/MadelineProto/TL_td.tl"],
@ -55,27 +79,17 @@ $docs = [
'readme' => false,
],
[
'tl_schema' => ['telegram' => "$d/src/danog/MadelineProto/TL_telegram_v105.tl", 'calls' => "$d/src/danog/MadelineProto/TL_calls.tl", 'secret' => "$d/src/danog/MadelineProto/TL_secret.tl", 'td' => "$d/src/danog/MadelineProto/TL_td.tl"],
'title' => 'MadelineProto API documentation (layer 105)',
'description' => 'MadelineProto API documentation (layer 105)',
'tl_schema' => ['telegram' => "$d/src/danog/MadelineProto/TL_telegram_v$layer.tl", 'calls' => "$d/src/danog/MadelineProto/TL_calls.tl", 'secret' => "$d/src/danog/MadelineProto/TL_secret.tl", 'td' => "$d/src/danog/MadelineProto/TL_td.tl"],
'title' => "MadelineProto API documentation (layer $layer)",
'description' => "MadelineProto API documentation (layer $layer)",
'output_dir' => "$d/docs/docs/API_docs",
'readme' => false,
],
];
$layer_list = '';
foreach (\array_slice(\glob("$d/src/danog/MadelineProto/TL_telegram_*"), 0, -1) as $file) {
$layer = \preg_replace(['/.*telegram_/', '/\..+/'], '', $file);
$docs[] = [
'tl_schema' => ['telegram' => $file],
'title' => 'MadelineProto API documentation (layer '.$layer.')',
'description' => 'MadelineProto API documentation (layer '.$layer.')',
'output_dir' => "$d/docs/old_docs/API_docs_".$layer,
'readme' => true,
];
$layer_list = '[Layer '.$layer.'](API_docs_'.$layer.'/)
';
}
$doc = \file_get_contents('docs/docs/docs/USING_METHODS.md');
$doc = \preg_replace('|here \(layer \d+\)|', "here (layer $layer)", $doc);
\file_put_contents('docs/docs/docs/USING_METHODS.md', $doc);
\file_put_contents('docs/old_docs/README.md', '---
title: Documentations of old mtproto layers