This commit is contained in:
Daniil Gentili 2017-07-26 10:35:12 +02:00
parent e72d941671
commit 2e92a8ed20
5 changed files with 9 additions and 6 deletions

View File

@ -30,7 +30,7 @@ try {
//var_dump($MadelineProto->API->get_config([], ['datacenter' => $MadelineProto->API->datacenter->curdc])); //var_dump($MadelineProto->API->get_config([], ['datacenter' => $MadelineProto->API->datacenter->curdc]));
//var_dump($MadelineProto->API->settings['connection']); //var_dump($MadelineProto->API->settings['connection']);
echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('bot.madeline', $MadelineProto).' bytes'.PHP_EOL; echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('bot.madeline', $MadelineProto).' bytes'.PHP_EOL;
$MadelineProto->messages->sendMessage(['peer' => ['_' => 'inputPeerChat'], 'message' => '']);
$offset = 0; $offset = 0;
while (true) { while (true) {
$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 $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

View File

@ -44,7 +44,7 @@ class MTProto extends \Volatile
use \danog\MadelineProto\Wrappers\DialogHandler; use \danog\MadelineProto\Wrappers\DialogHandler;
use \danog\MadelineProto\Wrappers\Login; use \danog\MadelineProto\Wrappers\Login;
const V = 60; const V = 61;
const NOT_LOGGED_IN = 0; const NOT_LOGGED_IN = 0;
const WAITING_CODE = 1; const WAITING_CODE = 1;

View File

@ -18,7 +18,7 @@ class Exception extends \Exception
public function __toString() public function __toString()
{ {
return get_class($this).($this->message !== '' ? ': ' : '').$this->message.PHP_EOL.'TL Trace'.PHP_EOL.PHP_EOL.$this->getTLTrace().PHP_EOL; return get_class($this).($this->message !== '' ? ': ' : '').$this->message.PHP_EOL.'TL Trace:'.PHP_EOL.PHP_EOL.$this->getTLTrace().PHP_EOL;
} }
public function __construct($message, $file = '') public function __construct($message, $file = '')

View File

@ -26,8 +26,10 @@ trait PrettyException
$tl = false; $tl = false;
foreach (array_reverse($this->getTrace()) as $frame) { foreach (array_reverse($this->getTrace()) as $frame) {
if (isset($frame['function']) && in_array($frame['function'], ['serialize_params', 'serialize_object'])) { if (isset($frame['function']) && in_array($frame['function'], ['serialize_params', 'serialize_object'])) {
$this->tl_trace .= $tl ? "['".$frame['args'][2]."']" : "While serializing: \t".$frame['args'][2]; if ($frame['args'][2] !== '') {
$tl = true; $this->tl_trace .= $tl ? "['".$frame['args'][2]."']" : "While serializing: \t".$frame['args'][2];
$tl = true;
}
} else { } else {
if ($tl) { if ($tl) {
$this->tl_trace .= PHP_EOL; $this->tl_trace .= PHP_EOL;
@ -41,5 +43,6 @@ trait PrettyException
} }
} }
$this->tl_trace .= $init !== '' ? "['".$init."']" : ''; $this->tl_trace .= $init !== '' ? "['".$init."']" : '';
$this->tl_trace = implode(PHP_EOL, array_reverse(explode(PHP_EOL, $this->tl_trace)));
} }
} }

View File

@ -378,7 +378,7 @@ trait TL
$concat .= $constructorData['id']; $concat .= $constructorData['id'];
} }
return $concat.$this->serialize_params($constructorData, $object, $constructorData['predicate'], $layer); return $concat.$this->serialize_params($constructorData, $object, '', $layer);
} }
public function serialize_method($method, $arguments) public function serialize_method($method, $arguments)