feat(onebot): expose system face catalog queries
Add read-only actions for catalog retrieval, per-face lookup, search, and super-face classification. Publish matching SDK methods and generated MCP schemas, including valid face ID zero.
This commit is contained in:
11 files changed
+1257
-3
No files matched your search
@@ -2030,6 +2030,147 @@
|
|||||||
},
|
},
|
||||||
"category": "扩展"
|
"category": "扩展"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "fetch_face_entity",
|
||||||
|
"aliases": [],
|
||||||
|
"summary": "按编号查询 QQ 系统表情",
|
||||||
|
"returns": "表情详情;编号不存在时返回 null。",
|
||||||
|
"returnsSchema": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"q_sid": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情编号"
|
||||||
|
},
|
||||||
|
"q_des": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情描述"
|
||||||
|
},
|
||||||
|
"em_code": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"q_cid": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_type": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_pack_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"emoji_name_alias": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ani_sticker_width": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_height": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"is_super": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否使用超级表情格式"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"q_sid",
|
||||||
|
"q_des",
|
||||||
|
"em_code",
|
||||||
|
"q_cid",
|
||||||
|
"ani_sticker_type",
|
||||||
|
"ani_sticker_pack_id",
|
||||||
|
"ani_sticker_id",
|
||||||
|
"url",
|
||||||
|
"emoji_name_alias",
|
||||||
|
"ani_sticker_width",
|
||||||
|
"ani_sticker_height",
|
||||||
|
"is_super"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"readOnly": true,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "face_id",
|
||||||
|
"type": "int",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"role": "face_id",
|
||||||
|
"desc": "QQ 系统表情编号"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "refresh",
|
||||||
|
"type": "bool",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"default": false,
|
||||||
|
"desc": "是否强制从 QQ 刷新目录"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"invariants": [],
|
||||||
|
"inputSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"face_id": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"description": "QQ 系统表情编号",
|
||||||
|
"x-role": "face_id"
|
||||||
|
},
|
||||||
|
"refresh": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否强制从 QQ 刷新目录",
|
||||||
|
"default": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"face_id"
|
||||||
|
],
|
||||||
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"category": "系统表情"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "fetch_ptt_text",
|
"name": "fetch_ptt_text",
|
||||||
"aliases": [
|
"aliases": [
|
||||||
@@ -2077,6 +2218,209 @@
|
|||||||
},
|
},
|
||||||
"category": "扩展"
|
"category": "扩展"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "fetch_super_face_id",
|
||||||
|
"aliases": [],
|
||||||
|
"summary": "判断 QQ 系统表情是否使用超级表情格式",
|
||||||
|
"returns": "是否使用超级表情格式。",
|
||||||
|
"returnsSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"is_super": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"is_super"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"readOnly": true,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "face_id",
|
||||||
|
"type": "int",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"role": "face_id",
|
||||||
|
"desc": "QQ 系统表情编号"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "refresh",
|
||||||
|
"type": "bool",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"default": false,
|
||||||
|
"desc": "是否强制从 QQ 刷新目录"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"invariants": [],
|
||||||
|
"inputSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"face_id": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"description": "QQ 系统表情编号",
|
||||||
|
"x-role": "face_id"
|
||||||
|
},
|
||||||
|
"refresh": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否强制从 QQ 刷新目录",
|
||||||
|
"default": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"face_id"
|
||||||
|
],
|
||||||
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"category": "系统表情"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fetch_sys_faces",
|
||||||
|
"aliases": [],
|
||||||
|
"summary": "获取 QQ 系统表情目录",
|
||||||
|
"returns": "按分组返回完整的 QQ 系统表情映射。",
|
||||||
|
"returnsSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"packs": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"pack_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"emojis": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"q_sid": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情编号"
|
||||||
|
},
|
||||||
|
"q_des": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情描述"
|
||||||
|
},
|
||||||
|
"em_code": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"q_cid": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_type": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_pack_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"emoji_name_alias": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ani_sticker_width": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_height": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"is_super": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否使用超级表情格式"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"q_sid",
|
||||||
|
"q_des",
|
||||||
|
"em_code",
|
||||||
|
"q_cid",
|
||||||
|
"ani_sticker_type",
|
||||||
|
"ani_sticker_pack_id",
|
||||||
|
"ani_sticker_id",
|
||||||
|
"url",
|
||||||
|
"emoji_name_alias",
|
||||||
|
"ani_sticker_width",
|
||||||
|
"ani_sticker_height",
|
||||||
|
"is_super"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"pack_name",
|
||||||
|
"emojis"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"packs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"readOnly": true,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "refresh",
|
||||||
|
"type": "bool",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"default": false,
|
||||||
|
"desc": "是否强制从 QQ 刷新目录"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"invariants": [],
|
||||||
|
"inputSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"refresh": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否强制从 QQ 刷新目录",
|
||||||
|
"default": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"category": "系统表情"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "forward_friend_single_msg",
|
"name": "forward_friend_single_msg",
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
@@ -7373,6 +7717,134 @@
|
|||||||
},
|
},
|
||||||
"category": "扩展"
|
"category": "扩展"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "search_sys_faces",
|
||||||
|
"aliases": [],
|
||||||
|
"summary": "搜索 QQ 系统表情",
|
||||||
|
"returns": "匹配编号、名称、别名或分组名的表情列表。",
|
||||||
|
"returnsSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"faces": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"q_sid": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情编号"
|
||||||
|
},
|
||||||
|
"q_des": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情描述"
|
||||||
|
},
|
||||||
|
"em_code": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"q_cid": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_type": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_pack_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"emoji_name_alias": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ani_sticker_width": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_height": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"is_super": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否使用超级表情格式"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"q_sid",
|
||||||
|
"q_des",
|
||||||
|
"em_code",
|
||||||
|
"q_cid",
|
||||||
|
"ani_sticker_type",
|
||||||
|
"ani_sticker_pack_id",
|
||||||
|
"ani_sticker_id",
|
||||||
|
"url",
|
||||||
|
"emoji_name_alias",
|
||||||
|
"ani_sticker_width",
|
||||||
|
"ani_sticker_height",
|
||||||
|
"is_super"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"faces"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"readOnly": true,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "query",
|
||||||
|
"type": "string",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1
|
||||||
|
},
|
||||||
|
"desc": "编号、名称、别名或分组名"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"invariants": [],
|
||||||
|
"inputSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"query": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1,
|
||||||
|
"description": "编号、名称、别名或分组名"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"query"
|
||||||
|
],
|
||||||
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"category": "系统表情"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "send_ark_share",
|
"name": "send_ark_share",
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
@@ -11049,6 +11521,10 @@
|
|||||||
"category": "空间",
|
"category": "空间",
|
||||||
"count": 9
|
"count": 9
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"category": "系统表情",
|
||||||
|
"count": 4
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"category": "流式接口",
|
"category": "流式接口",
|
||||||
"count": 6
|
"count": 6
|
||||||
|
|||||||
@@ -2033,6 +2033,147 @@ export const ACTIONS: CatalogAction[] = [
|
|||||||
},
|
},
|
||||||
"category": "扩展"
|
"category": "扩展"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "fetch_face_entity",
|
||||||
|
"aliases": [],
|
||||||
|
"summary": "按编号查询 QQ 系统表情",
|
||||||
|
"returns": "表情详情;编号不存在时返回 null。",
|
||||||
|
"returnsSchema": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"q_sid": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情编号"
|
||||||
|
},
|
||||||
|
"q_des": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情描述"
|
||||||
|
},
|
||||||
|
"em_code": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"q_cid": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_type": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_pack_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"emoji_name_alias": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ani_sticker_width": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_height": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"is_super": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否使用超级表情格式"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"q_sid",
|
||||||
|
"q_des",
|
||||||
|
"em_code",
|
||||||
|
"q_cid",
|
||||||
|
"ani_sticker_type",
|
||||||
|
"ani_sticker_pack_id",
|
||||||
|
"ani_sticker_id",
|
||||||
|
"url",
|
||||||
|
"emoji_name_alias",
|
||||||
|
"ani_sticker_width",
|
||||||
|
"ani_sticker_height",
|
||||||
|
"is_super"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"readOnly": true,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "face_id",
|
||||||
|
"type": "int",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"role": "face_id",
|
||||||
|
"desc": "QQ 系统表情编号"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "refresh",
|
||||||
|
"type": "bool",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"default": false,
|
||||||
|
"desc": "是否强制从 QQ 刷新目录"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"invariants": [],
|
||||||
|
"inputSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"face_id": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"description": "QQ 系统表情编号",
|
||||||
|
"x-role": "face_id"
|
||||||
|
},
|
||||||
|
"refresh": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否强制从 QQ 刷新目录",
|
||||||
|
"default": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"face_id"
|
||||||
|
],
|
||||||
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"category": "系统表情"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "fetch_ptt_text",
|
"name": "fetch_ptt_text",
|
||||||
"aliases": [
|
"aliases": [
|
||||||
@@ -2080,6 +2221,209 @@ export const ACTIONS: CatalogAction[] = [
|
|||||||
},
|
},
|
||||||
"category": "扩展"
|
"category": "扩展"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "fetch_super_face_id",
|
||||||
|
"aliases": [],
|
||||||
|
"summary": "判断 QQ 系统表情是否使用超级表情格式",
|
||||||
|
"returns": "是否使用超级表情格式。",
|
||||||
|
"returnsSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"is_super": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"is_super"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"readOnly": true,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "face_id",
|
||||||
|
"type": "int",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"role": "face_id",
|
||||||
|
"desc": "QQ 系统表情编号"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "refresh",
|
||||||
|
"type": "bool",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"default": false,
|
||||||
|
"desc": "是否强制从 QQ 刷新目录"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"invariants": [],
|
||||||
|
"inputSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"face_id": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"description": "QQ 系统表情编号",
|
||||||
|
"x-role": "face_id"
|
||||||
|
},
|
||||||
|
"refresh": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否强制从 QQ 刷新目录",
|
||||||
|
"default": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"face_id"
|
||||||
|
],
|
||||||
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"category": "系统表情"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fetch_sys_faces",
|
||||||
|
"aliases": [],
|
||||||
|
"summary": "获取 QQ 系统表情目录",
|
||||||
|
"returns": "按分组返回完整的 QQ 系统表情映射。",
|
||||||
|
"returnsSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"packs": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"pack_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"emojis": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"q_sid": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情编号"
|
||||||
|
},
|
||||||
|
"q_des": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情描述"
|
||||||
|
},
|
||||||
|
"em_code": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"q_cid": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_type": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_pack_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"emoji_name_alias": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ani_sticker_width": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_height": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"is_super": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否使用超级表情格式"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"q_sid",
|
||||||
|
"q_des",
|
||||||
|
"em_code",
|
||||||
|
"q_cid",
|
||||||
|
"ani_sticker_type",
|
||||||
|
"ani_sticker_pack_id",
|
||||||
|
"ani_sticker_id",
|
||||||
|
"url",
|
||||||
|
"emoji_name_alias",
|
||||||
|
"ani_sticker_width",
|
||||||
|
"ani_sticker_height",
|
||||||
|
"is_super"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"pack_name",
|
||||||
|
"emojis"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"packs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"readOnly": true,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "refresh",
|
||||||
|
"type": "bool",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"default": false,
|
||||||
|
"desc": "是否强制从 QQ 刷新目录"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"invariants": [],
|
||||||
|
"inputSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"refresh": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否强制从 QQ 刷新目录",
|
||||||
|
"default": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"category": "系统表情"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "forward_friend_single_msg",
|
"name": "forward_friend_single_msg",
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
@@ -7376,6 +7720,134 @@ export const ACTIONS: CatalogAction[] = [
|
|||||||
},
|
},
|
||||||
"category": "扩展"
|
"category": "扩展"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "search_sys_faces",
|
||||||
|
"aliases": [],
|
||||||
|
"summary": "搜索 QQ 系统表情",
|
||||||
|
"returns": "匹配编号、名称、别名或分组名的表情列表。",
|
||||||
|
"returnsSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"faces": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"q_sid": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情编号"
|
||||||
|
},
|
||||||
|
"q_des": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "表情描述"
|
||||||
|
},
|
||||||
|
"em_code": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"q_cid": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_type": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_pack_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_id": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"emoji_name_alias": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ani_sticker_width": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ani_sticker_height": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"is_super": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "是否使用超级表情格式"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"q_sid",
|
||||||
|
"q_des",
|
||||||
|
"em_code",
|
||||||
|
"q_cid",
|
||||||
|
"ani_sticker_type",
|
||||||
|
"ani_sticker_pack_id",
|
||||||
|
"ani_sticker_id",
|
||||||
|
"url",
|
||||||
|
"emoji_name_alias",
|
||||||
|
"ani_sticker_width",
|
||||||
|
"ani_sticker_height",
|
||||||
|
"is_super"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"faces"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"readOnly": true,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "query",
|
||||||
|
"type": "string",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1
|
||||||
|
},
|
||||||
|
"desc": "编号、名称、别名或分组名"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"invariants": [],
|
||||||
|
"inputSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"query": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1,
|
||||||
|
"description": "编号、名称、别名或分组名"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"query"
|
||||||
|
],
|
||||||
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"category": "系统表情"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "send_ark_share",
|
"name": "send_ark_share",
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
@@ -11053,6 +11525,10 @@ export const CATEGORIES: CatalogCategory[] = [
|
|||||||
"category": "空间",
|
"category": "空间",
|
||||||
"count": 9
|
"count": 9
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"category": "系统表情",
|
||||||
|
"count": 4
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"category": "流式接口",
|
"category": "流式接口",
|
||||||
"count": 6
|
"count": 6
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import { actions as groupAlbumActions } from './group-album';
|
|||||||
import { actions as qzoneActions } from './qzone';
|
import { actions as qzoneActions } from './qzone';
|
||||||
import { actions as streamFileActions } from './stream-file';
|
import { actions as streamFileActions } from './stream-file';
|
||||||
import { actions as streamDownloadActions } from './stream-download';
|
import { actions as streamDownloadActions } from './stream-download';
|
||||||
|
import { actions as systemFaceActions } from './system-face';
|
||||||
|
|
||||||
export interface ActionGroup {
|
export interface ActionGroup {
|
||||||
/** Domain category (= source file), surfaced to the MCP / UI for grouping. */
|
/** Domain category (= source file), surfaced to the MCP / UI for grouping. */
|
||||||
@@ -196,6 +197,7 @@ export const ACTION_GROUPS: readonly ActionGroup[] = [
|
|||||||
{ category: '扩展', actions: extendedActions },
|
{ category: '扩展', actions: extendedActions },
|
||||||
{ category: '群相册', actions: groupAlbumActions },
|
{ category: '群相册', actions: groupAlbumActions },
|
||||||
{ category: '空间', actions: qzoneActions },
|
{ category: '空间', actions: qzoneActions },
|
||||||
|
{ category: '系统表情', actions: systemFaceActions },
|
||||||
{ category: '流式接口', actions: [...streamFileActions, ...streamDownloadActions] },
|
{ category: '流式接口', actions: [...streamFileActions, ...streamDownloadActions] },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,137 @@
|
|||||||
|
import { isSuperFaceEntry } from '@snowluma/protocol/oidb-services/sys-faces/fetch-sys-faces';
|
||||||
|
import type { SysFaceEntry } from '@snowluma/protocol/sys-face-store';
|
||||||
|
import { defineAction, f } from '../action-kit';
|
||||||
|
import { okResponse, type JsonObject } from '../types';
|
||||||
|
|
||||||
|
function faceEntry(face: SysFaceEntry): JsonObject {
|
||||||
|
return {
|
||||||
|
q_sid: face.qSid,
|
||||||
|
q_des: face.qDes,
|
||||||
|
em_code: face.emCode,
|
||||||
|
q_cid: face.qCid,
|
||||||
|
ani_sticker_type: face.aniStickerType,
|
||||||
|
ani_sticker_pack_id: face.aniStickerPackId,
|
||||||
|
ani_sticker_id: face.aniStickerId,
|
||||||
|
url: face.url,
|
||||||
|
emoji_name_alias: face.emojiNameAlias,
|
||||||
|
ani_sticker_width: face.aniStickerWidth,
|
||||||
|
ani_sticker_height: face.aniStickerHeight,
|
||||||
|
is_super: isSuperFaceEntry(face),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const refreshField = () => f.bool().default(false).describe('是否强制从 QQ 刷新目录');
|
||||||
|
const faceIdField = () => f.faceId().describe('QQ 系统表情编号');
|
||||||
|
const nullableInteger = { type: ['integer', 'null'] };
|
||||||
|
const nullableString = { type: ['string', 'null'] };
|
||||||
|
const faceSchema = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
q_sid: { type: 'string', description: '表情编号' },
|
||||||
|
q_des: { type: 'string', description: '表情描述' },
|
||||||
|
em_code: { type: 'string' },
|
||||||
|
q_cid: nullableInteger,
|
||||||
|
ani_sticker_type: nullableInteger,
|
||||||
|
ani_sticker_pack_id: nullableInteger,
|
||||||
|
ani_sticker_id: nullableInteger,
|
||||||
|
url: nullableString,
|
||||||
|
emoji_name_alias: { type: 'array', items: { type: 'string' } },
|
||||||
|
ani_sticker_width: nullableInteger,
|
||||||
|
ani_sticker_height: nullableInteger,
|
||||||
|
is_super: { type: 'boolean', description: '是否使用超级表情格式' },
|
||||||
|
},
|
||||||
|
required: [
|
||||||
|
'q_sid', 'q_des', 'em_code', 'q_cid', 'ani_sticker_type',
|
||||||
|
'ani_sticker_pack_id', 'ani_sticker_id', 'url', 'emoji_name_alias',
|
||||||
|
'ani_sticker_width', 'ani_sticker_height', 'is_super',
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export const actions = [
|
||||||
|
defineAction({
|
||||||
|
name: 'fetch_sys_faces',
|
||||||
|
summary: '获取 QQ 系统表情目录',
|
||||||
|
readOnly: true,
|
||||||
|
returns: '按分组返回完整的 QQ 系统表情映射。',
|
||||||
|
returnsSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
packs: {
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
pack_name: { type: 'string' },
|
||||||
|
emojis: { type: 'array', items: faceSchema },
|
||||||
|
},
|
||||||
|
required: ['pack_name', 'emojis'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ['packs'],
|
||||||
|
},
|
||||||
|
params: { refresh: refreshField() },
|
||||||
|
run: async (params, ctx) => {
|
||||||
|
const packs = await ctx.bridge.apis.systemFace.fetchCatalog(params.refresh);
|
||||||
|
return okResponse({
|
||||||
|
packs: packs.map((pack) => ({
|
||||||
|
pack_name: pack.packName,
|
||||||
|
emojis: pack.emojis.map(faceEntry),
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
|
defineAction({
|
||||||
|
name: 'fetch_face_entity',
|
||||||
|
summary: '按编号查询 QQ 系统表情',
|
||||||
|
readOnly: true,
|
||||||
|
returns: '表情详情;编号不存在时返回 null。',
|
||||||
|
returnsSchema: { anyOf: [faceSchema, { type: 'null' }] },
|
||||||
|
params: {
|
||||||
|
face_id: faceIdField(),
|
||||||
|
refresh: refreshField(),
|
||||||
|
},
|
||||||
|
run: async (params, ctx) => {
|
||||||
|
const face = await ctx.bridge.apis.systemFace.fetchFace(params.face_id, params.refresh);
|
||||||
|
return okResponse(face ? faceEntry(face) : null);
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
|
defineAction({
|
||||||
|
name: 'search_sys_faces',
|
||||||
|
summary: '搜索 QQ 系统表情',
|
||||||
|
readOnly: true,
|
||||||
|
returns: '匹配编号、名称、别名或分组名的表情列表。',
|
||||||
|
returnsSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: { faces: { type: 'array', items: faceSchema } },
|
||||||
|
required: ['faces'],
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
query: f.string({ allowEmpty: false }).describe('编号、名称、别名或分组名'),
|
||||||
|
},
|
||||||
|
run: async (params, ctx) => okResponse({
|
||||||
|
faces: (await ctx.bridge.apis.systemFace.search(params.query)).map(faceEntry),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
|
||||||
|
defineAction({
|
||||||
|
name: 'fetch_super_face_id',
|
||||||
|
summary: '判断 QQ 系统表情是否使用超级表情格式',
|
||||||
|
readOnly: true,
|
||||||
|
returns: '是否使用超级表情格式。',
|
||||||
|
returnsSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: { is_super: { type: 'boolean' } },
|
||||||
|
required: ['is_super'],
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
face_id: faceIdField(),
|
||||||
|
refresh: refreshField(),
|
||||||
|
},
|
||||||
|
run: async (params, ctx) => okResponse({
|
||||||
|
is_super: await ctx.bridge.apis.systemFace.isSuper(params.face_id, params.refresh),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
];
|
||||||
@@ -90,9 +90,9 @@ describe('compileActionRegistry namespace conflicts', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('compiled production Action registry', () => {
|
describe('compiled production Action registry', () => {
|
||||||
it('preserves all 181 canonical Action docs', () => {
|
it('preserves all 185 canonical Action docs', () => {
|
||||||
expect(ACTION_REGISTRY.actions).toHaveLength(181);
|
expect(ACTION_REGISTRY.actions).toHaveLength(185);
|
||||||
expect(collectActionDocs()).toHaveLength(181);
|
expect(collectActionDocs()).toHaveLength(185);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('resolves every executable name to exactly one canonical doc', () => {
|
it('resolves every executable name to exactly one canonical doc', () => {
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import { describe, expect, it, vi } from 'vitest';
|
||||||
|
import type { BridgeInterface } from '@snowluma/core/bridge-interface';
|
||||||
|
import { ApiHandler, type ApiActionContext } from '../src/api-handler';
|
||||||
|
|
||||||
|
const FACE = {
|
||||||
|
qSid: '392', qDes: '/龙年快乐', emCode: '10392', qCid: 392,
|
||||||
|
aniStickerType: 3, aniStickerPackId: 1, aniStickerId: 38,
|
||||||
|
url: 'https://example.invalid/392', emojiNameAlias: ['dragon'],
|
||||||
|
aniStickerWidth: 200, aniStickerHeight: 200,
|
||||||
|
};
|
||||||
|
|
||||||
|
function handler(systemFace: Record<string, unknown>): ApiHandler {
|
||||||
|
const bridge = { apis: { systemFace } } as unknown as BridgeInterface;
|
||||||
|
return new ApiHandler({ bridge } as ApiActionContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('system face actions', () => {
|
||||||
|
it('returns the full pack mapping and supports an explicit server refresh', async () => {
|
||||||
|
const fetchCatalog = vi.fn(async () => [{ packName: '超级表情', emojis: [FACE] }]);
|
||||||
|
const response = await handler({ fetchCatalog }).handle('fetch_sys_faces', { refresh: true });
|
||||||
|
|
||||||
|
expect(fetchCatalog).toHaveBeenCalledWith(true);
|
||||||
|
expect(response).toMatchObject({
|
||||||
|
status: 'ok',
|
||||||
|
data: {
|
||||||
|
packs: [{
|
||||||
|
pack_name: '超级表情',
|
||||||
|
emojis: [{ q_sid: '392', q_des: '/龙年快乐', is_super: true }],
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('looks up one id without redownloading a fresh catalog', async () => {
|
||||||
|
const fetchFace = vi.fn(async () => FACE);
|
||||||
|
const response = await handler({ fetchFace }).handle('fetch_face_entity', { face_id: '392' });
|
||||||
|
|
||||||
|
expect(fetchFace).toHaveBeenCalledWith(392, false);
|
||||||
|
expect(response).toMatchObject({ status: 'ok', data: { q_sid: '392', q_des: '/龙年快乐' } });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('accepts face id 0', async () => {
|
||||||
|
const fetchFace = vi.fn(async () => ({ ...FACE, qSid: '0', qDes: '/惊讶' }));
|
||||||
|
const response = await handler({ fetchFace }).handle('fetch_face_entity', { face_id: 0 });
|
||||||
|
|
||||||
|
expect(fetchFace).toHaveBeenCalledWith(0, false);
|
||||||
|
expect(response).toMatchObject({ status: 'ok', data: { q_sid: '0', q_des: '/惊讶' } });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('searches descriptions and aliases through the shared local catalog', async () => {
|
||||||
|
const search = vi.fn(async () => [FACE]);
|
||||||
|
const response = await handler({ search }).handle('search_sys_faces', { query: 'dragon' });
|
||||||
|
|
||||||
|
expect(search).toHaveBeenCalledWith('dragon');
|
||||||
|
expect(response).toMatchObject({ status: 'ok', data: { faces: [{ q_sid: '392' }] } });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('reports whether an id uses the super-face wire shape', async () => {
|
||||||
|
const isSuper = vi.fn(async () => true);
|
||||||
|
const response = await handler({ isSuper }).handle('fetch_super_face_id', { face_id: 392 });
|
||||||
|
|
||||||
|
expect(isSuper).toHaveBeenCalledWith(392, false);
|
||||||
|
expect(response).toMatchObject({ status: 'ok', data: { is_super: true } });
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -409,6 +409,28 @@ export abstract class SnowLumaApiClient {
|
|||||||
return this.call('set_msg_emoji_like', { message_id: messageId, emoji_id: emojiId, set }, options);
|
return this.call('set_msg_emoji_like', { message_id: messageId, emoji_id: emojiId, set }, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetchSysFaces(refresh = false, options?: RequestOptions) {
|
||||||
|
return this.call('fetch_sys_faces', { refresh }, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchFaceEntity(faceId: number, options: RequestOptions & { refresh?: boolean } = {}) {
|
||||||
|
return this.call('fetch_face_entity', {
|
||||||
|
face_id: faceId,
|
||||||
|
refresh: options.refresh ?? false,
|
||||||
|
}, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
searchSysFaces(query: string, options?: RequestOptions) {
|
||||||
|
return this.call('search_sys_faces', { query }, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchSuperFaceId(faceId: number, options: RequestOptions & { refresh?: boolean } = {}) {
|
||||||
|
return this.call('fetch_super_face_id', {
|
||||||
|
face_id: faceId,
|
||||||
|
refresh: options.refresh ?? false,
|
||||||
|
}, options);
|
||||||
|
}
|
||||||
|
|
||||||
markAllAsRead(options?: RequestOptions) {
|
markAllAsRead(options?: RequestOptions) {
|
||||||
return this.call('_mark_all_as_read', {}, options);
|
return this.call('_mark_all_as_read', {}, options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import type {
|
|||||||
DomainParams,
|
DomainParams,
|
||||||
DownloadFileParams,
|
DownloadFileParams,
|
||||||
FetchCustomFaceParams,
|
FetchCustomFaceParams,
|
||||||
|
FetchFaceEntityParams,
|
||||||
|
FetchSysFacesParams,
|
||||||
FetchEmojiLikeParams,
|
FetchEmojiLikeParams,
|
||||||
ForwardMessageParams,
|
ForwardMessageParams,
|
||||||
FriendPokeParams,
|
FriendPokeParams,
|
||||||
@@ -70,6 +72,7 @@ import type {
|
|||||||
AiVoiceParams,
|
AiVoiceParams,
|
||||||
DeleteGroupFolderParams,
|
DeleteGroupFolderParams,
|
||||||
SendPacketParams,
|
SendPacketParams,
|
||||||
|
SearchSysFacesParams,
|
||||||
} from './params';
|
} from './params';
|
||||||
import type {
|
import type {
|
||||||
CapabilityInfo,
|
CapabilityInfo,
|
||||||
@@ -100,6 +103,10 @@ import type {
|
|||||||
UserOnlineStatus,
|
UserOnlineStatus,
|
||||||
SendGroupAiRecordResult,
|
SendGroupAiRecordResult,
|
||||||
CollectionListInfo,
|
CollectionListInfo,
|
||||||
|
SuperFaceInfo,
|
||||||
|
SystemFaceCatalogInfo,
|
||||||
|
SystemFaceInfo,
|
||||||
|
SystemFaceSearchInfo,
|
||||||
} from './results';
|
} from './results';
|
||||||
|
|
||||||
export type ActionData = JsonValue;
|
export type ActionData = JsonValue;
|
||||||
@@ -200,6 +207,10 @@ export interface SnowLumaActionMap {
|
|||||||
get_recent_contact: { params: JsonObject; data: JsonArray };
|
get_recent_contact: { params: JsonObject; data: JsonArray };
|
||||||
get_profile_like: { params: JsonObject; data: JsonObject };
|
get_profile_like: { params: JsonObject; data: JsonObject };
|
||||||
fetch_custom_face: { params: FetchCustomFaceParams; data: string[] };
|
fetch_custom_face: { params: FetchCustomFaceParams; data: string[] };
|
||||||
|
fetch_sys_faces: { params: FetchSysFacesParams; data: SystemFaceCatalogInfo };
|
||||||
|
fetch_face_entity: { params: FetchFaceEntityParams; data: SystemFaceInfo | null };
|
||||||
|
search_sys_faces: { params: SearchSysFacesParams; data: SystemFaceSearchInfo };
|
||||||
|
fetch_super_face_id: { params: FetchFaceEntityParams; data: SuperFaceInfo };
|
||||||
get_emoji_likes: { params: GetEmojiLikesParams; data: JsonObject };
|
get_emoji_likes: { params: GetEmojiLikesParams; data: JsonObject };
|
||||||
fetch_emoji_like: { params: FetchEmojiLikeParams; data: JsonObject };
|
fetch_emoji_like: { params: FetchEmojiLikeParams; data: JsonObject };
|
||||||
get_friends_with_category: { params: JsonObject; data: FriendCategoryResult[] };
|
get_friends_with_category: { params: JsonObject; data: FriendCategoryResult[] };
|
||||||
|
|||||||
@@ -302,6 +302,18 @@ export interface FetchCustomFaceParams extends JsonObject {
|
|||||||
count?: number;
|
count?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface FetchSysFacesParams extends JsonObject {
|
||||||
|
refresh?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FetchFaceEntityParams extends FetchSysFacesParams {
|
||||||
|
face_id: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SearchSysFacesParams extends JsonObject {
|
||||||
|
query: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface GetCollectionListParams extends JsonObject {
|
export interface GetCollectionListParams extends JsonObject {
|
||||||
/** Collection category ID; 0 returns every category. */
|
/** Collection category ID; 0 returns every category. */
|
||||||
category?: number;
|
category?: number;
|
||||||
|
|||||||
@@ -175,6 +175,38 @@ export interface CollectionListInfo extends JsonObject {
|
|||||||
collectionSearchList: CollectionSearchListInfo;
|
collectionSearchList: CollectionSearchListInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SystemFaceInfo extends JsonObject {
|
||||||
|
q_sid: string;
|
||||||
|
q_des: string;
|
||||||
|
em_code: string;
|
||||||
|
q_cid: number | null;
|
||||||
|
ani_sticker_type: number | null;
|
||||||
|
ani_sticker_pack_id: number | null;
|
||||||
|
ani_sticker_id: number | null;
|
||||||
|
url: string | null;
|
||||||
|
emoji_name_alias: string[];
|
||||||
|
ani_sticker_width: number | null;
|
||||||
|
ani_sticker_height: number | null;
|
||||||
|
is_super: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SystemFacePackInfo extends JsonObject {
|
||||||
|
pack_name: string;
|
||||||
|
emojis: SystemFaceInfo[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SystemFaceCatalogInfo extends JsonObject {
|
||||||
|
packs: SystemFacePackInfo[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SystemFaceSearchInfo extends JsonObject {
|
||||||
|
faces: SystemFaceInfo[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SuperFaceInfo extends JsonObject {
|
||||||
|
is_super: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface UrlSafetyInfo {
|
export interface UrlSafetyInfo {
|
||||||
level: number;
|
level: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,27 @@ import {
|
|||||||
} from '../src';
|
} from '../src';
|
||||||
|
|
||||||
describe('SnowLumaHttpClient', () => {
|
describe('SnowLumaHttpClient', () => {
|
||||||
|
it('maps system-face catalog helpers to their OneBot actions', async () => {
|
||||||
|
const fetchImpl = vi.fn().mockImplementation(async () => new Response(JSON.stringify({
|
||||||
|
status: 'ok',
|
||||||
|
retcode: 0,
|
||||||
|
data: null,
|
||||||
|
})));
|
||||||
|
const client = new SnowLumaHttpClient({ fetch: fetchImpl });
|
||||||
|
|
||||||
|
await client.fetchSysFaces(true);
|
||||||
|
await client.fetchFaceEntity(392, { refresh: true });
|
||||||
|
await client.searchSysFaces('dragon');
|
||||||
|
await client.fetchSuperFaceId(392);
|
||||||
|
|
||||||
|
expect(fetchImpl.mock.calls.map((call) => JSON.parse((call[1] as RequestInit).body as string))).toEqual([
|
||||||
|
{ action: 'fetch_sys_faces', params: { refresh: true } },
|
||||||
|
{ action: 'fetch_face_entity', params: { face_id: 392, refresh: true } },
|
||||||
|
{ action: 'search_sys_faces', params: { query: 'dragon' } },
|
||||||
|
{ action: 'fetch_super_face_id', params: { face_id: 392, refresh: false } },
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it('maps group-announcement options to their OneBot field names', async () => {
|
it('maps group-announcement options to their OneBot field names', async () => {
|
||||||
const fetchImpl = vi.fn().mockResolvedValue(new Response(JSON.stringify({
|
const fetchImpl = vi.fn().mockResolvedValue(new Response(JSON.stringify({
|
||||||
status: 'ok',
|
status: 'ok',
|
||||||
|
|||||||
Reference in new issue
Block a user