Merge branch 'r-dev' of github.com:Mai-with-u/MaiBot into r-dev

This commit is contained in:
UnCLAS-Prommer
2026-02-21 23:50:53 +08:00
91 changed files with 2110 additions and 1967 deletions

View File

@@ -9,6 +9,7 @@ from src.common.database.database import get_db_session
logger = get_logger("file_utils")
class FileUtils:
@staticmethod
def save_binary_to_file(file_path: Path, data: bytes):
@@ -35,7 +36,7 @@ class FileUtils:
except Exception as e:
logger.error(f"保存文件 {file_path} 失败: {e}")
raise e
@staticmethod
def get_file_path_by_hash(data_hash: str) -> Path:
"""
@@ -52,4 +53,4 @@ class FileUtils:
if binary_data := session.exec(statement).first():
return Path(binary_data.full_path)
else:
raise FileNotFoundError(f"未找到哈希值为 {data_hash} 的数据文件记录")
raise FileNotFoundError(f"未找到哈希值为 {data_hash} 的数据文件记录")