Answer the question
In order to leave comments, you need to log in
Telegram bot stops responding to one of the functions after a few hours?
A very strange problem. The bot is written in python with the pytelegrambotapi library. webhook is not worth it, I use bot.polling
The bot has several handlers: for commands, for text and for photos. Everything works without any problems or errors. However, the photo processor becomes unresponsive a few hours after the bot is launched and does not perform its functions until the bot is manually restarted. With all this, the remaining functions of the bot work perfectly and do not stop responding to requests. The photo handler code looks like this:
@bot.message_handler(content_types=['photo'])
def sells_counter(message):
if message.chat.id in team:
vremya = (datetime.utcfromtimestamp(message.forward_date) + timedelta(hours=3)).strftime('%m-%d %H:%M')
fileID = message.photo[-1].file_id
file_info = bot.get_file(fileID)
link = "https://api.telegram.org/file/bot"+bot_token+"/"+file_info.file_path
row = [vremya, message.forward_from.first_name, message.forward_from.username,link]
sheet.append_row(row)
bot.send_message(message.chat.id,"Готово")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question