rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.69k stars 1.19k forks source link

TelegramApiException Error at sendmessage Too Many Requests but not error of 42X #132

Closed azimot closed 8 years ago

azimot commented 8 years ago

i launch bot to communicate to users but after some messages i catch exception

it's dont tell me what is the error number , before i had error of 429 when bot sending sequential messages to a channel https://core.telegram.org/api/errors#420-flood

why that happen and how to resolve it ?!

` org.telegram.telegrambots.TelegramApiException: Error at sendmessage: Too Many Requests: retry after 234 at org.telegram.telegrambots.bots.AbsSender.sendApiMethod(AbsSender.java:989) at org.telegram.telegrambots.bots.AbsSender.sendMessage(AbsSender.java:109) at org.telegram.updateshandlers.CustomStaticBotWorker.doUpdateFacade(CustomStaticBotWorker.java:34) at statics.V$1.onUpdateReceived(V.java:408) at org.telegram.telegrambots.updatesreceivers.BotSession$HandlerThread.run(BotSession.java:180)

`

rubenlagus commented 8 years ago

Can't make anything with this, you are hitting Telegram flood limits, as the error say, you need to wait 234 seconds before the block goes away.

And, btw, the link you point to belong to Telegram API, not the Telegram Bots API, there is no real docs for errors in bots api.

azimot commented 8 years ago

so many users wants to work with Bot and that means in now it's 1000 call per min . every message of user have a answer of Bot , also i can not to make more Bot and say to users if Bot 1 dont answered then try to calling by Bot 2 . how to could resolve it in a busy Bot ? by sendMessageAsync method i have better situation but problem is exist yet !