chore: 添加自动每日运行时间提示 (#201)

* 🔧 自动更新requirements

* chore: 添加自动每日运行时间提示

* chore: 将时间类型从str改成int

* Add files via upload

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Night-stars-1 2023-11-24 15:56:12 +08:00 committed by GitHub
parent 23360a63b2
commit fe7d6cf800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -42,11 +42,14 @@ async def main():
if __name__ == "__main__":
if _conf.preference.hour and _conf.preference.minute:
HOUR = _conf.preference.hour
MINUTE = _conf.preference.minute
if HOUR and MINUTE:
log.info(f"脚本将在每日{HOUR}:{MINUTE}自动运行")
# 创建一个新的事件循环
loop = asyncio.get_event_loop()
scheduler = AsyncIOScheduler()
scheduler.add_job(main, 'cron', hour=_conf.preference.hour, minute=_conf.preference.minute, id='miuitask')
scheduler.add_job(main, 'cron', hour=HOUR, minute=MINUTE, id='miuitask')
scheduler.start()
try:
loop.run_forever()

View File

@ -4,7 +4,6 @@ httpx==0.25.1
loguru==0.7.2
onepush==1.3.0
orjson==3.9.10
pydantic==2.5.1
pydantic==2.5.2
PyYAML==6.0.1
tenacity==8.2.3
tzdata==2023.3

View File

@ -97,9 +97,9 @@ class Preference(BaseModel):
"""极验自定义params参数"""
geetest_data: Dict = {}
"""极验自定义data参数"""
hour: Optional[str] = None
hour: Optional[int] = None
"""自动执行的时间"""
minute: Optional[str] = None
minute: Optional[int] = None
"""自动执行的时间"""