bugfix
This commit is contained in:
parent
18096de1e7
commit
d5b589877a
@ -19,6 +19,7 @@
|
||||
"phpseclib/phpseclib": "dev-ige",
|
||||
"vlucas/phpdotenv": "^2.4",
|
||||
"erusev/parsedown": "^1.6",
|
||||
"rollbar/rollbar": "dev-master",
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
|
@ -374,10 +374,8 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
||||
|
||||
public function setup_logger()
|
||||
{
|
||||
\danog\MadelineProto\Logger::constructor(
|
||||
$this->settings['logger']['logger'],
|
||||
$this->settings['logger']['logger_param'],
|
||||
isset($this->authorization['user']) ? (isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id']) : '', isset($this->settings['logger']['logger_level']) ? $this->settings['logger']['logger_level'] : Logger::VERBOSE);
|
||||
\Rollbar\Rollbar::init(['environment' => 'production', 'root' => __DIR__, 'access_token' => '31979a2053e045548573d29232dde9c5'], true, false);
|
||||
\danog\MadelineProto\Logger::constructor($this->settings['logger']['logger'], $this->settings['logger']['logger_param'],isset($this->authorization['user']) ? (isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id']) : '', isset($this->settings['logger']['logger_level']) ? $this->settings['logger']['logger_level'] : Logger::VERBOSE);
|
||||
}
|
||||
|
||||
public function reset_session($de = true, $auth_key = false)
|
||||
|
@ -47,6 +47,9 @@ trait CallHandler
|
||||
$content_related = $this->content_related($method);
|
||||
$type = $this->methods->find_by_method($method)['type'];
|
||||
$last_recv = $this->last_recv;
|
||||
if ($canunset = !$this->getting_state && !$this->threads && !$this->run_workers) {
|
||||
$this->getting_state = true;
|
||||
}
|
||||
for ($count = 1; $count <= $this->settings['max_tries']['query']; $count++) {
|
||||
try {
|
||||
\danog\MadelineProto\Logger::log(['Calling method (try number '.$count.' for '.$method.')...'], \danog\MadelineProto\Logger::VERBOSE);
|
||||
@ -61,9 +64,6 @@ trait CallHandler
|
||||
$server_answer = null;
|
||||
$update_count = 0;
|
||||
$only_updates = false;
|
||||
if ($canunset = !$this->getting_state && !$this->threads && !$this->run_workers) {
|
||||
$this->getting_state = true;
|
||||
}
|
||||
while ($server_answer === null && $res_count++ < $this->settings['max_tries']['response'] + 1) { // Loop until we get a response, loop for a max of $this->settings['max_tries']['response'] times
|
||||
try {
|
||||
\danog\MadelineProto\Logger::log(['Getting response (try number '.$res_count.' for '.$method.')...'], \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
||||
|
@ -145,7 +145,7 @@ trait UpdateHandler
|
||||
try {
|
||||
$difference = $this->method_call('updates.getChannelDifference', ['channel' => $input, 'filter' => ['_' => 'channelMessagesFilterEmpty'], 'pts' => $this->get_channel_state($channel)['pts'], 'limit' => 30], ['datacenter' => $this->datacenter->curdc]);
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
if ($e->getMessage() === 'CHANNEL_PRIVATE') {
|
||||
if ($e->getMessage() === "You haven't joined this channel/supergroup") {
|
||||
return false;
|
||||
} else {
|
||||
throw $e;
|
||||
|
@ -14,4 +14,15 @@ namespace danog\MadelineProto;
|
||||
|
||||
class RPCErrorException extends \Exception
|
||||
{
|
||||
public function __construct($message = null, $code = 0, Exception $previous = null)
|
||||
{
|
||||
switch ($message) {
|
||||
case 'RPC_CALL_FAIL': $message = 'Telegram is having internal issues, please try again later.';break;
|
||||
case 'CHANNEL_PRIVATE':$message = "You haven't joined this channel/supergroup";break;
|
||||
case 'FLOOD_WAIT_666':$message = 'Spooky af m8';break;
|
||||
case 'BOT_METHOD_INVALID':$message = 'This method cannot be run by a bot';break;
|
||||
|
||||
}
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user