style: 格式化代码
This commit is contained in:
@@ -19,7 +19,7 @@ from src.plugin_system.apis import (
|
||||
send_api,
|
||||
tool_api,
|
||||
permission_api,
|
||||
schedule_api
|
||||
schedule_api,
|
||||
)
|
||||
from src.plugin_system.apis.chat_api import ChatManager as context_api
|
||||
from .logging_api import get_logger
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
readable_text = message_api.build_readable_messages(messages)
|
||||
"""
|
||||
|
||||
from typing import List, Dict, Any, Tuple, Optional, Coroutine
|
||||
from typing import List, Dict, Any, Tuple, Optional
|
||||
from src.config.config import global_config
|
||||
import time
|
||||
from src.chat.utils.chat_message_builder import (
|
||||
@@ -181,9 +181,7 @@ async def get_messages_by_time_in_chat_for_users(
|
||||
raise ValueError("chat_id 不能为空")
|
||||
if not isinstance(chat_id, str):
|
||||
raise ValueError("chat_id 必须是字符串类型")
|
||||
return await get_raw_msg_by_timestamp_with_chat_users(
|
||||
chat_id, start_time, end_time, person_ids, limit, limit_mode
|
||||
)
|
||||
return await get_raw_msg_by_timestamp_with_chat_users(chat_id, start_time, end_time, person_ids, limit, limit_mode)
|
||||
|
||||
|
||||
async def get_random_chat_messages(
|
||||
@@ -384,9 +382,7 @@ async def count_new_messages(chat_id: str, start_time: float = 0.0, end_time: Op
|
||||
return await num_new_messages_since(chat_id, start_time, end_time)
|
||||
|
||||
|
||||
async def count_new_messages_for_users(
|
||||
chat_id: str, start_time: float, end_time: float, person_ids: List[str]
|
||||
) -> int:
|
||||
async def count_new_messages_for_users(chat_id: str, start_time: float, end_time: float, person_ids: List[str]) -> int:
|
||||
"""
|
||||
计算指定聊天中指定用户从开始时间到结束时间的新消息数量
|
||||
|
||||
|
||||
@@ -61,8 +61,7 @@ class PermissionAPI:
|
||||
def __init__(self):
|
||||
self._permission_manager: Optional[IPermissionManager] = None
|
||||
# 需要保留的前缀(视为绝对节点名,不再自动加 plugins.<plugin>. 前缀)
|
||||
self.RESERVED_PREFIXES: tuple[str, ...] = (
|
||||
"system.")
|
||||
self.RESERVED_PREFIXES: tuple[str, ...] = "system."
|
||||
# 系统节点列表 (name, description, default_granted)
|
||||
self._SYSTEM_NODES: list[tuple[str, str, bool]] = [
|
||||
("system.superuser", "系统超级管理员:拥有所有权限", False),
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import List, Dict, Any, Optional
|
||||
|
||||
@@ -176,4 +177,4 @@ async def ensure_monthly_plans(target_month: Optional[str] = None) -> bool:
|
||||
|
||||
async def archive_monthly_plans(target_month: Optional[str] = None) -> bool:
|
||||
"""(异步) 归档指定月份的月度计划的便捷函数"""
|
||||
return await ScheduleAPI.archive_monthly_plans(target_month)
|
||||
return await ScheduleAPI.archive_monthly_plans(target_month)
|
||||
|
||||
@@ -80,7 +80,9 @@ def message_dict_to_message_recv(message_dict: Dict[str, Any]) -> Optional[Messa
|
||||
|
||||
message_info = {
|
||||
"platform": message_dict.get("chat_info_platform", ""),
|
||||
"message_id": message_dict.get("message_id") or message_dict.get("chat_info_message_id") or message_dict.get("id"),
|
||||
"message_id": message_dict.get("message_id")
|
||||
or message_dict.get("chat_info_message_id")
|
||||
or message_dict.get("id"),
|
||||
"time": message_dict.get("time"),
|
||||
"group_info": group_info,
|
||||
"user_info": user_info,
|
||||
|
||||
Reference in New Issue
Block a user