mirror of
https://github.com/Nezumi-2711/astrbot_plugin_qq_group_daily_analysis.git
synced 2026-09-22 20:01:04 +00:00
fix(get_astrbot_data_path): fallback 到 get_astrbot_data_path 方法
This commit is contained in:
@@ -279,9 +279,21 @@ class BaseAnalyzer(ABC, Generic[TDataObject]):
|
||||
session_id: 会话ID
|
||||
"""
|
||||
try:
|
||||
from pathlib import Path
|
||||
|
||||
from astrbot.api.star import StarTools
|
||||
from astrbot.core.utils.astrbot_path import get_astrbot_data_path
|
||||
|
||||
try:
|
||||
data_path = StarTools.get_data_dir() / "debug_data"
|
||||
except Exception:
|
||||
data_path = (
|
||||
Path(get_astrbot_data_path())
|
||||
/ "plugin_data"
|
||||
/ "astrbot_plugin_qq_group_daily_analysis"
|
||||
/ "debug_data"
|
||||
)
|
||||
|
||||
data_path = StarTools.get_data_dir() / "debug_data"
|
||||
data_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
file_name = f"{session_id}_{self.get_data_type()}.txt"
|
||||
|
||||
@@ -224,17 +224,23 @@ class ConfigManager:
|
||||
|
||||
def get_pdf_output_dir(self) -> str:
|
||||
"""获取PDF输出目录"""
|
||||
from pathlib import Path
|
||||
|
||||
from astrbot.core.utils.astrbot_path import get_astrbot_data_path
|
||||
|
||||
try:
|
||||
default_path = StarTools.get_data_dir() / "reports"
|
||||
val = self._get_group("pdf").get("pdf_output_dir")
|
||||
return val if val else str(default_path)
|
||||
except Exception:
|
||||
val = self._get_group("pdf").get("pdf_output_dir")
|
||||
return (
|
||||
val
|
||||
if val
|
||||
else "data/plugins/astrbot_plugin_qq_group_daily_analysis/reports"
|
||||
fallback_path = (
|
||||
Path(get_astrbot_data_path())
|
||||
/ "plugin_data"
|
||||
/ "astrbot_plugin_qq_group_daily_analysis"
|
||||
/ "reports"
|
||||
)
|
||||
return val if val else str(fallback_path)
|
||||
|
||||
def get_bot_self_ids(self) -> list:
|
||||
"""获取机器人自身的 ID 列表 (兼容 bot_qq_ids)"""
|
||||
@@ -252,17 +258,23 @@ class ConfigManager:
|
||||
|
||||
def get_html_output_dir(self) -> str:
|
||||
"""获取HTML输出目录"""
|
||||
from pathlib import Path
|
||||
|
||||
from astrbot.core.utils.astrbot_path import get_astrbot_data_path
|
||||
|
||||
try:
|
||||
default_path = StarTools.get_data_dir() / "self_hosted_html_reports"
|
||||
val = self._get_group("html").get("html_output_dir")
|
||||
return val if val else str(default_path)
|
||||
except Exception:
|
||||
val = self._get_group("html").get("html_output_dir")
|
||||
return (
|
||||
val
|
||||
if val
|
||||
else "data/plugins/astrbot_plugin_qq_group_daily_analysis/self_hosted_html_reports"
|
||||
fallback_path = (
|
||||
Path(get_astrbot_data_path())
|
||||
/ "plugin_data"
|
||||
/ "astrbot_plugin_qq_group_daily_analysis"
|
||||
/ "self_hosted_html_reports"
|
||||
)
|
||||
return val if val else str(fallback_path)
|
||||
|
||||
def get_html_base_url(self) -> str:
|
||||
"""获取HTML外链Base URL"""
|
||||
|
||||
Reference in New Issue
Block a user