11
This commit is contained in:
+2
-15
@@ -1,25 +1,12 @@
|
||||
from pathlib import Path
|
||||
from datetime import datetime,date
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
import aiofiles
|
||||
import base64
|
||||
import os
|
||||
|
||||
from astrbot import logger
|
||||
|
||||
async def load_template(template_name: str) -> str:
|
||||
"""
|
||||
异步加载模板内容(非阻塞)
|
||||
"""
|
||||
plugin_dir = Path(__file__).parent.parent
|
||||
template_path = plugin_dir / "templates" / template_name
|
||||
|
||||
if not template_path.exists():
|
||||
raise FileNotFoundError(f"模板文件不存在: {template_path}")
|
||||
|
||||
async with aiofiles.open(template_path, "r", encoding="utf-8") as f:
|
||||
return await f.read()
|
||||
from .template import load_template
|
||||
|
||||
|
||||
def gold_to_string(gold_amount):
|
||||
@@ -161,4 +148,4 @@ def format_remaining(ts):
|
||||
minutes, seconds = divmod(seconds, 60)
|
||||
return f"{hours}时{minutes:02d}分{seconds:02d}秒"
|
||||
except (TypeError, ValueError):
|
||||
return ""
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user