Answer the question
In order to leave comments, you need to log in
How, after launching the bot (telebot), immediately start executing the function without user interaction?
Hello, I created a bot, wrote sending messages after a while and I don’t understand how to make the bot run this script without user interaction?
here is the code:
import telebot, random, time
bot = telebot.TeleBot("token")
@bot.message_handler(commands = ['start'])
def events(message):
msg = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
while True:
bot.send_message(message.chat.id, random.choice(msg))
time.sleep(5.0)
bot.polling()
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