Misc bugfixes
This commit is contained in:
parent
7b6c3690d3
commit
93ff2ccab9
@ -85,7 +85,7 @@ $settings = [
|
||||
],
|
||||
];
|
||||
|
||||
$MadelineProto = new \danog\MadelineProto\API('bot.madeline', $settings);
|
||||
$MadelineProto = new \danog\MadelineProto\API('/home/daniil/lmao.session', $settings);
|
||||
$MadelineProto->async(true);
|
||||
$MadelineProto->loop(function () use ($MadelineProto) {
|
||||
yield $MadelineProto->start();
|
||||
|
@ -918,15 +918,6 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||
if (Lang::$lang[$this->settings['app_info']['lang_code'] ?? 'en'] ?? false) {
|
||||
Lang::$current_lang = &Lang::$lang[$this->settings['app_info']['lang_code']];
|
||||
}
|
||||
// Cleanup old properties, init new stuffs
|
||||
$this->cleanupProperties();
|
||||
|
||||
// Update TL callbacks
|
||||
$callbacks = [$this, $this->referenceDatabase];
|
||||
if (!($this->authorization['user']['bot'] ?? false)) {
|
||||
$callbacks []= $this->minDatabase;
|
||||
}
|
||||
$this->TL->updateCallbacks($callbacks);
|
||||
|
||||
$this->settings['connection_settings']['all']['ipv6'] = Magic::$ipv6;
|
||||
if ($this->authorized === true) {
|
||||
@ -940,19 +931,32 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->event_handler && \class_exists($this->event_handler) && \is_subclass_of($this->event_handler, EventHandler::class)) {
|
||||
$this->setEventHandler($this->event_handler);
|
||||
}
|
||||
|
||||
if (($this->settings['tl_schema']['src']['botAPI'] ?? '') !== __DIR__.'/TL_botAPI.tl') {
|
||||
unset($this->v);
|
||||
}
|
||||
if (!\file_exists($this->settings['tl_schema']['src']['telegram'])) {
|
||||
unset($this->v);
|
||||
}
|
||||
|
||||
if (!isset($this->v) || $this->v !== self::V) {
|
||||
yield $this->upgradeMadelineProto();
|
||||
$force = true;
|
||||
}
|
||||
|
||||
// Cleanup old properties, init new stuffs
|
||||
$this->cleanupProperties();
|
||||
|
||||
// Update TL callbacks
|
||||
$callbacks = [$this, $this->referenceDatabase];
|
||||
if (!($this->authorization['user']['bot'] ?? false)) {
|
||||
$callbacks []= $this->minDatabase;
|
||||
}
|
||||
$this->TL->updateCallbacks($callbacks);
|
||||
|
||||
if ($this->event_handler && \class_exists($this->event_handler) && \is_subclass_of($this->event_handler, EventHandler::class)) {
|
||||
$this->setEventHandler($this->event_handler);
|
||||
}
|
||||
|
||||
yield $this->connectToAllDcs();
|
||||
foreach ($this->calls as $id => $controller) {
|
||||
if (!\is_object($controller)) {
|
||||
|
@ -1087,17 +1087,17 @@ trait Files
|
||||
break;
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
if (\strpos($e->rpc, 'FLOOD_WAIT_') === 0) {
|
||||
if (isset($message_media['MessageMedia']) && !$this->authorization['user']['bot'] && $this->settings['download']['report_broken_media']) {
|
||||
try {
|
||||
yield $this->methodCallAsyncRead('messages.sendMedia', ['peer' => 'support', 'media' => $message_media['MessageMedia'], 'message' => "I can't download this file, could you please help?"], ['datacenter' => $this->datacenter->curdc]);
|
||||
} catch (RPCErrorException $e) {
|
||||
$this->logger->logger('An error occurred while reporting the broken file: '.$e->rpc, Logger::FATAL_ERROR);
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logger('An error occurred while reporting the broken file: '.$e->getMessage(), Logger::FATAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if ($x++ === 5) {
|
||||
if (isset($message_media['MessageMedia']) && !$this->authorization['user']['bot'] && $this->settings['download']['report_broken_media']) {
|
||||
try {
|
||||
yield $this->methodCallAsyncRead('messages.sendMedia', ['peer' => 'support', 'media' => $message_media['MessageMedia'], 'message' => "I can't download this file, could you please help?"], ['datacenter' => $this->datacenter->curdc]);
|
||||
} catch (RPCErrorException $e) {
|
||||
$this->logger->logger('An error occurred while reporting the broken file: '.$e->rpc, Logger::FATAL_ERROR);
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logger('An error occurred while reporting the broken file: '.$e->getMessage(), Logger::FATAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
throw new \danog\MadelineProto\Exception('The media server where this file is hosted is offline/overloaded, please try again later. Send the media to the telegram devs or to @danogentili to fix this.');
|
||||
}
|
||||
yield Tools::sleep(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user