mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-22 07:07:53 +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'
|
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: '',
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user