Telegram bots are supposed to have a human-like interaction. So my advise to avoid your problem would be to define a sort TYPINGSPEED
constant and combine it with the sendChatAction()
bot api call so that if "feels" like your messages are actually being written by a 'fast-typing' human being.
In ruby, it would give something like this :
your_msg.split("\n").each do |line|
writing_time=line.length/TYPINGSPEED
TelegramBot.client.api.sendChatAction(chat_id: chat_id, action: "typing")
sleep(writing_time)
TelegramBot.client.api.sendMessage(your_options)
end
sendChatAction nicely displays "nameofyourbot is writing..." on the user screen.
Of course, the drawback with this code is that the process handling the answer won't return before several seconds if your message is long (because of the use of the sleep
function). So depending of the number of simultaneous users using your bot, you'd better do some capacity planning and spawn as many process as you need to make sure your bot can handle the number of parallel discussions required.
I am doing this myself and I never experienced the issue you are describing.