2021-05-05 02:59:30 +00:00
|
|
|
from telegram.ext import Updater
|
|
|
|
from config import TOKEN
|
2021-05-05 08:13:28 +00:00
|
|
|
from func import start_handler, chat_content_handler, check_schedule
|
|
|
|
import schedule
|
2021-05-05 10:17:21 +00:00
|
|
|
from task import do_task, flush_redis
|
2021-05-05 08:13:28 +00:00
|
|
|
import threading
|
|
|
|
|
2021-05-05 10:17:21 +00:00
|
|
|
schedule.every().day.at('11:00').do(do_task)
|
|
|
|
schedule.every().day.at('18:00').do(do_task)
|
|
|
|
schedule.every().day.at('23:30').do(do_task)
|
|
|
|
schedule.every().day.at('23:59').do(flush_redis)
|
|
|
|
# schedule.every(1).minutes.do(do_task)
|
2021-05-05 08:13:28 +00:00
|
|
|
|
|
|
|
threading.Thread(target=check_schedule).start()
|
2021-05-05 02:59:30 +00:00
|
|
|
|
|
|
|
updater = Updater(token=TOKEN, use_context=True)
|
|
|
|
dispatcher = updater.dispatcher
|
|
|
|
|
|
|
|
dispatcher.add_handler(start_handler)
|
2021-05-05 03:10:01 +00:00
|
|
|
dispatcher.add_handler(chat_content_handler)
|
2021-05-05 02:59:30 +00:00
|
|
|
|
|
|
|
updater.start_polling()
|
|
|
|
updater.idle()
|