diff --git a/bot.php b/bot.php index 2322e451..e65f57ca 100755 --- a/bot.php +++ b/bot.php @@ -42,10 +42,10 @@ class EventHandler extends \danog\MadelineProto\EventHandler if ($res == '') { $res = var_export($update, true); } - yield $this->sleep_async(3); + //yield $this->sleep_async(3); try { - yield $this->messages->sendMessage(['peer' => $update, 'message' => "$res\n\nDopo 3 secondi, in modo asincrono", 'reply_to_msg_id' => isset($update['message']['id']) ? $update['message']['id'] : null, 'parse_mode' => 'HTML']); //'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]); + yield $this->messages->sendMessage(['peer' => $update, 'message' => "$res", 'reply_to_msg_id' => isset($update['message']['id']) ? $update['message']['id'] : null, 'parse_mode' => 'HTML']); //'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]); } catch (\danog\MadelineProto\RPCErrorException $e) { \danog\MadelineProto\Logger::log((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR); } catch (\danog\MadelineProto\Exception $e) { diff --git a/docs b/docs index 2566f9ab..0fcff8e5 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 2566f9ab998e645217654356792f82c9e131a06e +Subproject commit 0fcff8e5a31af300511949c4dbafc7be6c0d4dd7 diff --git a/src/danog/MadelineProto/Wrappers/Loop.php b/src/danog/MadelineProto/Wrappers/Loop.php index 27cd6270..0fff7116 100644 --- a/src/danog/MadelineProto/Wrappers/Loop.php +++ b/src/danog/MadelineProto/Wrappers/Loop.php @@ -104,13 +104,15 @@ trait Loop $this->logger->logger('Started update loop', \danog\MadelineProto\Logger::NOTICE); while (true) { - foreach ($this->updates as $update) { + $updates = $this->updates; + $this->updates = []; + foreach ($updates as $update) { $r = $this->settings['updates']['callback']($update); if (is_object($r)) { \Amp\Promise\rethrow($this->call($r)); } } - $this->updates = []; + $updates = []; if ($this->loop_callback !== null) { $callback = $this->loop_callback;