diff --git a/docs b/docs index b6152298..91641122 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit b6152298e377fe696e67971d889833fa1f36da8e +Subproject commit 916411226dd921657305ee7c344c870f6800f479 diff --git a/magna.php b/magna.php index 5166ed3f..760e8e32 100755 --- a/magna.php +++ b/magna.php @@ -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'])) { return; } + \danog\MadelineProto\Logger::log($update); $chat_id = $from_id = $this->get_info($update)['bot_api_id']; $message = isset($update['message']['message']) ? $update['message']['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() { foreach ($this->programmed_call as $key => $pair) { diff --git a/src/danog/MadelineProto/TL/TL.php b/src/danog/MadelineProto/TL/TL.php index 6d48b94a..c94364ad 100644 --- a/src/danog/MadelineProto/TL/TL.php +++ b/src/danog/MadelineProto/TL/TL.php @@ -383,7 +383,7 @@ trait TL 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] === '') { $method = 'channels.joinChannel'; $arguments['channel'] = $matches[2]; @@ -391,10 +391,10 @@ trait TL $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]; } - 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] !== '') { $method = 'messages.importChatInvite'; $arguments['hash'] = $matches[2];