chore: sync current WechatHookBot workspace

This commit is contained in:
2026-03-09 15:48:45 +08:00
parent 4016c1e6eb
commit 9119e2307d
195 changed files with 24438 additions and 17498 deletions

View File

@@ -24,6 +24,7 @@ except ImportError:
from utils.plugin_base import PluginBase
from utils.decorators import on_text_message
from utils.member_info_service import get_member_service
from WechatHook import WechatHookClient
@@ -189,14 +190,15 @@ class DeerCheckin(PluginBase):
async def _handle_checkin(self, bot: WechatHookClient, from_wxid: str, user_id: str, nickname: str, content: str):
"""处理打卡"""
# 获取真实昵称
# 获取真实昵称(使用 MemberSync 数据库)
if from_wxid.endswith("@chatroom"):
try:
user_info = await bot.get_user_info_in_chatroom(from_wxid, user_id)
if user_info and user_info.get("nickName", {}).get("string"):
nickname = user_info["nickName"]["string"]
except:
pass
member_service = get_member_service()
member_nickname = await member_service.get_chatroom_member_nickname(from_wxid, user_id)
if member_nickname:
nickname = member_nickname
except Exception as e:
logger.debug(f"[DeerCheckin] 获取昵称失败: {e}")
deer_count = content.count("🦌")
today_str = date.today().strftime("%Y-%m-%d")
@@ -350,9 +352,8 @@ class DeerCheckin(PluginBase):
)
if image_path:
# 发送图片
data = {"to_wxid": from_wxid, "file": str(image_path)}
await bot._send_data_async(11040, data)
# 发送图片 - 使用新的 HTTP API
await bot.send_image(from_wxid, str(image_path))
# 不删除临时文件
else:
@@ -481,60 +482,9 @@ class DeerCheckin(PluginBase):
def get_llm_tools(self) -> List[dict]:
"""返回LLM工具定义供AIChat插件调用"""
return [
{
"type": "function",
"function": {
"name": "deer_checkin",
"description": "仅当用户明确要求“鹿打卡/鹿签到/记录今天的鹿数量”时调用;不要在闲聊、绘图或其他问题中调用。",
"parameters": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"description": "鹿的数量默认为1",
"default": 1
}
},
"required": []
}
}
},
{
"type": "function",
"function": {
"name": "view_calendar",
"description": "仅当用户明确要求“查看鹿打卡日历/本月打卡记录/打卡日历”时调用。",
"parameters": {
"type": "object",
"properties": {},
"required": []
}
}
},
{
"type": "function",
"function": {
"name": "makeup_checkin",
"description": "仅当用户明确要求“补签/补打卡某日期”时调用,不要自动触发。",
"parameters": {
"type": "object",
"properties": {
"day": {
"type": "integer",
"description": "要补签的日期1-31"
},
"count": {
"type": "integer",
"description": "补签的鹿数量",
"default": 1
}
},
"required": ["day"]
}
}
}
]
# 所有工具已移除,因为太容易误触发
# 用户可以直接发送🦌表情来触发打卡功能
return []
async def execute_llm_tool(self, tool_name: str, arguments: dict, bot, from_wxid: str) -> dict:
"""执行LLM工具调用供AIChat插件调用"""