feat(protocol): favorite emoji fetch/delete/add via Faceroam.OpReq + highway (#107)

* feat(protocol): fetch/delete favorite emoji via Faceroam.OpReq

First non-OIDB services in oidb-services/ — Faceroam.OpReq is a trpc
service, so these bypass invokeOidb and call sendRawPacket directly.

- proto-defs: reuse FaceroamOpReq/Inner/Resp, add field5 + FaceroamOpBody
- protocol: oidb-services/emoji/{shared,fetch-fav-list,delete-fav-emoji}
- core: EmojiApi facade + ApiHub registration
- onebot: fetch_fav_emoji_list + delete_fav_emoji actions

Request wire matches 9.9.26-44343 captures byte-for-byte; fetch response
decode + delete verified end-to-end against a live account.

* feat(protocol): add favorite emoji via BDHExpressionRoam + highway HTTP upload

Flow: BDHExpressionRoam (apply upload, get token) -> highway frame
(PicUp.DataUp commandId=9, serviceTicket = BDHExpressionRoam token) ->
HTTP POST httpconn?htcmd=0x6FF0087 -> fetch refresh.

- proto-defs: BDHExpressionRoamReq/Resp + FavEmojiHighwayHead types
- protocol: oidb-services/emoji/add-fav-emoji (fetchHighwaySession +
  BDHExpressionRoam + packHighwayFrame + HTTP POST)
- core: EmojiApi.addFavEmoji facade (reuses loadBinarySource)
- onebot: add_fav_emoji action
- mcp: regenerate catalog

End-to-end verified: new emoji_id appears in fetch list after upload.

* refactor(emoji): reuse fetchCustomFace for fetch_fav_emoji_list

Address review: Faceroam.OpReq had two call sites (profile.fetchCustomFace
+ the new FetchFavList service). Drop the duplicate service —
fetch_fav_emoji_list now reuses ProfileApi.fetchCustomFace and extracts
emoji_id from the returned image URL (qq_expression/<uin>/<id>/0).

delete/add unchanged (independent protocols).

* refactor: align custom-face naming with NapCat

Address review: 'fav_emoji' vs existing 'custom_face' named the same
thing two ways. Rename across the stack to match NapCat's custom_face:
- services: oidb-services/emoji/* -> oidb-services/custom-face/*
  (DeleteFavEmoji -> DeleteCustomFace, AddFavEmoji -> AddCustomFace)
- facade: EmojiApi dropped; delete/add moved to ProfileApi
  (deleteCustomFace / addCustomFace), next to fetchCustomFace
- actions: fetch_fav_emoji_list -> fetch_custom_face_ids,
  delete_fav_emoji -> delete_custom_face, add_fav_emoji -> add_custom_face
- package.json subpaths + catalog regenerated

* refactor(onebot): merge fetch_custom_face_ids into fetch_custom_face

Per review: merge fetch_custom_face_ids back into fetch_custom_face
with a return_type param ('url' default / 'id'). One action, one service,
no separate id-only variant.
This commit is contained in:
Qiao authored and DrSmoothl committed 2026-06-19 02:15:54 +08:00
1 parent e3a04858b4
commit 552238fd04
9 files changed
+631 -21

No files matched your search

+206 -20
View File
@@ -110,7 +110,7 @@ export const ACTIONS: CatalogAction[] = [
{
"name": "_mark_all_as_read",
"aliases": [],
"summary": "标记全部已读",
"summary": "标记全部已读(no-op,待 RE 全读 cmd)",
"readOnly": false,
"params": [],
"invariants": [],
@@ -231,6 +231,38 @@ export const ACTIONS: CatalogAction[] = [
},
"category": "扩展"
},
{
"name": "add_custom_face",
"aliases": [],
"summary": "添加收藏表情",
"readOnly": false,
"params": [
{
"name": "file",
"type": "string",
"required": true,
"schema": {
"type": "string",
"minLength": 1
}
}
],
"invariants": [],
"inputSchema": {
"type": "object",
"properties": {
"file": {
"type": "string",
"minLength": 1
}
},
"required": [
"file"
],
"additionalProperties": true
},
"category": "扩展"
},
{
"name": "bot_exit",
"aliases": [],
@@ -673,6 +705,38 @@ export const ACTIONS: CatalogAction[] = [
},
"category": "群相册"
},
{
"name": "delete_custom_face",
"aliases": [],
"summary": "删除收藏表情",
"readOnly": false,
"params": [
{
"name": "emoji_id",
"type": "string",
"required": true,
"schema": {
"type": "string",
"minLength": 1
}
}
],
"invariants": [],
"inputSchema": {
"type": "object",
"properties": {
"emoji_id": {
"type": "string",
"minLength": 1
}
},
"required": [
"emoji_id"
],
"additionalProperties": true
},
"category": "扩展"
},
{
"name": "delete_essence_msg",
"aliases": [],
@@ -1082,6 +1146,15 @@ export const ACTIONS: CatalogAction[] = [
"minimum": 0
},
"default": 10
},
{
"name": "return_type",
"type": "string",
"required": false,
"schema": {
"type": "string"
},
"default": "url"
}
],
"invariants": [],
@@ -1092,6 +1165,10 @@ export const ACTIONS: CatalogAction[] = [
"type": "integer",
"minimum": 0,
"default": 10
},
"return_type": {
"type": "string",
"default": "url"
}
},
"additionalProperties": true
@@ -1666,7 +1743,7 @@ export const ACTIONS: CatalogAction[] = [
{
"name": "get_file",
"aliases": [],
"summary": "获取文件(未实现)",
"summary": "获取文件信息(仅图片/语音缓存;群文件请用 get_group_file_url)",
"readOnly": true,
"params": [
{
@@ -1767,8 +1844,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "int",
"required": false,
"schema": {
"type": "integer",
"minimum": 0
"type": "integer"
},
"default": 0
},
@@ -1793,7 +1869,6 @@ export const ACTIONS: CatalogAction[] = [
},
"message_id": {
"type": "integer",
"minimum": 0,
"default": 0
},
"count": {
@@ -2448,8 +2523,7 @@ export const ACTIONS: CatalogAction[] = [
"type": "int",
"required": false,
"schema": {
"type": "integer",
"minimum": 0
"type": "integer"
},
"default": 0
},
@@ -2475,7 +2549,6 @@ export const ACTIONS: CatalogAction[] = [
},
"message_id": {
"type": "integer",
"minimum": 0,
"default": 0
},
"count": {
@@ -2528,13 +2601,33 @@ export const ACTIONS: CatalogAction[] = [
{
"name": "get_group_shut_list",
"aliases": [],
"summary": "获取群禁言列表(占位)",
"summary": "获取群禁言列表",
"readOnly": true,
"params": [],
"params": [
{
"name": "group_id",
"type": "uint",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
},
"desc": "群号"
}
],
"invariants": [],
"inputSchema": {
"type": "object",
"properties": {},
"properties": {
"group_id": {
"type": "integer",
"minimum": 1,
"description": "群号"
}
},
"required": [
"group_id"
],
"additionalProperties": true
},
"category": "扩展"
@@ -2852,6 +2945,20 @@ export const ACTIONS: CatalogAction[] = [
},
"category": "扩展"
},
{
"name": "get_rkey_server",
"aliases": [],
"summary": "获取 rkey 服务器信息",
"readOnly": true,
"params": [],
"invariants": [],
"inputSchema": {
"type": "object",
"properties": {},
"additionalProperties": true
},
"category": "扩展"
},
{
"name": "get_status",
"aliases": [],
@@ -3250,13 +3357,31 @@ export const ACTIONS: CatalogAction[] = [
"aliases": [
".ocr_image"
],
"summary": "OCR 图片(未实现)",
"summary": "OCR 图片(服务端,需图片 URL 或已缓存的图片 file_id)",
"readOnly": true,
"params": [],
"params": [
{
"name": "image",
"type": "string",
"required": true,
"schema": {
"type": "string",
"minLength": 1
}
}
],
"invariants": [],
"inputSchema": {
"type": "object",
"properties": {},
"properties": {
"image": {
"type": "string",
"minLength": 1
}
},
"required": [
"image"
],
"additionalProperties": true
},
"category": "扩展"
@@ -3264,16 +3389,77 @@ export const ACTIONS: CatalogAction[] = [
{
"name": "rename_group_file",
"aliases": [],
"summary": "重命名群文件(未实现)",
"summary": "重命名群文件",
"readOnly": false,
"params": [],
"params": [
{
"name": "group_id",
"type": "uint",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
},
"desc": "群号"
},
{
"name": "file_id",
"type": "string",
"required": true,
"schema": {
"type": "string",
"minLength": 1
}
},
{
"name": "current_parent_directory",
"type": "string",
"required": false,
"schema": {
"type": "string"
},
"default": "/"
},
{
"name": "new_name",
"type": "string",
"required": true,
"schema": {
"type": "string",
"minLength": 1
}
}
],
"invariants": [],
"inputSchema": {
"type": "object",
"properties": {},
"properties": {
"group_id": {
"type": "integer",
"minimum": 1,
"description": "群号"
},
"file_id": {
"type": "string",
"minLength": 1
},
"current_parent_directory": {
"type": "string",
"default": "/"
},
"new_name": {
"type": "string",
"minLength": 1
}
},
"required": [
"group_id",
"file_id",
"new_name"
],
"additionalProperties": true
},
"category": "扩展"
"category": "群文件"
},
{
"name": "rename_group_file_folder",
@@ -5872,7 +6058,7 @@ export const CATEGORIES: CatalogCategory[] = [
},
{
"category": "群文件",
"count": 11
"count": 12
},
{
"category": "请求",
@@ -5880,7 +6066,7 @@ export const CATEGORIES: CatalogCategory[] = [
},
{
"category": "扩展",
"count": 85
"count": 87
},
{
"category": "群相册",