mirror of
https://github.com/danog/magnaluna.git
synced 2024-11-30 04:19:16 +01:00
Merge branch 'master' of github.com:danog/magnaluna
This commit is contained in:
commit
7a60660875
18
magna.php
18
magna.php
@ -253,7 +253,7 @@ Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'p
|
|||||||
yield $this->messages->sendMessage(['peer' => $chat_id, 'message' => 'OK']);
|
yield $this->messages->sendMessage(['peer' => $chat_id, 'message' => 'OK']);
|
||||||
$this->programmed_call[] = [$from_id, $time];
|
$this->programmed_call[] = [$from_id, $time];
|
||||||
$key = \count($this->programmed_call) - 1;
|
$key = \count($this->programmed_call) - 1;
|
||||||
yield $this->sleep($time - \time());
|
yield \danog\MadelineProto\Tools::sleep($time - \time());
|
||||||
yield $this->makeCall($from_id);
|
yield $this->makeCall($from_id);
|
||||||
unset($this->programmed_call[$key]);
|
unset($this->programmed_call[$key]);
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'p
|
|||||||
unset($message[0]);
|
unset($message[0]);
|
||||||
$message = \implode(' ', $message);
|
$message = \implode(' ', $message);
|
||||||
$params = ['multiple' => true];
|
$params = ['multiple' => true];
|
||||||
foreach (yield $this->get_dialogs() as $peer) {
|
foreach (yield $this->getDialogs() as $peer) {
|
||||||
$params []= ['peer' => $peer, 'message' => $message];
|
$params []= ['peer' => $peer, 'message' => $message];
|
||||||
}
|
}
|
||||||
yield $this->messages->sendMessage($params);
|
yield $this->messages->sendMessage($params);
|
||||||
@ -292,7 +292,7 @@ Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'p
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->logger->logger($update);
|
$this->logger->logger($update);
|
||||||
$chat_id = $from_id = yield $this->get_info($update)['bot_api_id'];
|
$chat_id = $from_id = yield $this->getInfo($update)['bot_api_id'];
|
||||||
$message = $update['message']['message'] ?? '';
|
$message = $update['message']['message'] ?? '';
|
||||||
yield $this->handleMessage($chat_id, $from_id, $message);
|
yield $this->handleMessage($chat_id, $from_id, $message);
|
||||||
}
|
}
|
||||||
@ -300,8 +300,8 @@ Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'p
|
|||||||
public function onUpdateNewEncryptedMessage($update)
|
public function onUpdateNewEncryptedMessage($update)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
$chat_id = yield $this->get_info($update)['InputEncryptedChat'];
|
$chat_id = yield $this->getInfo($update)['InputEncryptedChat'];
|
||||||
$from_id = yield $this->get_secret_chat($chat_id)['user_id'];
|
$from_id = yield $this->getSecretChat($chat_id)['user_id'];
|
||||||
$message = isset($update['message']['decrypted_message']['message']) ? $update['message']['decrypted_message']['message'] : '';
|
$message = isset($update['message']['decrypted_message']['message']) ? $update['message']['decrypted_message']['message'] : '';
|
||||||
yield $this->handleMessage($chat_id, $from_id, $message);
|
yield $this->handleMessage($chat_id, $from_id, $message);
|
||||||
}
|
}
|
||||||
@ -314,8 +314,8 @@ Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'p
|
|||||||
if ($update['chat']['_'] !== 'encryptedChat') {
|
if ($update['chat']['_'] !== 'encryptedChat') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$chat_id = yield $this->get_info($update)['InputEncryptedChat'];
|
$chat_id = yield $this->getInfo($update)['InputEncryptedChat'];
|
||||||
$from_id = yield $this->get_secret_chat($chat_id)['user_id'];
|
$from_id = yield $this->getSecretChat($chat_id)['user_id'];
|
||||||
$message = '';
|
$message = '';
|
||||||
} catch (\danog\MadelineProto\Exception $e) {
|
} catch (\danog\MadelineProto\Exception $e) {
|
||||||
return;
|
return;
|
||||||
@ -342,8 +342,8 @@ Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'p
|
|||||||
foreach ($this->programmed_call as $key => list($user, $time)) {
|
foreach ($this->programmed_call as $key => list($user, $time)) {
|
||||||
continue;
|
continue;
|
||||||
$sleepTime = $time <= \time() ? 0 : $time - \time();
|
$sleepTime = $time <= \time() ? 0 : $time - \time();
|
||||||
$this->callFork((function () use ($sleepTime, $key, $user) {
|
\danog\MadelineProto\Tools::callFork((function () use ($sleepTime, $key, $user) {
|
||||||
yield $this->sleep($sleepTime);
|
yield \danog\MadelineProto\Tools::sleep($sleepTime);
|
||||||
yield $this->makeCall($user);
|
yield $this->makeCall($user);
|
||||||
unset($this->programmed_call[$key]);
|
unset($this->programmed_call[$key]);
|
||||||
})());
|
})());
|
||||||
|
Loading…
Reference in New Issue
Block a user