This commit is contained in:
idranme 2024-08-10 17:17:19 +08:00
parent 5c219aa003
commit 6126920830
No known key found for this signature in database
GPG Key ID: 926F7B5B668E495F
3 changed files with 21 additions and 21 deletions

View File

@ -1,11 +1,13 @@
import { ReceiveCmdS } from '../hook' import { ReceiveCmdS } from '../hook'
import { Group, GroupMember, GroupMemberRole, GroupNotifies, GroupNotify, GroupRequestOperateTypes } from '../types' import { Group, GroupMember, GroupMemberRole, GroupNotifies, GroupRequestOperateTypes } from '../types'
import { callNTQQApi, GeneralCallResult, NTQQApiClass, NTQQApiMethod } from '../ntcall' import { callNTQQApi, GeneralCallResult, NTQQApiMethod } from '../ntcall'
import { deleteGroup, uidMaps } from '../../common/data' import { deleteGroup } from '../../common/data'
import { dbUtil } from '../../common/db' import { dbUtil } from '../../common/db'
import { log } from '../../common/utils/log' import { log } from '../../common/utils/log'
import { NTQQWindowApi, NTQQWindows } from './window' import { NTQQWindowApi, NTQQWindows } from './window'
import { getSession } from '../wrapper' import { getSession } from '../wrapper'
import { NTEventDispatch } from '@/common/utils/EventTask'
import { NodeIKernelGroupListener } from '../listeners'
export class NTQQGroupApi { export class NTQQGroupApi {
static async activateMemberListChange() { static async activateMemberListChange() {
@ -37,22 +39,19 @@ export class NTQQGroupApi {
}) })
} }
static async getGroups(forced = false) { static async getGroups(forced = false): Promise<Group[]> {
// let cbCmd = ReceiveCmdS.GROUPS type ListenerType = NodeIKernelGroupListener['onGroupListUpdate']
// if (process.platform != 'win32') { const [, , groupList] = await NTEventDispatch.CallNormalEvent
// cbCmd = ReceiveCmdS.GROUPS_STORE <(force: boolean) => Promise<any>, ListenerType>
// } (
const result = await callNTQQApi<{ 'NodeIKernelGroupService/getGroupList',
updateType: number 'NodeIKernelGroupListener/onGroupListUpdate',
groupList: Group[] 1,
}>({ 5000,
methodName: NTQQApiMethod.GROUPS, (updateType) => true,
args: [{ force_update: forced }, undefined], forced
cbCmd: [ReceiveCmdS.GROUPS, ReceiveCmdS.GROUPS_STORE], )
afterFirstCmd: false, return groupList
})
log('get groups result', result)
return result.groupList
} }
static async getGroupMembers(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> { static async getGroupMembers(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {

View File

@ -391,10 +391,12 @@ export interface RawMessage {
chatType: ChatType chatType: ChatType
sendStatus?: number // 消息状态别人发的2是已撤回自己发的2是已发送 sendStatus?: number // 消息状态别人发的2是已撤回自己发的2是已发送
recallTime: string // 撤回时间, "0"是没有撤回 recallTime: string // 撤回时间, "0"是没有撤回
records: RawMessage[]
elements: { elements: {
elementId: string elementId: string
elementType: ElementType elementType: ElementType
replyElement: { replyElement: {
sourceMsgIdInRecords: string
senderUid: string // 原消息发送者QQ号 senderUid: string // 原消息发送者QQ号
sourceMsgIsIncPic: boolean // 原消息是否有图片 sourceMsgIsIncPic: boolean // 原消息是否有图片
sourceMsgText: string sourceMsgText: string

View File

@ -59,7 +59,6 @@ export class OB11Constructor {
debug, debug,
ob11: { messagePostFormat }, ob11: { messagePostFormat },
} = config } = config
const message_type = msg.chatType == ChatType.group ? 'group' : 'private'
const resMsg: OB11Message = { const resMsg: OB11Message = {
self_id: parseInt(selfInfo.uin), self_id: parseInt(selfInfo.uin),
user_id: parseInt(msg.senderUin!), user_id: parseInt(msg.senderUin!),
@ -67,7 +66,7 @@ export class OB11Constructor {
message_id: msg.msgShortId!, message_id: msg.msgShortId!,
real_id: msg.msgShortId!, real_id: msg.msgShortId!,
message_seq: msg.msgShortId!, message_seq: msg.msgShortId!,
message_type: msg.chatType == ChatType.group ? 'group' : 'private', message_type: msg.chatType === ChatType.group ? 'group' : 'private',
sender: { sender: {
user_id: parseInt(msg.senderUin!), user_id: parseInt(msg.senderUin!),
nickname: msg.sendNickName, nickname: msg.sendNickName,