go-telegram-bot-api / telegram-bot-api

Golang bindings for the Telegram Bot API
https://go-telegram-bot-api.dev
MIT License
5.58k stars 863 forks source link

Random read operation timeouts #631

Open Chief-Alchemist opened 1 year ago

Chief-Alchemist commented 1 year ago

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

IvanDanilau commented 9 months ago

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