botman / driver-telegram

BotMan Telegram Driver
MIT License
87 stars 75 forks source link

Can't send/receive messages after a user posts a file greater than 20mb #53

Closed defunctl closed 2 years ago

defunctl commented 5 years ago

If your bot receives a video/attachment that is greater than 20mb, it gets stuck in an error loop and can no longer send messages.

An exception is thrown because of this, but the Telegram API never receives a 200 response code so it just continues to send the attachment over and over.

[2018-10-14 06:42:07] production.ERROR: Error retrieving file url: Bad Request: file is too big {"exception":"[object] (BotMan\\Drivers\\Telegram\\Exceptions\\TelegramAttachmentException...

The only solution right now seems to be to unregister the webook and register it again.

defunctl commented 5 years ago

Can fix it by forcing 200 status code on exceptions: https://github.com/botman/botman/issues/881#issuecomment-422721642

Erick2011 commented 5 years ago

i just made taht and i am still getting it, any other solution?

aliwesome commented 5 years ago

you should change post_max_size value in php.ini on your server.

muchtarhanif17 commented 3 years ago

how to use function receive files botman telegram ?

filippotoso commented 2 years ago

Version 2.0 includes a breaking change where the exception is not raised.

Instead when you call getFiles(), getVideos() etc. you receive an instance of a new attachment class that includes a getException() method with the description of the error returned by the Telegram server.

You can check if the file is too large using https://www.php.net/is_a with the specific class (see https://github.com/botman/driver-telegram/tree/master/src/Extensions/Attachments)