fix: uid && latestMsg

This commit is contained in:
手瓜一十雪
2024-07-28 09:56:00 +08:00
parent 79870cc9ee
commit e493291357
6 changed files with 28 additions and 38 deletions

View File

@@ -18,7 +18,7 @@ const SchemaData = {
message_seq: { type: 'number' },
count: { type: 'number' }
},
required: [ 'group_id' ]
required: ['group_id']
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
@@ -36,8 +36,9 @@ export default class GoCQHTTPGetGroupMsgHistory extends BaseAction<Payload, Resp
chatType: ChatType.group,
peerUid: group.groupCode
}
if ( !payload.message_seq ) {
targetMsgShortId = await MessageUnique.getNthLatestShortIdByPeer(peer, count)
if (!payload.message_seq) {
let latestMsgId = (await NTQQMsgApi.getLastestMsgByUids(peer)).msgList[0].msgId;
targetMsgShortId = await MessageUnique.createMsg(peer, latestMsgId);
}
const startMsgId = (await MessageUnique.getMsgIdAndPeerByShortId(targetMsgShortId ?? (payload.message_seq ?? 0)))?.MsgId || '0';
const historyResult = (await NTQQMsgApi.getMsgHistory(peer, startMsgId, count));

View File

@@ -323,11 +323,12 @@ export class NapCatOnebot11 {
const isPrivilege = role === 3 || role === 4;
for (const member of members.values()) {
//console.log(member?.isDelete, role, isPrivilege);
if (member?.isDelete && !isPrivilege && selfInfo.uin !== member.uin) {
log('[群聊] 群组 ', groupCode, ' 成员' + member.uin + '退出');
const groupDecreaseEvent = new OB11GroupDecreaseEvent(parseInt(groupCode), parseInt(member.uin), 0, 'leave');// 不知道怎么出去的
postOB11Event(groupDecreaseEvent, true);
}
// Develop Mlikiowa Taged: 暂时屏蔽这个方案 考虑onMemberListChange
// if (member?.isDelete && !isPrivilege && selfInfo.uin !== member.uin) {
// log('[群聊] 群组 ', groupCode, ' 成员' + member.uin + '退出');
// const groupDecreaseEvent = new OB11GroupDecreaseEvent(parseInt(groupCode), parseInt(member.uin), 0, 'leave');// 不知道怎么出去的
// postOB11Event(groupDecreaseEvent, true);
// }
}
};
groupListener.onJoinGroupNotify = (...notify) => {