mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 05:34:42 +01:00
Bugfix
This commit is contained in:
parent
06d083aae8
commit
b4cecd9fbd
4
bot.php
4
bot.php
@ -32,8 +32,8 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
|||||||
if (isset($update['message']['out']) && $update['message']['out']) {
|
if (isset($update['message']['out']) && $update['message']['out']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isset($update['message']['media'])) {
|
if (isset($update['message']['media']) && $update['message']['media']['_'] !== 'messageMediaGame') {
|
||||||
yield $MadelineProto->download_to_dir($update, '/tmp');
|
//yield $this->download_to_dir($update, '/tmp');
|
||||||
yield $this->messages->sendMedia(['peer' => $update, 'message' => $update['message']['message'], 'media' => $update]);
|
yield $this->messages->sendMedia(['peer' => $update, 'message' => $update['message']['message'], 'media' => $update]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ class API extends APIFactory
|
|||||||
|
|
||||||
public function __magic_construct($params = [], $settings = [])
|
public function __magic_construct($params = [], $settings = [])
|
||||||
{
|
{
|
||||||
|
Magic::class_exists();
|
||||||
set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']);
|
set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']);
|
||||||
if (is_string($params)) {
|
if (is_string($params)) {
|
||||||
$realpaths = Serialization::realpaths($params);
|
$realpaths = Serialization::realpaths($params);
|
||||||
|
@ -185,7 +185,7 @@ class APIFactory
|
|||||||
{
|
{
|
||||||
$result = $this->methods[$name](...$arguments);
|
$result = $this->methods[$name](...$arguments);
|
||||||
if (is_object($result) && ($result instanceof \Generator || $result instanceof Promise)) {
|
if (is_object($result) && ($result instanceof \Generator || $result instanceof Promise)) {
|
||||||
$async = isset(end($arguments)['async']) ? end($arguments)['async'] : $this->async;
|
$async = is_array(end($arguments)) && isset(end($arguments)['async']) ? end($arguments)['async'] : $this->async;
|
||||||
if ($async && ($name !== 'loop' || isset(end($arguments)['async']))) {
|
if ($async && ($name !== 'loop' || isset(end($arguments)['async']))) {
|
||||||
return $result;
|
return $result;
|
||||||
} else {
|
} else {
|
||||||
|
@ -29,7 +29,6 @@ class Absolute
|
|||||||
if (($file[0] !== '/') && ($file[1] !== ':') && !in_array(substr($file, 0, 4), ['phar', 'http'])) {
|
if (($file[0] !== '/') && ($file[1] !== ':') && !in_array(substr($file, 0, 4), ['phar', 'http'])) {
|
||||||
$file = Magic::getcwd().'/'.$file;
|
$file = Magic::getcwd().'/'.$file;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class ReadLoop extends SignalLoop
|
|||||||
foreach ($connection->new_outgoing as $message_id) {
|
foreach ($connection->new_outgoing as $message_id) {
|
||||||
$connection->outgoing_messages[$message_id]['sent'] = 0;
|
$connection->outgoing_messages[$message_id]['sent'] = 0;
|
||||||
}
|
}
|
||||||
$API->init_authorization();
|
yield $API->init_authorization_async();
|
||||||
} else {
|
} else {
|
||||||
//throw new \danog\MadelineProto\RPCErrorException($error, $error);
|
//throw new \danog\MadelineProto\RPCErrorException($error, $error);
|
||||||
}
|
}
|
||||||
@ -102,6 +102,7 @@ class ReadLoop extends SignalLoop
|
|||||||
$this->exitedLoop();
|
$this->exitedLoop();
|
||||||
}
|
}
|
||||||
$this->startedLoop();
|
$this->startedLoop();
|
||||||
|
//var_dump(count($connection->incoming_messages));
|
||||||
// Loop::defer(function () use ($datacenter) {
|
// Loop::defer(function () use ($datacenter) {
|
||||||
if ($this->API->is_http($datacenter)) {
|
if ($this->API->is_http($datacenter)) {
|
||||||
$this->API->datacenter->sockets[$datacenter]->waiter->resume();
|
$this->API->datacenter->sockets[$datacenter]->waiter->resume();
|
||||||
@ -202,7 +203,8 @@ class ReadLoop extends SignalLoop
|
|||||||
}
|
}
|
||||||
$connection->incoming_messages[$message_id] = ['seq_no' => $seq_no];
|
$connection->incoming_messages[$message_id] = ['seq_no' => $seq_no];
|
||||||
} else {
|
} else {
|
||||||
throw new \danog\MadelineProto\Exception('Got unknown auth_key id');
|
$API->logger->logger('Got unknown auth_key id', \danog\MadelineProto\Logger::ERROR);
|
||||||
|
return -404;
|
||||||
}
|
}
|
||||||
$deserialized = $API->deserialize($message_data, ['type' => '', 'datacenter' => $datacenter]);
|
$deserialized = $API->deserialize($message_data, ['type' => '', 'datacenter' => $datacenter]);
|
||||||
$API->referenceDatabase->reset();
|
$API->referenceDatabase->reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user