diff --git a/src/danog/MadelineProto/Loop/Update/FeedLoop.php b/src/danog/MadelineProto/Loop/Update/FeedLoop.php index 89b5ec1d..227ab551 100644 --- a/src/danog/MadelineProto/Loop/Update/FeedLoop.php +++ b/src/danog/MadelineProto/Loop/Update/FeedLoop.php @@ -220,6 +220,7 @@ class FeedLoop extends ResumableSignalLoop $this->API->logger->logger("Not enough data: for message update $log, getting difference...", \danog\MadelineProto\Logger::VERBOSE); $update = ['_' => 'updateChannelTooLong']; + if ($channelId && !yield $this->API->peer_isset_async($this->API->to_supergroup($channelId))) $channelId = false; } break; default: diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 967f53c8..703974d7 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -922,8 +922,12 @@ class MTProto extends AsyncConstruct implements TLCallback if (!isset($this->seqUpdater)) { $this->seqUpdater = new SeqLoop($this); } + $channelIds = []; foreach ($this->channels_state->get() as $state) { - $channelId = $state->getChannel(); + $channelIds []= $state->getChannel(); + } + sort($channelIds); + foreach ($channelIds as $channelId) { if (!isset($this->feeders[$channelId])) { $this->feeders[$channelId] = new FeedLoop($this, $channelId); } diff --git a/src/danog/MadelineProto/Magic.php b/src/danog/MadelineProto/Magic.php index a3661910..b36fef81 100644 --- a/src/danog/MadelineProto/Magic.php +++ b/src/danog/MadelineProto/Magic.php @@ -132,8 +132,10 @@ class Magic } catch (\danog\MadelineProto\Exception $e) { } // Even an empty handler is enough to catch ctrl+c - Loop::onSignal(SIGINT, static function () { die(); }); - Loop::onSignal(SIGTERM, static function () { die(); }); + if (defined('SIGINT')) { + Loop::onSignal(SIGINT, static function () { die(); }); + Loop::onSignal(SIGTERM, static function () { die(); }); + } self::$inited = true; } }