This commit is contained in:
Daniil Gentili 2018-03-20 15:02:36 +00:00
parent ba9b397ddf
commit e39ce11798
20 changed files with 60 additions and 0 deletions

View File

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

View File

@ -39,5 +39,8 @@ $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) 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 * Completeness: small
* Speed: very fast
* Caching: full
<button href="https://docs.madelineproto.xyz/docs/DIALOGS.html">Next section</button> <button href="https://docs.madelineproto.xyz/docs/DIALOGS.html">Next section</button>

View File

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

View File

@ -26,5 +26,8 @@ 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> <button href="https://docs.madelineproto.xyz/docs/INLINE_BUTTONS.html">Next section</button>

View File

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

View File

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

View File

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

View File

@ -9,4 +9,7 @@ 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 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> <button href="https://docs.madelineproto.xyz/docs/LOGGING.html">Next section</button>

View File

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

View File

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

View File

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

View File

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

View File

@ -14,4 +14,7 @@ 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). 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> <button href="https://docs.madelineproto.xyz/docs/PROXY.html">Next section</button>

View File

@ -118,4 +118,7 @@ Works like [socket_getsockname](http://php.net/manual/en/function.socket-getsock
`public function getProxyHeaders();` `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> <button href="https://docs.madelineproto.xyz/docs/CONTRIBUTING.html">Next section</button>

View File

@ -11,4 +11,7 @@ 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 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> <button href="https://docs.madelineproto.xyz/docs/INSTALLATION.html">Next section</button>

View File

@ -64,5 +64,8 @@ $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> <button href="https://docs.madelineproto.xyz/docs/LUA.html">Next section</button>

View File

@ -6,4 +6,7 @@ $me = $MadelineProto->get_self();
\danog\MadelineProto\Logger::log("Hi ".$me['first_name']."!"); \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> <button href="https://docs.madelineproto.xyz/docs/EXCEPTIONS.html">Next section</button>

View File

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

View File

@ -193,4 +193,7 @@ $MadelineProto->loop(-1);
This way, each update will be managed in its own fork. 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. 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> <button href="https://docs.madelineproto.xyz/docs/SETTINGS.html">Next section</button>

View File

@ -96,4 +96,7 @@ Method calls may be executed at diferent times server-side: to avoid this, metho
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => 'lel'], ['queue' => 'queue_name']); $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> <button href="https://docs.madelineproto.xyz/docs/FILES.html">Next section</button>