Fixed bugs

This commit is contained in:
Daniil Gentili 2017-01-09 16:26:41 +01:00
parent 251adef8ce
commit bb15d89124
3 changed files with 4 additions and 3 deletions

0
bot.php Normal file → Executable file
View File

View File

@ -45,7 +45,7 @@ trait CallHandler
} }
$server_answer = $this->datacenter->incoming_messages[$this->datacenter->outgoing_messages[$int_message_id]['response']]['content']; // continue was not called, so I got a response $server_answer = $this->datacenter->incoming_messages[$this->datacenter->outgoing_messages[$int_message_id]['response']]['content']; // continue was not called, so I got a response
if ($heavy) { if ($heavy) {
unset($this->datacenter->incoming_messages[$this->datacenter->outgoing_messages[$int_message_id]['response']]); $this->datacenter->incoming_messages[$this->datacenter->outgoing_messages[$int_message_id]['response']]['content'] = [];
} }
} catch (\danog\MadelineProto\Exception $e) { } catch (\danog\MadelineProto\Exception $e) {
\danog\MadelineProto\Logger::log('An error getting response of method '.$method.': '.$e->getMessage().' in '.basename($e->getFile(), '.php').' on line '.$e->getLine().'. Retrying...'); \danog\MadelineProto\Logger::log('An error getting response of method '.$method.': '.$e->getMessage().' in '.basename($e->getFile(), '.php').' on line '.$e->getLine().'. Retrying...');
@ -112,7 +112,7 @@ trait CallHandler
continue; continue;
} finally { } finally {
if ($heavy) { if ($heavy) {
unset($this->datacenter->outgoing_messages[$int_message_id]); $this->datacenter->outgoing_messages[$int_message_id]['args'] = [];
} }
} }
if ($server_answer == null) { if ($server_answer == null) {

View File

@ -44,16 +44,17 @@ trait PeerHandler
switch ($chat['_']) { switch ($chat['_']) {
case 'chat': case 'chat':
case 'chatEmpty': case 'chatEmpty':
case 'chatForbidden':
if (!isset($this->chats[-$chat['id']]) || $this->chats[-$chat['id']]['chat'] !== $chat) { if (!isset($this->chats[-$chat['id']]) || $this->chats[-$chat['id']]['chat'] !== $chat) {
//$this->method_call('messages.getFullChat', ['chat_id' => $chat['id']]); //$this->method_call('messages.getFullChat', ['chat_id' => $chat['id']]);
$this->chats[-$chat['id']] = ['_' => 'chatFull', 'chat' => $chat]; $this->chats[-$chat['id']] = ['_' => 'chatFull', 'chat' => $chat];
$this->should_serialize = true; $this->should_serialize = true;
} }
case 'chatForbidden':
case 'channelEmpty': case 'channelEmpty':
break; break;
case 'channel': case 'channel':
case 'channelForbidden':
if (!isset($this->chats[(int) ('-100'.$chat['id'])]) || $this->chats[(int) ('-100'.$chat['id'])]['channel'] !== $chat) { if (!isset($this->chats[(int) ('-100'.$chat['id'])]) || $this->chats[(int) ('-100'.$chat['id'])]['channel'] !== $chat) {
$this->chats[(int) ('-100'.$chat['id'])] = ['_' => 'channelFull', 'channel' => $chat]; $this->chats[(int) ('-100'.$chat['id'])] = ['_' => 'channelFull', 'channel' => $chat];
$this->should_serialize = true; $this->should_serialize = true;