In telegram client you can send a scheduled message and select a time at which it will be sent. Is there a way to do that using python Telebot library and not keep the script running and checking time manually?
Advertisement
Answer
You could use modules like apscheduler
example usage:
import telebot from apscheduler.schedulers.blocking import BlockingScheduler sched = BlockingScheduler() bot = telebot.TeleBot('token') def my_interval_job(): bot.send_message("WARNERSTARK", "Goodmorning. its 6am!") ... # do more at 6 am sched.add_job(my_interval_job, trigger="cron", hour=6) sched.start()
The above example sends a message to user at 6 am.
Read More