mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 06:18:58 +01:00
Update docs
This commit is contained in:
parent
051ac64d81
commit
1b349d93da
12
README.md
12
README.md
@ -29,6 +29,13 @@ $MadelineProto->start();
|
||||
|
||||
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => "Hi!\nThanks for creating MadelineProto! <3"]);
|
||||
$MadelineProto->channels->joinChannel(['channel' => '@MadelineProto']);
|
||||
|
||||
try {
|
||||
$MadelineProto->messages->importChatInvite(['hash' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg']);
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
}
|
||||
|
||||
$MadelineProto->messages->sendMessage(['peer' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg', 'message' => 'Testing MadelineProto!']);
|
||||
```
|
||||
|
||||
Run this code in a browser or in a console.
|
||||
@ -66,6 +73,7 @@ Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgro
|
||||
* [List of exception types](https://docs.madelineproto.xyz/docs/EXCEPTIONS.html#list-of-exception-types)
|
||||
* [Pretty TL trace](https://docs.madelineproto.xyz/docs/EXCEPTIONS.html#pretty-tl-trace)
|
||||
* [Getting the TL trace](https://docs.madelineproto.xyz/docs/EXCEPTIONS.html#getting-the-tl-trace)
|
||||
* [Avoiding FLOOD_WAITs](https://docs.madelineproto.xyz/docs/FLOOD_WAIT.html)
|
||||
* [Logging](https://docs.madelineproto.xyz/docs/LOGGING.html)
|
||||
* [Using methods](https://docs.madelineproto.xyz/docs/USING_METHODS.html)
|
||||
* [Peers](https://docs.madelineproto.xyz/docs/USING_METHODS.html#peers)
|
||||
@ -116,6 +124,10 @@ Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgro
|
||||
* [Sending secret messages](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html#sending-secret-messages)
|
||||
* [Lua binding](https://docs.madelineproto.xyz/docs/LUA.html)
|
||||
* [Using a proxy](https://docs.madelineproto.xyz/docs/PROXY.html)
|
||||
* [Contributing](https://docs.madelineproto.xyz/docs/CONTRIBUTING.html)
|
||||
* [Translation](https://docs.madelineproto.xyz/docs/CONTRIBUTING.html#translation)
|
||||
* [Contribution guide](https://docs.madelineproto.xyz/docs/CONTRIBUTING.html#contribution-guide)
|
||||
* [Credits](https://docs.madelineproto.xyz/docs/CONTRIBUTING.html#credits)
|
||||
|
||||
|
||||
## Very complex and complete examples
|
||||
|
@ -21,32 +21,40 @@ foreach ($files as $file) {
|
||||
$orderedfiles[7] = $file;
|
||||
} else if ($base === 'EXCEPTIONS') {
|
||||
$orderedfiles[8] = $file;
|
||||
} else if ($base === 'LOGGING') {
|
||||
} else if ($base === 'FLOOD_WAIT') {
|
||||
$orderedfiles[9] = $file;
|
||||
} else if ($base === 'USING_METHODS') {
|
||||
} else if ($base === 'LOGGING') {
|
||||
$orderedfiles[10] = $file;
|
||||
} else if ($base === 'FILES') {
|
||||
} else if ($base === 'USING_METHODS') {
|
||||
$orderedfiles[11] = $file;
|
||||
} else if ($base === 'CHAT_INFO') {
|
||||
} else if ($base === 'FILES') {
|
||||
$orderedfiles[12] = $file;
|
||||
} else if ($base === 'DIALOGS') {
|
||||
} else if ($base === 'CHAT_INFO') {
|
||||
$orderedfiles[13] = $file;
|
||||
} else if ($base === 'INLINE_BUTTONS') {
|
||||
} else if ($base === 'DIALOGS') {
|
||||
$orderedfiles[14] = $file;
|
||||
} else if ($base === 'CALLS') {
|
||||
} else if ($base === 'INLINE_BUTTONS') {
|
||||
$orderedfiles[15] = $file;
|
||||
} else if ($base === 'SECRET_CHATS') {
|
||||
} else if ($base === 'CALLS') {
|
||||
$orderedfiles[16] = $file;
|
||||
} else if ($base === 'LUA') {
|
||||
} else if ($base === 'SECRET_CHATS') {
|
||||
$orderedfiles[17] = $file;
|
||||
} else if ($base === 'PROXY') {
|
||||
} else if ($base === 'LUA') {
|
||||
$orderedfiles[18] = $file;
|
||||
} else if ($base === 'PROXY') {
|
||||
$orderedfiles[19] = $file;
|
||||
} else if ($base === 'CONTRIBUTING') {
|
||||
$orderedfiles[20] = $file;
|
||||
} else {
|
||||
$orderedfiles[] = $file;
|
||||
}
|
||||
ksort($orderedfiles);
|
||||
}
|
||||
ksort($orderedfiles);
|
||||
foreach ($orderedfiles as $filename) {
|
||||
$lines = explode("\n", file_get_contents($filename));
|
||||
if (strpos(end($lines), "Next")) unset($lines[count($lines)-1]);
|
||||
|
||||
preg_match('|^# (.*)|', $file = file_get_contents($filename), $matches);
|
||||
$title = $matches[1];
|
||||
preg_match_all('|( *)\* \[(.*)\]\(#(.*)\)|', $file, $matches);
|
||||
|
12
docs/docs/FLOOD_WAIT.md
Normal file
12
docs/docs/FLOOD_WAIT.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Avoiding FLOOD_WAITs
|
||||
|
||||
If you make too many requests to telegram, you might get FLOOD_WAITed for a while.
|
||||
To avoid these flood waits, you must calculate the flood wait rate.
|
||||
|
||||
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!
|
@ -1,6 +1,6 @@
|
||||
# Requirements
|
||||
|
||||
MadelineProto requires the `xml`, `gmp` extensions to function properly.
|
||||
MadelineProto requires the `xml`, `gmp`, `curl` extensions to function properly.
|
||||
|
||||
To install MadelineProto dependencies on `Ubuntu`, `Debian`, `Devuan`, or any other `Debian-based` distro, run the following command in your command line:
|
||||
|
||||
|
@ -33,10 +33,20 @@ $MadelineProto->start();
|
||||
|
||||
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => "Hi!\nThanks for creating MadelineProto! <3"]);
|
||||
$MadelineProto->channels->joinChannel(['channel' => '@MadelineProto']);
|
||||
|
||||
try {
|
||||
$MadelineProto->messages->importChatInvite(['hash' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg']);
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
}
|
||||
|
||||
$MadelineProto->messages->sendMessage(['peer' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg', 'message' => 'Testing MadelineProto!']);
|
||||
```
|
||||
|
||||
Run this code in a browser or in a console.
|
||||
|
||||
|
||||
Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgroup) the error message and the `Madeline.log` file that was created in the same directory (if running from a browser).
|
||||
|
||||
## Documentation
|
||||
|
||||
* [Creating a client](https://docs.madelineproto.xyz/docs/CREATING_A_CLIENT.html)
|
||||
|
@ -122,6 +122,10 @@ trait AuthKeyHandler
|
||||
|
||||
if (!$pq->equals($p->multiply($q))) {
|
||||
\danog\MadelineProto\Logger::log('Automatic factorization failed, trying wolfram module', \danog\MadelineProto\Logger::ERROR);
|
||||
if (!extension_loaded('xml')) {
|
||||
throw new Exception(['extension', 'curl']);
|
||||
}
|
||||
|
||||
$p = new \phpseclib\Math\BigInteger(\danog\PrimeModule::wolfram_single($pq->__toString()));
|
||||
if (!$p->equals($this->zero)) {
|
||||
$q = $pq->divide($p)[0];
|
||||
|
Loading…
Reference in New Issue
Block a user