This commit is contained in:
Daniil Gentili 2018-04-17 21:51:54 +00:00
parent 5344f8d586
commit 4f28c22a4b
3 changed files with 9 additions and 5 deletions

2
docs

@ -1 +1 @@
Subproject commit b6152298e377fe696e67971d889833fa1f36da8e Subproject commit 916411226dd921657305ee7c344c870f6800f479

View File

@ -147,6 +147,7 @@ Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'p
if ($update['message']['out'] || $update['message']['to_id']['_'] !== 'peerUser' || !isset($update['message']['from_id'])) { if ($update['message']['out'] || $update['message']['to_id']['_'] !== 'peerUser' || !isset($update['message']['from_id'])) {
return; return;
} }
\danog\MadelineProto\Logger::log($update);
$chat_id = $from_id = $this->get_info($update)['bot_api_id']; $chat_id = $from_id = $this->get_info($update)['bot_api_id'];
$message = isset($update['message']['message']) ? $update['message']['message'] : ''; $message = isset($update['message']['message']) ? $update['message']['message'] : '';
$this->handleMessage($chat_id, $from_id, $message); $this->handleMessage($chat_id, $from_id, $message);
@ -193,7 +194,10 @@ Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'p
} }
} }
} }
public function onAny($update)
{
\danog\MadelineProto\Logger::log($update);
}
public function onLoop() public function onLoop()
{ {
foreach ($this->programmed_call as $key => $pair) { foreach ($this->programmed_call as $key => $pair) {

View File

@ -383,7 +383,7 @@ trait TL
public function serialize_method($method, $arguments) public function serialize_method($method, $arguments)
{ {
if ($method === 'messages.importChatInvite' && isset($arguments['hash']) && preg_match('@(?:t|telegram)\.(?:me|dog)/(joinchat/)?([a-z0-9_-]*)@i', $arguments['hash'], $matches)) { if ($method === 'messages.importChatInvite' && isset($arguments['hash']) && is_string($arguments['hash']) && preg_match('@(?:t|telegram)\.(?:me|dog)/(joinchat/)?([a-z0-9_-]*)@i', $arguments['hash'], $matches)) {
if ($matches[1] === '') { if ($matches[1] === '') {
$method = 'channels.joinChannel'; $method = 'channels.joinChannel';
$arguments['channel'] = $matches[2]; $arguments['channel'] = $matches[2];
@ -391,10 +391,10 @@ trait TL
$arguments['hash'] = $matches[2]; $arguments['hash'] = $matches[2];
} }
} }
if ($method === 'messages.checkChatInvite' && isset($arguments['hash']) && preg_match('@(?:t|telegram)\.(?:me|dog)/joinchat/([a-z0-9_-]*)@i', $arguments['hash'], $matches)) { if ($method === 'messages.checkChatInvite' && isset($arguments['hash']) && is_string($arguments['hash']) && preg_match('@(?:t|telegram)\.(?:me|dog)/joinchat/([a-z0-9_-]*)@i', $arguments['hash'], $matches)) {
$arguments['hash'] = $matches[1]; $arguments['hash'] = $matches[1];
} }
if ($method === 'channels.joinChannel' && isset($arguments['channel']) && preg_match('@(?:t|telegram)\.(?:me|dog)/(joinchat/)?([a-z0-9_-]*)@i', $arguments['channel'], $matches)) { if ($method === 'channels.joinChannel' && isset($arguments['channel']) && is_string($arguments['channel']) && preg_match('@(?:t|telegram)\.(?:me|dog)/(joinchat/)?([a-z0-9_-]*)@i', $arguments['channel'], $matches)) {
if ($matches[1] !== '') { if ($matches[1] !== '') {
$method = 'messages.importChatInvite'; $method = 'messages.importChatInvite';
$arguments['hash'] = $matches[2]; $arguments['hash'] = $matches[2];