Refactor PacketApi status checks and fix typos

Replaced all usages of PacketApi.available with PacketApi.packetStatus for more accurate status checking. Fixed a typo in getFullQQVesion to getFullQQVersion. Updated plugin_onmessage to fetch and parse messages for a user. These changes improve reliability and consistency in API status handling.
This commit is contained in:
手瓜一十雪
2025-08-06 19:31:24 +08:00
parent 7f08d62b5b
commit d498513bda
8 changed files with 38 additions and 17 deletions

View File

@@ -1,8 +1,17 @@
import { NapCatOneBot11Adapter, OB11Message } from '@/onebot';
import { NapCatCore } from '@/core';
import { ChatType, NapCatCore } from '@/core';
import { ActionMap } from '@/onebot/action';
import { OB11PluginAdapter } from '@/onebot/network/plugin';
export const plugin_onmessage = async (adapter: string, _core: NapCatCore, _obCtx: NapCatOneBot11Adapter, message: OB11Message, action: ActionMap, instance: OB11PluginAdapter) => {
};
const uid = await _core.apis.UserApi.getUidByUinV2(message.sender.user_id.toString());
const msgs = (await _core.apis.MsgApi.queryFirstMsgBySender({
peerUid: message.group_id ? String(message.group_id) : String(uid),
chatType: ChatType.KCHATTYPEGROUP,
}, [uid])).msgList;
console.log('parse message ', message.sender.user_id, msgs.length);
for (const msg of msgs) {
await _obCtx.apis.MsgApi.parseMessageV2(msg)
}
}