mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-22 22:51:11 +01:00
Bugfix
This commit is contained in:
parent
40e2e6c09d
commit
0e80e9723b
11
bot.php
11
bot.php
@ -16,8 +16,6 @@ set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelinePro
|
||||
* Various ways to load MadelineProto
|
||||
*/
|
||||
if (!file_exists(__DIR__.'/vendor/autoload.php')) {
|
||||
echo 'You did not run composer update, using madeline.php'.PHP_EOL;
|
||||
define('MADELINE_BRANCH', '');
|
||||
if (!file_exists('madeline.php')) {
|
||||
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
|
||||
}
|
||||
@ -41,10 +39,7 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
||||
}
|
||||
|
||||
$res = json_encode($update, JSON_PRETTY_PRINT);
|
||||
if ($res == '') {
|
||||
$res = var_export($update, true);
|
||||
}
|
||||
//yield $this->sleep(3);
|
||||
|
||||
try {
|
||||
yield $this->messages->sendMessage(['peer' => $update, 'message' => "<code>$res</code>", 'reply_to_msg_id' => isset($update['message']['id']) ? $update['message']['id'] : null, 'parse_mode' => 'HTML']); //'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]);
|
||||
if (isset($update['message']['media']) && $update['message']['media']['_'] !== 'messageMediaGame') {
|
||||
@ -52,10 +47,10 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
||||
//yield $this->download_to_dir($update, '/tmp')
|
||||
}
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
\danog\MadelineProto\Logger::log((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR);
|
||||
$this->logger((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR);
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
if (stripos($e->getMessage(), 'invalid constructor given') === false) {
|
||||
\danog\MadelineProto\Logger::log((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR);
|
||||
$this->logger((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR);
|
||||
}
|
||||
//$this->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);
|
||||
}
|
||||
|
2
docs
2
docs
@ -1 +1 @@
|
||||
Subproject commit aa2c729ab58df6fd79753083bc3c5930d006efce
|
||||
Subproject commit 71da319e21f27e0c6fdc620d170c16600facf99d
|
@ -439,11 +439,11 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->settings['updates']['handle_old_updates']) {
|
||||
/*if (!$this->settings['updates']['handle_old_updates']) {
|
||||
$this->channels_state = new CombinedUpdatesState();
|
||||
$this->msg_ids = [];
|
||||
$this->got_state = false;
|
||||
}
|
||||
}*/
|
||||
yield $this->connect_to_all_dcs_async();
|
||||
foreach ($this->calls as $id => $controller) {
|
||||
if (!is_object($controller)) {
|
||||
|
@ -21,6 +21,7 @@ namespace danog\MadelineProto\Stream;
|
||||
use Amp\CancellationToken;
|
||||
use Amp\Socket\ClientConnectContext;
|
||||
use Amp\Uri\Uri;
|
||||
use danog\MadelineProto\Stream\Transport\DefaultStream;
|
||||
|
||||
/**
|
||||
* Connection context class.
|
||||
@ -360,7 +361,7 @@ class ConnectionContext
|
||||
$string .= ' => ';
|
||||
}
|
||||
$string .= preg_replace('/.*\\\\/', '', $stream[0]);
|
||||
if ($stream[1]) {
|
||||
if ($stream[1] && $stream[0] !== DefaultStream::getName()) {
|
||||
$string .= ' ('.json_encode($stream[1]).')';
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user