添加报表生成时间段

This commit is contained in:
机器人总动员 2021-05-05 18:17:21 +08:00
parent c8a7ed09dd
commit 48d0cec7ba
3 changed files with 14 additions and 5 deletions

View File

@ -20,10 +20,12 @@ def chat_content_exec(update, context):
r = connector.get_connection()
text = update.message.text
chat_type = update.effective_chat.type
if chat_type != "supergroup":
return
user_id = update.effective_user.id
chat_id = update.effective_message.chat_id
if chat_type != "supergroup":
return
# if chat_id not in ["1231242141"]:
# return
try:
username = update.effective_user.username
except Exception as e:

View File

@ -2,11 +2,14 @@ from telegram.ext import Updater
from config import TOKEN
from func import start_handler, chat_content_handler, check_schedule
import schedule
from task import do_task
from task import do_task, flush_redis
import threading
schedule.every().day.at('23:30').do(do_task).tag('task')
# schedule.every(1).minutes.do(do_task).tag('task')
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)
threading.Thread(target=check_schedule).start()

View File

@ -127,5 +127,9 @@ def do_task():
except Exception as e:
print(e)
continue
def flush_redis():
r = connector.get_connection()
r.flushall()
print("已清空数据库")