-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask_note.py
More file actions
62 lines (44 loc) · 1.58 KB
/
task_note.py
File metadata and controls
62 lines (44 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import asyncio
import os
import sys
import json
# 将当前目录加入搜索路径应在所有 import 前完成
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from config import logger
from models import project_config
from utils import push, init_config
from core import manually_genshin_note_check, manually_starrail_note_check
# 定义推送标题常量
TITLE_GENSHIN = "原神便签查询"
TITLE_STARRAIL = "星铁便签查询"
try:
init_config(project_config.push_config)
except Exception as e:
error_msg = f"❌初始化推送配置失败:{e}"
logger.error(error_msg)
print(error_msg)
exit(1)
async def execute_genshin_check():
"""执行原神便签检查"""
try:
result = await manually_genshin_note_check()
if result.is_success:
push(title=TITLE_GENSHIN, push_message=result.message)
except Exception as e:
logger.error(f"执行原神便签检查时发生异常: {e}")
async def execute_starrail_check():
"""执行星铁便签检查"""
try:
result = await manually_starrail_note_check()
if result.is_success:
push(title=TITLE_STARRAIL, push_message=result.message)
except Exception as e:
logger.error(f"执行星铁便签检查时发生异常: {e}")
async def main_task():
logger.info("⏳开始执行脚本note.py...")
await execute_genshin_check()
await asyncio.sleep(project_config.preference.sleep_time)
await execute_starrail_check()
logger.info("✅任务执行完毕!")
if __name__ == "__main__":
asyncio.run(main_task())