Refactor packet client and update message history actions

Replaced LRUCache with Map for callback and event management in packet clients, and standardized callback hash usage. Updated GetFriendMsgHistory and GetGroupMsgHistory actions to use snake_case for payload keys. Modified OneBotMsgApi to support disabling URL retrieval for ptt elements via a new parameter.
This commit is contained in:
手瓜一十雪
2025-09-02 22:24:53 +08:00
parent 5b2ff5acd3
commit 518a7c1906
6 changed files with 40 additions and 41 deletions

View File

@@ -444,7 +444,7 @@ export class OneBotMsgApi {
};
},
pttElement: async (element, msg, elementWrapper) => {
pttElement: async (element, msg, elementWrapper, { disableGetUrl }) => {
const peer = {
chatType: msg.chatType,
peerUid: msg.peerUid,
@@ -452,7 +452,7 @@ export class OneBotMsgApi {
};
const fileCode = FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId, '', element.fileName);
let pttUrl = '';
if (this.core.apis.PacketApi.packetStatus) {
if (this.core.apis.PacketApi.packetStatus && !disableGetUrl) {
try {
pttUrl = await registerResource(
'ptt-url-get',