From 913fc912ee0730c52dcb208cadddb159c219ba9b Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 13 Aug 2017 18:52:05 +0200 Subject: [PATCH] Fetch RPC error descriptions from API --- src/danog/MadelineProto/RPCErrorException.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/danog/MadelineProto/RPCErrorException.php b/src/danog/MadelineProto/RPCErrorException.php index dc60ea9e..ac309dbd 100644 --- a/src/danog/MadelineProto/RPCErrorException.php +++ b/src/danog/MadelineProto/RPCErrorException.php @@ -69,6 +69,12 @@ class RPCErrorException extends \Exception case -429: case 'PEER_FLOOD': $message = 'Too many requests'; break; } + if ($this->rpc === $message) { + $res = json_decode(file_get_contents('https://rpc.pwrtelegram.xyz/?description_for='.$this->rpc)); + if ($res['ok']) { + $message = $res['result']; + } + } parent::__construct($message, $code, $previous); $this->prettify_tl();