Skip to content

Commit

Permalink
获取收藏表情逆序支持
Browse files Browse the repository at this point in the history
✨ 支持 napcat 1.7.0 获取收藏表情
  • Loading branch information
Stapxs committed Jul 29, 2024
1 parent 8795e4f commit 1d202d5
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/assets/css/append/append_new.css
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,15 @@
width: 19px;
}
.store-face-list {
height: calc(300px - 100px);
height: calc(300px - 90px) !important;
}

.face-stickers {
height: calc(300px - 90px);
}
.face-stickers > img {
height: 44px;
width: 44px;
}

.respond {
Expand Down
1 change: 1 addition & 0 deletions src/assets/pathMap/Lagrange.OneBot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ user_list:
# 收藏表情
roaming_stamp:
name: fetch_custom_face
reverse: true
# 消息列表
message_list:
name: get_group_msg_history
Expand Down
6 changes: 5 additions & 1 deletion src/assets/pathMap/NapCat.Onebot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,8 @@ group_essence:
add_digest_uin: /add_digest_uin
add_digest_nick: /add_digest_nick
add_digest_time: /add_digest_time
is_end: $.data.is_end
is_end: $.data.is_end
# 获取收藏表情
roaming_stamp:
name: fetch_custom_face
pageed: true
6 changes: 5 additions & 1 deletion src/components/FacePan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ export default defineComponent({
mounted() {
// 加载漫游表情
if (runtimeData.stickerCache === undefined && runtimeData.jsonMap.roaming_stamp) {
Connector.send(runtimeData.jsonMap.roaming_stamp.name, {}, 'getRoamingStamp')
if(runtimeData.jsonMap.roaming_stamp.paged) {
Connector.send(runtimeData.jsonMap.roaming_stamp.name, { count: 20 }, 'getRoamingStamp')
} else {
Connector.send(runtimeData.jsonMap.roaming_stamp.name, {}, 'getRoamingStamp')
}
}
this.getStoreFaceList()
}
Expand Down
13 changes: 12 additions & 1 deletion src/function/msg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function parse(str: string) {
case 'getChatHistory' : saveMsg(msg, 'top'); break
case 'getForwardMsg' : saveForwardMsg(msg); break
case 'sendMsgBack' : showSendedMsg(msg, echoList); break
case 'getRoamingStamp' : runtimeData.stickerCache = msg.data.reverse(); break
case 'getRoamingStamp' : saveSticker(msg.data); break
case 'getMoreGroupInfo' : runtimeData.chatInfo.info.group_info = msg.data.data; break
case 'getMoreUserInfo' : runtimeData.chatInfo.info.user_info = msg.data.data.result.buddy.info_list[0]; break
case 'getGroupNotices' : saveGroupNotices(msg); break
Expand Down Expand Up @@ -1112,6 +1112,17 @@ function saveCookie(data: any, echoList: string[]) {
runtimeData.loginInfo.webapi[domain].bkn = (hash & 0x7FFFFFFF).toString()
}

function saveSticker(data: any) {
if(msgPath.roaming_stamp.reverse) {
data.reverse()
}
if(runtimeData.stickerCache == undefined) {
runtimeData.stickerCache = data
} else {
runtimeData.stickerCache = runtimeData.stickerCache.concat(data)
}
}

// ==============================================================

const baseRuntime = {
Expand Down

0 comments on commit 1d202d5

Please sign in to comment.