fix(event): fix guild-request

This commit is contained in:
Il Harper 2024-08-23 15:55:28 +08:00
parent 42e5f8c2aa
commit c3d3974643
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC
3 changed files with 17 additions and 7 deletions

View File

@ -1,6 +1,13 @@
import { getSingleScreenNotifies } from '../definitions/groupService' import { getSingleScreenNotifies } from '../definitions/groupService'
let t = new Date().getTime()
const refresh = async () => { const refresh = async () => {
const nt = new Date().getTime()
if (nt - t < 10000) return
t = nt
void getSingleScreenNotifies({ void getSingleScreenNotifies({
doubt: false, doubt: false,
startSeq: '', startSeq: '',

View File

@ -217,20 +217,23 @@ const dispatcher = async (
case 'nodeIKernelGroupListener/onGroupSingleScreenNotifies': { case 'nodeIKernelGroupListener/onGroupSingleScreenNotifies': {
const { notifies } = payload as OnGroupSingleScreenNotifies const { notifies } = payload as OnGroupSingleScreenNotifies
for (const notify of notifies) { // eslint-disable-next-line @typescript-eslint/no-misused-promises
const uin = await ctx.chronocat.uix.getUin2(notify.user1.uid) // 此时用户刚刚申请入群,不在群里,不能带 group 场景 notifies.forEach(async (x) => {
if (x.type !== 7 || x.status !== 1) return
const uin = await ctx.chronocat.uix.getUin2(x.user1.uid) // 此时用户刚刚申请入群,不在群里,不能带 group 场景
if (!uin) { if (!uin) {
ctx.chronocat.l.error('内部错误', { code: 2152 }) ctx.chronocat.l.error('内部错误', { code: 2152 })
return return
} }
const key = `${notify.group.groupCode}:${uin}:${notify.seq}` const key = `${x.group.groupCode}:${uin}:${x.seq}`
if (emittedGroupReqList.includes(key)) return if (emittedGroupReqList.includes(key)) return
emittedGroupReqList.push(key) emittedGroupReqList.push(key)
ctx.chronocat.emit(new GuildRequestDispatchMessage(notify, uin)) ctx.chronocat.emit(new GuildRequestDispatchMessage(x, uin))
} })
return return
} }

View File

@ -219,9 +219,9 @@ export interface OnGroupSingleScreenNotifies {
export interface GroupNotify { export interface GroupNotify {
seq: string // '1716209619000000' seq: string // '1716209619000000'
type: number // 7 type: number // 7 申请入群11 已退群
status: number // 1 status: number // 0 无需操作,1 未操作2 已操作
group: { group: {
groupCode: string groupCode: string