Add next button

This commit is contained in:
Daniil Gentili 2018-03-20 14:51:22 +00:00
parent 1b349d93da
commit 73b59613f6
21 changed files with 36 additions and 28 deletions

View File

@ -51,9 +51,17 @@ foreach ($files as $file) {
ksort($orderedfiles);
}
ksort($orderedfiles);
foreach ($orderedfiles as $filename) {
foreach ($orderedfiles as $key => $filename) {
$lines = explode("\n", file_get_contents($filename));
if (strpos(end($lines), "Next")) unset($lines[count($lines)-1]);
if (strpos(end($lines), "Next")) {
unset($lines[count($lines)-1]);
unset($lines[count($lines)-2]);
}
if (isset($orderedfiles[$key+1])) {
$nextfile = "https://docs.madelineproto.xyz/docs/".basename($orderedfiles[$key+1], '.md').".html";
$lines[count($lines)] = "\n<button href=\"$nextfile\">Next section</button>";
}
file_put_contents($filename, implode("\n", $lines));
preg_match('|^# (.*)|', $file = file_get_contents($filename), $matches);
$title = $matches[1];

View File

@ -113,4 +113,4 @@ foreach ($updates as $update) {
<button href="https://docs.madelineproto.xyz/docs/SECRET_CHATS.html">Next section</button>

View File

@ -39,5 +39,5 @@ $chat = $MadelineProto->get_info(-10028941842);
You can also use `get_info` to get chat info, see [here for the parameters and the result](https://docs.madelineproto.xyz/get_info.html)
* Completeness: small
* Speed: very fast
* Caching: full
<button href="https://docs.madelineproto.xyz/docs/DIALOGS.html">Next section</button>

View File

@ -17,5 +17,5 @@ $MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings); /
To change the session file after starting MadelineProto, do the following:
```php
$MadelineProto->session = 'newsession.madeline';
```
<button href="https://docs.madelineproto.xyz/docs/LOGIN.html">Next section</button>

View File

@ -26,5 +26,5 @@ foreach ($MadelineProto->API->chats as $bot_api_id => $chat) {
}
```
Since bots cannot run `get_dialogs`, you must make use of the internal MadelineProto database to get a list of all users, chats and channels MadelineProto has seen.
`$MadelineProto->API->chats` contains a list of [Chat](../API_docs/types/Chat.md) and [User](../API_docs/types/User.md) objects, indexed by bot API id.
<button href="https://docs.madelineproto.xyz/docs/INLINE_BUTTONS.html">Next section</button>

View File

@ -99,5 +99,5 @@ try {
$estring2 = 'This also works: '.$e;
$estring3 = "So does this: $e";
// use $estring to report the error using sendMessage or log
}
```
<button href="https://docs.madelineproto.xyz/docs/FLOOD_WAIT.html">Next section</button>

View File

@ -40,4 +40,4 @@
* [Clickable inline buttons](#inline-buttons)!
<button href="https://docs.madelineproto.xyz/docs/REQUIREMENTS.html">Next section</button>

View File

@ -423,5 +423,5 @@ $sentMessage = $MadelineProto->messages->sendMedia([
$output_file_name = $MadelineProto->download_to_file(
new MyCallback($sentMessage, $peer, $MadelineProto),
'/tmp/myname.mp4'
);
```
<button href="https://docs.madelineproto.xyz/docs/CHAT_INFO.html">Next section</button>

View File

@ -9,4 +9,4 @@ Calculate it by making N of method calls until you get a FLOOD_WAIT_X
floodwaitrate = time it took you to make the method calls + X
```
Use sleep to execute max N calls in `floodwaitrate` seconds, this way you won't get flood waited!
<button href="https://docs.madelineproto.xyz/docs/LOGGING.html">Next section</button>

View File

@ -48,5 +48,5 @@ And click them:
```php
$button->click();
```
<button href="https://docs.madelineproto.xyz/docs/CALLS.html">Next section</button>

View File

@ -119,4 +119,4 @@ cp -a *php tests userbots .env* ..
Now open `.env` and edit its values as needed.
<button href="https://docs.madelineproto.xyz/docs/UPDATES.html">Next section</button>

View File

@ -14,4 +14,4 @@ MadelineProto provides a unified class for logging messages to the logging desti
* `\danog\MadelineProto\Logger:VERBOSE` - Indicates a verbose info message
* `\danog\MadelineProto\Logger:ULTRA_VERBOSE` - Indicates an ultra verbose
By default, `$level` is `\danog\MadelineProto\Logger:NOTICE`.
<button href="https://docs.madelineproto.xyz/docs/USING_METHODS.html">Next section</button>

View File

@ -57,4 +57,4 @@ $MadelineProto->logout();
Use `logout` to logout, see [here for the parameters and the result](https://docs.madelineproto.xyz/logout.html).
<button href="https://docs.madelineproto.xyz/docs/FEATURES.html">Next section</button>

View File

@ -14,4 +14,4 @@ Passing lua callables to a parameter of a PHP callable will throw an exception d
All MadelineProto wrapper methods (for example upload, download, upload_encrypted, get_self, and others) are imported in the Lua environment, as well as all MTProto wrappers (see the API docs for more info).
td-cli wrappers are also present: you can use the tdcli_function in lua and pass mtproto updates to the tdcli_update_callback via PHP, they will be automatically converted to/from td objects. Please note that the object conversion is not complete, feel free to contribute to the conversion module in [`src/danog/MadelineProto/Conversion/TD.php`](https://github.com/danog/MadelineProto/raw/master/src/danog/MadelineProto/TL/Conversion/TD.php).
<button href="https://docs.madelineproto.xyz/docs/PROXY.html">Next section</button>

View File

@ -118,4 +118,4 @@ Works like [socket_getsockname](http://php.net/manual/en/function.socket-getsock
`public function getProxyHeaders();`
Can return additional HTTP headers to use when the HTTP protocol is being used.
<button href="https://docs.madelineproto.xyz/docs/CONTRIBUTING.html">Next section</button>

View File

@ -11,4 +11,4 @@ sudo apt-get update
sudo apt-get install php7.2 php7.2-dev php7.2-fpm php7.2-curl php7.2-xml php7.2-zip php7.2-gmp git -y
```
Next, follow the instructions on voip.madelineproto.xyz and prime.madelineproto.xyz to install libtgvoip and PrimeModule.
<button href="https://docs.madelineproto.xyz/docs/INSTALLATION.html">Next section</button>

View File

@ -64,5 +64,5 @@ $secret_chat = $MadelineProto->get_secret_chat($chat);
*/
```
This method gets info about a certain chat.
<button href="https://docs.madelineproto.xyz/docs/LUA.html">Next section</button>

View File

@ -6,4 +6,4 @@ $me = $MadelineProto->get_self();
\danog\MadelineProto\Logger::log("Hi ".$me['first_name']."!");
```
[`get_self`](https://docs.madelineproto.xyz/get_self.html) returns a [User object](API_docs/types/User.md) that contains info about the currently logged in user/bot, or false if the current instance is not logged in.
<button href="https://docs.madelineproto.xyz/docs/EXCEPTIONS.html">Next section</button>

View File

@ -394,5 +394,5 @@ $MadelineProto->settings = [
The settings array can be accessed and modified in the instantiated class by accessing the `settings` attribute of the API class:
```php
$MadelineProto->settings['updates']['handle_updates'] = true; // reenable update fetching
```
<button href="https://docs.madelineproto.xyz/docs/SELF.html">Next section</button>

View File

@ -193,4 +193,4 @@ $MadelineProto->loop(-1);
This way, each update will be managed in its own fork.
Note that multiprocessing is not the same as multithreading, and should be avoided unless lengthy operations are made in the update handler.
<button href="https://docs.madelineproto.xyz/docs/SETTINGS.html">Next section</button>

View File

@ -96,4 +96,4 @@ Method calls may be executed at diferent times server-side: to avoid this, metho
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => 'lel'], ['queue' => 'queue_name']);
```
If the queue if the specified queue name does not exist, it will be created.
<button href="https://docs.madelineproto.xyz/docs/FILES.html">Next section</button>