This commit is contained in:
Daniil Gentili 2017-05-02 12:13:01 +02:00
parent 79f9a59295
commit 35c0a6bd67
4 changed files with 11 additions and 4 deletions

View File

@ -296,6 +296,7 @@ trait PeerHandler
switch ($partial['type']) {
case 'user':
case 'bot':
if (!isset($partial['InputUser'])) throw new \danog\MadelineProto\Exception('This peer is not present in the internal peer database');
$full = $this->method_call('users.getFullUser', ['id' => $partial['InputUser']], ['datacenter' => $this->datacenter->curdc]);
break;

View File

@ -137,7 +137,9 @@ trait UpdateHandler
$this->get_channel_state($channel)['pending_pts_updates'] = [];
}
try {
$input = $this->get_info('channel#'.$channel)['InputChannel'];
$input = $this->get_info('channel#'.$channel);
if (!isset($input['InputChannel'])) throw new \danog\MadelineProto\Exception('This peer is not present in the internal peer database');
$input = $input['InputChannel'];
} catch (\danog\MadelineProto\Exception $e) {
return false;
} catch (\danog\MadelineProto\RPCErrorException $e) {
@ -611,7 +613,7 @@ trait UpdateHandler
curl_setopt($ch, CURLOPT_URL, $this->hook_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$parse = parse_url($this->hook_url);
if (isset($parse['scheme']) && $parse['scheme'] == 'https') {
if (isset($this->pem_path) && file_exists($this->pem_path)) {

View File

@ -44,7 +44,9 @@ trait AuthKeyHandler
public function request_secret_chat($user)
{
$this->should_serialize = true;
$user = $this->get_info($user)['InputUser'];
$user = $this->get_info($user);
if (!isset($user['InputUser'])) throw new \danog\MadelineProto\Exception('This peer is not present in the internal peer database');
$user = $user['InputUser'];
\danog\MadelineProto\Logger::log(['Creating secret chat with '.$user['user_id'].'...'], \danog\MadelineProto\Logger::VERBOSE);
$dh_config = $this->get_dh_config();
\danog\MadelineProto\Logger::log(['Generating a...'], \danog\MadelineProto\Logger::VERBOSE);

View File

@ -29,7 +29,9 @@ trait AuthKeyHandler
public function request_call($user)
{
$user = $this->get_info($user)['InputUser'];
$user = $this->get_info($user);
if (!isset($user['InputUser'])) throw new \danog\MadelineProto\Exception('This peer is not present in the internal peer database');
$user = $user['InputUser'];
\danog\MadelineProto\Logger::log(['Calling '.$user['user_id'].'...'], \danog\MadelineProto\Logger::VERBOSE);
$dh_config = $this->get_dh_config();
\danog\MadelineProto\Logger::log(['Generating a...'], \danog\MadelineProto\Logger::VERBOSE);