mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-22 22:51:11 +01:00
Update docs
This commit is contained in:
parent
c0e742f147
commit
46b593f01b
34
README.md
34
README.md
@ -36,16 +36,21 @@ $me = $MadelineProto->getSelf();
|
||||
$MadelineProto->logger($me);
|
||||
|
||||
if (!$me['bot']) {
|
||||
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => "Hi!\nThanks for creating MadelineProto! <3"]);
|
||||
$MadelineProto->channels->joinChannel(['channel' => '@MadelineProto']);
|
||||
// This example uses PHP 8.0+ syntax with named arguments
|
||||
$MadelineProto->messages->sendMessage(peer: '@danogentili', message: "Hi!\nThanks for creating MadelineProto (PHP 8)! <3"]);
|
||||
|
||||
// This example uses PHP 7.1+ syntax with arrays
|
||||
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => "Hi!\nThanks for creating MadelineProto (PHP 7)! <3"]);
|
||||
|
||||
$MadelineProto->channels->joinChannel(channel: '@MadelineProto');
|
||||
|
||||
try {
|
||||
$MadelineProto->messages->importChatInvite(['hash' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg']);
|
||||
$MadelineProto->messages->importChatInvite(hash: 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg');
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
$MadelineProto->logger($e);
|
||||
}
|
||||
|
||||
$MadelineProto->messages->sendMessage(['peer' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg', 'message' => 'Testing MadelineProto!']);
|
||||
$MadelineProto->messages->sendMessage(peer: 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg', message: 'Testing MadelineProto!');
|
||||
}
|
||||
$MadelineProto->echo('OK, done!');
|
||||
```
|
||||
@ -186,7 +191,7 @@ You can find examples for nearly every MadelineProto function in
|
||||
* [Async sleep](https://docs.madelineproto.xyz/docs/ASYNC.html#async-sleep-does-not-block-the-main-thread)
|
||||
* [Async readline](https://docs.madelineproto.xyz/docs/ASYNC.html#async-readline-does-not-block-the-main-thread)
|
||||
* [Async echo](https://docs.madelineproto.xyz/docs/ASYNC.html#async-echo-does-not-block-the-main-thread)
|
||||
* [MadelineProto artax HTTP client](https://docs.madelineproto.xyz/docs/ASYNC.html#madelineproto-artax-http-client)
|
||||
* [MadelineProto HTTP client](https://docs.madelineproto.xyz/docs/ASYNC.html#madelineproto-http-client)
|
||||
* [Async forking](https://docs.madelineproto.xyz/docs/ASYNC.html#async-forking-does-green-thread-forking)
|
||||
* [Async flock](https://docs.madelineproto.xyz/docs/ASYNC.html#async-flock)
|
||||
* [Combining async operations](https://docs.madelineproto.xyz/docs/ASYNC.html#combining-async-operations)
|
||||
@ -198,6 +203,16 @@ You can find examples for nearly every MadelineProto function in
|
||||
* [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)
|
||||
* [Named arguments (PHP 8+)](https://docs.madelineproto.xyz/docs/USING_METHODS.html#named-arguments)
|
||||
* [Peers](https://docs.madelineproto.xyz/docs/USING_METHODS.html#peers)
|
||||
* [Files](https://docs.madelineproto.xyz/docs/FILES.html)
|
||||
* [Secret chats](https://docs.madelineproto.xyz/docs/USING_METHODS.html#secret-chats)
|
||||
* [Entities (Markdown & HTML)](https://docs.madelineproto.xyz/docs/USING_METHODS.html#entities)
|
||||
* [reply_markup (keyboards & inline keyboards)](https://docs.madelineproto.xyz/docs/USING_METHODS.html#reply_markup)
|
||||
* [bot API objects](https://docs.madelineproto.xyz/docs/USING_METHODS.html#bot-api-objects)
|
||||
* [No result](https://docs.madelineproto.xyz/docs/USING_METHODS.html#no-result)
|
||||
* [Queues](https://docs.madelineproto.xyz/docs/USING_METHODS.html#queues)
|
||||
* [Multiple method calls](https://docs.madelineproto.xyz/docs/USING_METHODS.html#multiple-method-calls)
|
||||
* [FULL API Documentation with descriptions](https://docs.madelineproto.xyz/API_docs/methods/)
|
||||
* [Logout](https://docs.madelineproto.xyz/logout.html)
|
||||
* [Login](https://docs.madelineproto.xyz/docs/LOGIN.html)
|
||||
@ -595,15 +610,6 @@ You can find examples for nearly every MadelineProto function in
|
||||
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.updateDeviceLocked.html" name="account.updateDeviceLocked">When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications: account.updateDeviceLocked</a>
|
||||
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getContactSignUpNotification.html" name="account.getContactSignUpNotification">Whether the user will receive notifications when contacts sign up: account.getContactSignUpNotification</a>
|
||||
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.unpinAllMessages.html" name="messages.unpinAllMessages">Unpin all pinned messages: messages.unpinAllMessages</a>
|
||||
* [Peers](https://docs.madelineproto.xyz/docs/USING_METHODS.html#peers)
|
||||
* [Files](https://docs.madelineproto.xyz/docs/FILES.html)
|
||||
* [Secret chats](https://docs.madelineproto.xyz/docs/USING_METHODS.html#secret-chats)
|
||||
* [Entities (Markdown & HTML)](https://docs.madelineproto.xyz/docs/USING_METHODS.html#entities)
|
||||
* [reply_markup (keyboards & inline keyboards)](https://docs.madelineproto.xyz/docs/USING_METHODS.html#reply_markup)
|
||||
* [bot API objects](https://docs.madelineproto.xyz/docs/USING_METHODS.html#bot-api-objects)
|
||||
* [No result](https://docs.madelineproto.xyz/docs/USING_METHODS.html#no-result)
|
||||
* [Queues](https://docs.madelineproto.xyz/docs/USING_METHODS.html#queues)
|
||||
* [Multiple method calls](https://docs.madelineproto.xyz/docs/USING_METHODS.html#multiple-method-calls)
|
||||
* [Contributing](https://docs.madelineproto.xyz/docs/CONTRIB.html)
|
||||
* [Translation](https://docs.madelineproto.xyz/docs/CONTRIB.html#translation)
|
||||
* [Contribution guide](https://docs.madelineproto.xyz/docs/CONTRIB.html#contribution-guide)
|
||||
|
2
docs
2
docs
@ -1 +1 @@
|
||||
Subproject commit d42533632b84d3c1ac4b121b2462b2797cb7b5b0
|
||||
Subproject commit 66534a555ecf7967127876d21cb84b2e300db6d9
|
@ -27,6 +27,7 @@ class DocsBuilder
|
||||
{
|
||||
const DEFAULT_TEMPLATES = [
|
||||
'User' => ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputDialogPeer', 'DialogPeer', 'InputPeer', 'NotifyPeer', 'InputNotifyPeer'],
|
||||
'ReplyMarkup' => ['ReplyMarkup'],
|
||||
'InputFile' => ['InputFile', 'InputEncryptedFile'],
|
||||
'InputEncryptedChat' => ['InputEncryptedChat'],
|
||||
'PhoneCall' => ['PhoneCall'],
|
||||
|
@ -203,13 +203,13 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png'.$redi
|
||||
';
|
||||
$example = '';
|
||||
if (!isset($this->settings['td'])) {
|
||||
$example = $this->template('constructor-example', \str_replace('.', '_', $constructor.$layer), $params, $lua_params);
|
||||
if ($hasreplymarkup) {
|
||||
$example .= $this->template('reply_markup');
|
||||
$example = $this->template('reply_markup');
|
||||
}
|
||||
if ($hasentities) {
|
||||
$example .= $this->template('parse_mode');
|
||||
$example = $this->template('parse_mode');
|
||||
}
|
||||
$example .= $this->template('constructor-example', \str_replace('.', '_', $constructor.$layer), $params, $lua_params);
|
||||
}
|
||||
\file_put_contents('constructors/'.$constructor.$layer.'.md', $header.$table.$type.$example);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ trait Methods
|
||||
$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] = '['.StrTools::markdownEscape($param[$type_or_subtype]).'](/API_docs/'.$type_or_bare_type.'/'.$param[$type_or_subtype].'.md)';
|
||||
$params .= "'".$param['name']."' => ".(isset($param['subtype']) ? '\\['.$param[$type_or_subtype].'\\]' : $param[$type_or_subtype]).', ';
|
||||
$params .= $param['name'].": ".(isset($param['subtype']) ? '\\['.$param[$type_or_subtype].'\\]' : $param[$type_or_subtype]).', ';
|
||||
}
|
||||
if (!isset($this->tdDescriptions['methods'][$method])) {
|
||||
$this->addToLang('method_'.$method);
|
||||
@ -178,7 +178,7 @@ trait Methods
|
||||
$pptype = \in_array($ptype, ['string', 'bytes']) ? "'".$ptype."'" : $ptype;
|
||||
$ppptype = \in_array($ptype, ['string']) ? '"'.$ptype.'"' : $ptype;
|
||||
$ppptype = \in_array($ptype, ['bytes']) ? '{"_": "bytes", "bytes":"base64 encoded '.$ptype.'"}' : $ppptype;
|
||||
$params .= "'".$param['name']."' => ";
|
||||
$params .= $param['name'].": ";
|
||||
$params .= (isset($param['subtype']) ? '['.$pptype.', '.$pptype.']' : $pptype).', ';
|
||||
$json_params .= '"'.$param['name'].'": '.(isset($param['subtype']) ? '['.$ppptype.']' : $ppptype).', ';
|
||||
$pwr_params .= $param['name'].' - Json encoded '.(isset($param['subtype']) ? ' array of '.$ptype : $ptype)."\n\n";
|
||||
@ -194,7 +194,7 @@ trait Methods
|
||||
$hasentities = true;
|
||||
$table .= '|parse\\_mode| [string](/API_docs/types/string.md) | Whether to parse HTML or Markdown markup in the message| Optional |
|
||||
';
|
||||
$params .= "'parse_mode' => 'string', ";
|
||||
$params .= "parse_mode: 'string', ";
|
||||
$lua_params .= "parseMode='string', ";
|
||||
$json_params .= '"parseMode": "string"';
|
||||
$pwr_params = "parseMode - string\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user