允许消息内容中包含HTML代码并直接渲染 | 将纯相对路径改为基于脚本文件的绝对路径,便于全局调用

This commit is contained in:
wangmc1024
2026-03-05 22:59:26 +08:00
parent 19d4e65133
commit ffd08bcd21
8 changed files with 64 additions and 37 deletions

View File

@@ -4,7 +4,8 @@ from datetime import datetime
INTERVAL = 60 # 原版 55+random*10
ONCE = False
PENDING = './sche_tasks/pending'
script_dir = os.path.dirname(os.path.abspath(__file__))
PENDING = os.path.join(script_dir, '../sche_tasks/pending')
def check():
if not os.path.isdir(PENDING): return None
@@ -12,6 +13,6 @@ def check():
for f in os.listdir(PENDING):
m = re.match(r'(\d{4}-\d{2}-\d{2})_(\d{4})_', f)
if m and now >= datetime.strptime(f'{m[1]} {m[2]}', '%Y-%m-%d %H%M'):
raw = open(f'{PENDING}/{f}', encoding='utf-8').read()
raw = open(os.path.join(PENDING, f), encoding='utf-8').read()
return f'按scheduled_task_sop执行任务文件 ../sche_tasks/pending/{f}立刻移到running\n内容:\n{raw}'
return None