php-telegram-bot / laravel

Laravel package for PHP Telegram Bot Library
Other
168 stars 50 forks source link

Telegram returned an invalid response! #18

Closed dehghanimehrdad closed 3 years ago

dehghanimehrdad commented 4 years ago

Hello, I am getting this error sometimes, I don't know what the problem is, I searched and saw some people was having the problem and some had reported it was due to blocked telegram in some countries but since my server was in germany and I also could make some requests and it only failed sometimes, for example I was not able to run /debug command and it always failed, but when I ran all the codes in debug command from an other route (not as a command) it worked fine! anyways to solve the problem I had to add the following code to Request.php file in send function before self::execute and it solved my problem but since I have edited core files I thought it would be good to report the problem Im having. I have been using the library on my laravel project for more than a year and didn't have this problem until yesterday and I haven't updated anything on my server. the code I added: \Longman\TelegramBot\Request::setClient(new Client([ 'base_uri' => 'https://api.telegram.org', ]));

noplanman commented 4 years ago

This is very strange, as the code you've added gets used anyway by default.

Please don't edit any files in the vendor directory, but instead add it in your hook, before handling the request. Just add that line somewhere before $telegram->handle().

And this error has suddenly popped up without having changed anything? Also, you could try to reset your API key with BotFather, which sometimes help fix strange issues.