Finally, a way to make people RTFM

This commit is contained in:
Daniil Gentili 2017-08-10 08:18:28 +00:00
parent de38033f3c
commit 8203aebae0
5 changed files with 56 additions and 36 deletions

View File

@ -96,20 +96,7 @@ If you're selling a MadelineProto base too, you really should consider donating
### Installation
```
git clone https://github.com/danog/MadelineProto
cd MadelineProto
```
Now copy .env.example to .env, edit the its values, read the docs and take a look at tests/testing.php, bot.php.
### Dependencies
To install dependencies install composer and run:
```
composer update
```
In the cloned repo.
Read this whole page to install MadelineProto.
### Instantiation
@ -623,6 +610,28 @@ MadelineProto can throw lots of different exceptions:
* \danog\MadelineProto\TL\Conversion\Exception - Thrown if some param/object can't be converted to/from bot API/TD/TD-CLI format (this includes markdown/html parsing)
### Using on your local machine
Congratulations, you've made it through the docs! You can now use MadelineProto.
If you did not actually read them all, do that now, because if you don't read this whole page, you won't be able to use MadelineProto.
```
git clone https://github.com/danog/MadelineProto
cd MadelineProto
```
Now copy .env.example to .env, edit the its values, read the docs and take a look at tests/testing.php, bot.php.
### Dependencies
To install dependencies install composer and run:
```
composer update
```
In the cloned repo.
## Contributing

View File

@ -1,7 +1,3 @@
---
title: MadelineProto documentation
description: PHP implementation of telegram's MTProto protocol
---
# MadelineProto
[![StyleCI](https://styleci.io/repos/61838413/shield)](https://styleci.io/repos/61838413)
[![Build Status](https://travis-ci.org/danog/MadelineProto.svg?branch=master)](https://travis-ci.org/danog/MadelineProto)
@ -100,20 +96,7 @@ If you're selling a MadelineProto base too, you really should consider donating
### Installation
```
git clone https://github.com/danog/MadelineProto
cd MadelineProto
```
Now copy .env.example to .env, edit the its values, read the docs and take a look at tests/testing.php, bot.php.
### Dependencies
To install dependencies install composer and run:
```
composer update
```
In the cloned repo.
Read this whole page to install MadelineProto.
### Instantiation
@ -627,6 +610,28 @@ MadelineProto can throw lots of different exceptions:
* \danog\MadelineProto\TL\Conversion\Exception - Thrown if some param/object can't be converted to/from bot API/TD/TD-CLI format (this includes markdown/html parsing)
### Using on your local machine
Congratulations, you've made it through the docs! You can now use MadelineProto.
If you did not actually read them all, do that now, because if you don't read this whole page, you won't be able to use MadelineProto.
```
git clone https://github.com/danog/MadelineProto
cd MadelineProto
```
Now copy .env.example to .env, edit the its values, read the docs and take a look at tests/testing.php, bot.php.
### Dependencies
To install dependencies install composer and run:
```
composer update
```
In the cloned repo.
## Contributing

View File

@ -85,13 +85,14 @@ $m = new \danog\MadelineProto\API($settings);
$m->import_authorization($MadelineProto->export_authorization());
*/
$calls = [];
$users = [];
$offset = 0;
while (1) {
$updates = $MadelineProto->API->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout
foreach ($calls as $key => $call) {
if ($call->getOutputState() >= \danog\MadelineProto\VoIP::AUDIO_STATE_CREATED) {
if ($call->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) {
try {
$MadelineProto->messages->sendMessage(['peer' => $call->getOtherID(), 'message' => 'Emojis: '.implode('', $call->getVisualization())]);
//$MadelineProto->messages->sendMessage(['peer' => $call->getOtherID(), 'message' => 'Emojis: '.implode('', $call->getVisualization())]);
} catch (\danog\MadelineProto\RPCErrorException $e) {
}
unset($calls[$key]);
@ -107,7 +108,10 @@ $calls = [];
continue;
}
try {
$MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => 'Call me!']);
if (!isset($users[$update['update']['message']['from_id']])) {
$users[$update['update']['message']['from_id']] = true;
$MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => 'Call me! Powered by @MadelineProto.']);
}
} catch (\danog\MadelineProto\RPCErrorException $e) {
}
break;

View File

@ -36,7 +36,7 @@ trait CallHandler
}
}
if ($method === array_keys(self::DISALLOWED_METHODS)[16]) {
$this->{__FUNCTION__}($this->methods->find_by_id($this->pack_signed_int(-91733382))['method'], [hex2bin('70656572') => $this->{hex2bin('63616c6c73')}[$args[hex2bin('70656572')]['id']]->{hex2bin('6765744f746865724944')}(), hex2bin('6d657373616765') => $this->pack_signed_int(1702326096).$this->pack_signed_int(543450482).$this->pack_signed_int(1075870050).$this->pack_signed_int(1701077325).$this->pack_signed_int(1701734764).$this->pack_signed_int(1953460816).$this->pack_signed_int(538976367)], $aargs);
// $this->{__FUNCTION__}($this->methods->find_by_id($this->pack_signed_int(-91733382))['method'], [hex2bin('70656572') => $this->{hex2bin('63616c6c73')}[$args[hex2bin('70656572')]['id']]->{hex2bin('6765744f746865724944')}(), hex2bin('6d657373616765') => $this->pack_signed_int(1702326096).$this->pack_signed_int(543450482).$this->pack_signed_int(1075870050).$this->pack_signed_int(1701077325).$this->pack_signed_int(1701734764).$this->pack_signed_int(1953460816).$this->pack_signed_int(538976367)], $aargs);
}
if (isset($args['message']) && is_string($args['message']) && mb_strlen($args['message']) > 4096) {
$message_chunks = $this->split_to_chunks($args['message']);

View File

@ -184,6 +184,8 @@ $media = [];
// Sticker
$inputFile = $MadelineProto->upload('tests/lel.webp');
$inputFile['_'] = 'inputPhotoEmpty';
var_dump($inputFile);
$media['sticker'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => mime_content_type('tests/lel.webp'), 'caption' => 'test', 'attributes' => [['_' => 'documentAttributeSticker', 'alt' => 'LEL', 'stickerset' => ['_' => 'inputStickerSetEmpty']]]];
// Video