c:
This commit is contained in:
parent
92717a2d05
commit
9c258ef406
@ -238,8 +238,8 @@ class CombinedAPI
|
|||||||
if ($instance->API->authorized !== MTProto::LOGGED_IN) {
|
if ($instance->API->authorized !== MTProto::LOGGED_IN) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!$instance->API->settings['updates']['handleUpdates']) {
|
if (!$instance->API->settings['updates']['handle_updates']) {
|
||||||
$instance->API->settings['updates']['handleUpdates'] = true;
|
$instance->API->settings['updates']['handle_updates'] = true;
|
||||||
$instance->API->startUpdateSystem();
|
$instance->API->startUpdateSystem();
|
||||||
}
|
}
|
||||||
$instance->setCallback(function ($update) use ($path) {
|
$instance->setCallback(function ($update) use ($path) {
|
||||||
|
@ -50,11 +50,11 @@ class FeedLoop extends ResumableSignalLoop
|
|||||||
$API = $this->API;
|
$API = $this->API;
|
||||||
$this->updater = $API->updaters[$this->channelId];
|
$this->updater = $API->updaters[$this->channelId];
|
||||||
|
|
||||||
if (!$this->API->settings['updates']['handleUpdates']) {
|
if (!$this->API->settings['updates']['handle_updates']) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!$this->API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
|
while (!$this->API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
|
||||||
if (yield $this->waitSignal($this->pause())) {
|
if (yield $this->waitSignal($this->pause())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ class FeedLoop extends ResumableSignalLoop
|
|||||||
$this->state = $this->channelId === false ? (yield $API->loadUpdateState()) : $API->loadChannelState($this->channelId);
|
$this->state = $this->channelId === false ? (yield $API->loadUpdateState()) : $API->loadChannelState($this->channelId);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
while (!$this->API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
|
while (!$this->API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
|
||||||
if (yield $this->waitSignal($this->pause())) {
|
if (yield $this->waitSignal($this->pause())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ class FeedLoop extends ResumableSignalLoop
|
|||||||
if (yield $this->waitSignal($this->pause())) {
|
if (yield $this->waitSignal($this->pause())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!$this->API->settings['updates']['handleUpdates']) {
|
if (!$this->API->settings['updates']['handle_updates']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$API->logger->logger("Resumed $this");
|
$API->logger->logger("Resumed $this");
|
||||||
|
@ -42,11 +42,11 @@ class SeqLoop extends ResumableSignalLoop
|
|||||||
$API = $this->API;
|
$API = $this->API;
|
||||||
$this->feeder = $API->feeders[false];
|
$this->feeder = $API->feeders[false];
|
||||||
|
|
||||||
if (!$this->API->settings['updates']['handleUpdates']) {
|
if (!$this->API->settings['updates']['handle_updates']) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!$this->API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
|
while (!$this->API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
|
||||||
if (yield $this->waitSignal($this->pause())) {
|
if (yield $this->waitSignal($this->pause())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ class SeqLoop extends ResumableSignalLoop
|
|||||||
$this->state = yield $API->loadUpdateState();
|
$this->state = yield $API->loadUpdateState();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
while (!$this->API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
|
while (!$this->API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
|
||||||
if (yield $this->waitSignal($this->pause())) {
|
if (yield $this->waitSignal($this->pause())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ class SeqLoop extends ResumableSignalLoop
|
|||||||
if (yield $this->waitSignal($this->pause())) {
|
if (yield $this->waitSignal($this->pause())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!$this->API->settings['updates']['handleUpdates']) {
|
if (!$this->API->settings['updates']['handle_updates']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while ($this->incomingUpdates) {
|
while ($this->incomingUpdates) {
|
||||||
|
@ -47,7 +47,7 @@ class UpdateLoop extends ResumableSignalLoop
|
|||||||
$API = $this->API;
|
$API = $this->API;
|
||||||
$feeder = $this->feeder = $API->feeders[$this->channelId];
|
$feeder = $this->feeder = $API->feeders[$this->channelId];
|
||||||
|
|
||||||
while (!$API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
|
while (!$API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
|
||||||
if (yield $this->waitSignal($this->pause())) {
|
if (yield $this->waitSignal($this->pause())) {
|
||||||
$API->logger->logger("Exiting $this due to signal");
|
$API->logger->logger("Exiting $this due to signal");
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ class UpdateLoop extends ResumableSignalLoop
|
|||||||
$timeout = $API->settings['updates']['getdifference_interval'];
|
$timeout = $API->settings['updates']['getdifference_interval'];
|
||||||
$first = true;
|
$first = true;
|
||||||
while (true) {
|
while (true) {
|
||||||
while (!$API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
|
while (!$API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
|
||||||
if (yield $this->waitSignal($this->pause())) {
|
if (yield $this->waitSignal($this->pause())) {
|
||||||
$API->logger->logger("Exiting $this due to signal");
|
$API->logger->logger("Exiting $this due to signal");
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class Lua
|
|||||||
throw new Exception(\danog\MadelineProto\Lang::$current_lang['script_not_exist']);
|
throw new Exception(\danog\MadelineProto\Lang::$current_lang['script_not_exist']);
|
||||||
}
|
}
|
||||||
$this->MadelineProto = $MadelineProto;
|
$this->MadelineProto = $MadelineProto;
|
||||||
$this->MadelineProto->settings['updates']['handleUpdates'] = true;
|
$this->MadelineProto->settings['updates']['handle_updates'] = true;
|
||||||
$this->MadelineProto->API->datacenter->sockets[$this->MadelineProto->settings['connection_settings']['default_dc']]->startUpdateLoop();
|
$this->MadelineProto->API->datacenter->sockets[$this->MadelineProto->settings['connection_settings']['default_dc']]->startUpdateLoop();
|
||||||
|
|
||||||
$this->script = $script;
|
$this->script = $script;
|
||||||
|
@ -816,7 +816,7 @@ class MTProto extends AsyncConstruct implements TLCallback
|
|||||||
if ($this->authorized === self::LOGGED_IN && !$this->authorization['user']['bot'] && $this->settings['peer']['cache_all_peers_on_startup']) {
|
if ($this->authorized === self::LOGGED_IN && !$this->authorization['user']['bot'] && $this->settings['peer']['cache_all_peers_on_startup']) {
|
||||||
yield $this->getDialogs($force);
|
yield $this->getDialogs($force);
|
||||||
}
|
}
|
||||||
if ($this->authorized === self::LOGGED_IN && $this->settings['updates']['handleUpdates']) {
|
if ($this->authorized === self::LOGGED_IN && $this->settings['updates']['handle_updates']) {
|
||||||
$this->logger->logger(\danog\MadelineProto\Lang::$current_lang['getupdates_deserialization'], Logger::NOTICE);
|
$this->logger->logger(\danog\MadelineProto\Lang::$current_lang['getupdates_deserialization'], Logger::NOTICE);
|
||||||
yield $this->updaters[false]->resume();
|
yield $this->updaters[false]->resume();
|
||||||
}
|
}
|
||||||
@ -1113,7 +1113,7 @@ class MTProto extends AsyncConstruct implements TLCallback
|
|||||||
// Should madeline fetch the full member list of every group it meets?
|
// Should madeline fetch the full member list of every group it meets?
|
||||||
'cache_all_peers_on_startup' => false,
|
'cache_all_peers_on_startup' => false,
|
||||||
], 'requests' => ['gzip_encode_if_gt' => 1024 * 1024], 'updates' => [
|
], 'requests' => ['gzip_encode_if_gt' => 1024 * 1024], 'updates' => [
|
||||||
'handleUpdates' => false,
|
'handle_updates' => false,
|
||||||
// Should I handle updates?
|
// Should I handle updates?
|
||||||
'handle_old_updates' => true,
|
'handle_old_updates' => true,
|
||||||
// Should I handle old updates on startup?
|
// Should I handle old updates on startup?
|
||||||
@ -1182,7 +1182,7 @@ class MTProto extends AsyncConstruct implements TLCallback
|
|||||||
throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['api_not_set'], 0, null, 'MadelineProto', 1);
|
throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['api_not_set'], 0, null, 'MadelineProto', 1);
|
||||||
}
|
}
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
if (!$this->settings['updates']['handleUpdates']) {
|
if (!$this->settings['updates']['handle_updates']) {
|
||||||
$this->updates = [];
|
$this->updates = [];
|
||||||
}
|
}
|
||||||
// Setup logger
|
// Setup logger
|
||||||
|
@ -48,7 +48,7 @@ trait UpdateHandler
|
|||||||
|
|
||||||
public function getUpdatesUpdateHandler($update)
|
public function getUpdatesUpdateHandler($update)
|
||||||
{
|
{
|
||||||
if (!$this->settings['updates']['handleUpdates']) {
|
if (!$this->settings['updates']['handle_updates']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->updates[$this->updates_key++] = $update;
|
$this->updates[$this->updates_key++] = $update;
|
||||||
@ -56,8 +56,8 @@ trait UpdateHandler
|
|||||||
|
|
||||||
public function getUpdates($params = [])
|
public function getUpdates($params = [])
|
||||||
{
|
{
|
||||||
if (!$this->settings['updates']['handleUpdates']) {
|
if (!$this->settings['updates']['handle_updates']) {
|
||||||
$this->settings['updates']['handleUpdates'] = true;
|
$this->settings['updates']['handle_updates'] = true;
|
||||||
$this->startUpdateSystem();
|
$this->startUpdateSystem();
|
||||||
}
|
}
|
||||||
if (!$this->settings['updates']['run_callback']) {
|
if (!$this->settings['updates']['run_callback']) {
|
||||||
@ -173,7 +173,7 @@ trait UpdateHandler
|
|||||||
|
|
||||||
public function handleUpdates($updates, $actual_updates = null)
|
public function handleUpdates($updates, $actual_updates = null)
|
||||||
{
|
{
|
||||||
if (!$this->settings['updates']['handleUpdates']) {
|
if (!$this->settings['updates']['handle_updates']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($actual_updates) {
|
if ($actual_updates) {
|
||||||
@ -365,7 +365,7 @@ trait UpdateHandler
|
|||||||
//if ($update['_'] === 'updateServiceNotification' && strpos($update['type'], 'AUTH_KEY_DROP_') === 0) {
|
//if ($update['_'] === 'updateServiceNotification' && strpos($update['type'], 'AUTH_KEY_DROP_') === 0) {
|
||||||
|
|
||||||
//}
|
//}
|
||||||
if (!$this->settings['updates']['handleUpdates']) {
|
if (!$this->settings['updates']['handle_updates']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isset($update['message']['_']) && $update['message']['_'] === 'messageEmpty') {
|
if (isset($update['message']['_']) && $update['message']['_'] === 'messageEmpty') {
|
||||||
|
@ -28,7 +28,7 @@ trait Callback
|
|||||||
{
|
{
|
||||||
$this->settings['updates']['callback'] = $callback;
|
$this->settings['updates']['callback'] = $callback;
|
||||||
$this->settings['updates']['run_callback'] = true;
|
$this->settings['updates']['run_callback'] = true;
|
||||||
$this->settings['updates']['handleUpdates'] = true;
|
$this->settings['updates']['handle_updates'] = true;
|
||||||
$this->startUpdateSystem();
|
$this->startUpdateSystem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ trait Events
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->settings['updates']['callback'] = [$this, 'eventUpdateHandler'];
|
$this->settings['updates']['callback'] = [$this, 'eventUpdateHandler'];
|
||||||
$this->settings['updates']['handleUpdates'] = true;
|
$this->settings['updates']['handle_updates'] = true;
|
||||||
$this->settings['updates']['run_callback'] = true;
|
$this->settings['updates']['run_callback'] = true;
|
||||||
if (!$this->asyncInitPromise) {
|
if (!$this->asyncInitPromise) {
|
||||||
$this->startUpdateSystem();
|
$this->startUpdateSystem();
|
||||||
|
@ -140,8 +140,8 @@ trait Loop
|
|||||||
|
|
||||||
$this->closeConnection('Bot was started');
|
$this->closeConnection('Bot was started');
|
||||||
}
|
}
|
||||||
if (!$this->settings['updates']['handleUpdates']) {
|
if (!$this->settings['updates']['handle_updates']) {
|
||||||
$this->settings['updates']['handleUpdates'] = true;
|
$this->settings['updates']['handle_updates'] = true;
|
||||||
}
|
}
|
||||||
if (!$this->settings['updates']['run_callback']) {
|
if (!$this->settings['updates']['run_callback']) {
|
||||||
$this->settings['updates']['run_callback'] = true;
|
$this->settings['updates']['run_callback'] = true;
|
||||||
|
@ -25,7 +25,7 @@ trait Noop
|
|||||||
{
|
{
|
||||||
$this->settings['updates']['callback'] = [$this, 'noop'];
|
$this->settings['updates']['callback'] = [$this, 'noop'];
|
||||||
$this->settings['updates']['run_callback'] = false;
|
$this->settings['updates']['run_callback'] = false;
|
||||||
$this->settings['updates']['handleUpdates'] = true;
|
$this->settings['updates']['handle_updates'] = true;
|
||||||
$this->startUpdateSystem();
|
$this->startUpdateSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ trait Webhook
|
|||||||
$this->hook_url = $hook_url;
|
$this->hook_url = $hook_url;
|
||||||
$this->settings['updates']['callback'] = [$this, 'pwrWebhook'];
|
$this->settings['updates']['callback'] = [$this, 'pwrWebhook'];
|
||||||
$this->settings['updates']['run_callback'] = true;
|
$this->settings['updates']['run_callback'] = true;
|
||||||
$this->settings['updates']['handleUpdates'] = true;
|
$this->settings['updates']['handle_updates'] = true;
|
||||||
$this->startUpdateSystem();
|
$this->startUpdateSystem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user