telegram-bot-api
telegram-bot-api copied to clipboard
Random read operation timeouts
I am running the bot locally (and interacting with it from the same machine) and unpredictably keep getting these errors, then no response from the bot for a very long time. Could not really find anything similar after researching for a bit.
2023/01/29 09:37:15 Error sending message: Post "https://api.telegram.org/{BOT}/sendMessage": read tcp :443: read: operation timed out
2023/01/29 09:37:15 Post "https://api.telegram.org/{BOT}/getUpdates": read tcp :443: read: operation timed out
It's doesnt' matter if you run it's locally or not. If your bot working on polling model (according to your request it's true), your message cycle looks like:
your computer -> telegram server-> your computer
so it's still should be sent to the telegram server. If you want to obtain it - you should run your local TG server and use webhooks model.
The reason of your issue - timeout of sending messages, occurs cause of network issues. If you want to avoid it - you need more stable internet connection or set more democratic timeout