mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-25 09:37:35 +00:00
fix(event): fix guild-request
This commit is contained in:
parent
42e5f8c2aa
commit
c3d3974643
@ -1,6 +1,13 @@
|
||||
import { getSingleScreenNotifies } from '../definitions/groupService'
|
||||
|
||||
let t = new Date().getTime()
|
||||
|
||||
const refresh = async () => {
|
||||
const nt = new Date().getTime()
|
||||
|
||||
if (nt - t < 10000) return
|
||||
t = nt
|
||||
|
||||
void getSingleScreenNotifies({
|
||||
doubt: false,
|
||||
startSeq: '',
|
||||
|
@ -217,20 +217,23 @@ const dispatcher = async (
|
||||
case 'nodeIKernelGroupListener/onGroupSingleScreenNotifies': {
|
||||
const { notifies } = payload as OnGroupSingleScreenNotifies
|
||||
|
||||
for (const notify of notifies) {
|
||||
const uin = await ctx.chronocat.uix.getUin2(notify.user1.uid) // 此时用户刚刚申请入群,不在群里,不能带 group 场景
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
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) {
|
||||
ctx.chronocat.l.error('内部错误', { code: 2152 })
|
||||
return
|
||||
}
|
||||
|
||||
const key = `${notify.group.groupCode}:${uin}:${notify.seq}`
|
||||
const key = `${x.group.groupCode}:${uin}:${x.seq}`
|
||||
if (emittedGroupReqList.includes(key)) return
|
||||
|
||||
emittedGroupReqList.push(key)
|
||||
|
||||
ctx.chronocat.emit(new GuildRequestDispatchMessage(notify, uin))
|
||||
}
|
||||
ctx.chronocat.emit(new GuildRequestDispatchMessage(x, uin))
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -219,9 +219,9 @@ export interface OnGroupSingleScreenNotifies {
|
||||
export interface GroupNotify {
|
||||
seq: string // '1716209619000000'
|
||||
|
||||
type: number // 7
|
||||
type: number // 7 申请入群,11 已退群
|
||||
|
||||
status: number // 1
|
||||
status: number // 0 无需操作,1 未操作,2 已操作
|
||||
|
||||
group: {
|
||||
groupCode: string
|
||||
|
Loading…
Reference in New Issue
Block a user