Answer the question
In order to leave comments, you need to log in
How to stop the looped telegram bot function (telebot)?
I am writing a bot using the telebot library. How can you stop the execution of a looped function without catching an exception?
@bot.message_handler(commands=['start_scraping'])
def sender(message):
bot.send_message(
message.chat.id,
"Начал парсинг"
)
while True:
bot_message = sent_to_user
bot.send_message(message.chat.id, bot_message())
Answer the question
In order to leave comments, you need to log in
In the specified form - no way, the bot, as far as I can tell, is single-threaded, and this one thread will be busy with the while True loop.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question