mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: #237
This commit is contained in:
parent
a4aeb8171d
commit
fbe101339d
@ -349,32 +349,48 @@ function onLoad() {
|
|||||||
log('获取群通知的成员信息失败', notify, e.stack.toString())
|
log('获取群通知的成员信息失败', notify, e.stack.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ([GroupNotifyTypes.JOIN_REQUEST].includes(notify.type)) {
|
else if ([GroupNotifyTypes.JOIN_REQUEST, GroupNotifyTypes.JOIN_REQUEST_BY_INVITED].includes(notify.type)) {
|
||||||
log('有加群请求')
|
log('有加群请求')
|
||||||
let groupRequestEvent = new OB11GroupRequestEvent()
|
let groupRequestEvent = new OB11GroupRequestEvent()
|
||||||
groupRequestEvent.group_id = parseInt(notify.group.groupCode)
|
groupRequestEvent.group_id = parseInt(notify.group.groupCode)
|
||||||
let requestQQ = ''
|
let requestQQ = uidMaps[notify.user1.uid]
|
||||||
try {
|
if (!requestQQ) {
|
||||||
requestQQ = (await NTQQUserApi.getUserDetailInfo(notify.user1.uid)).uin
|
try {
|
||||||
} catch (e) {
|
requestQQ = (await NTQQUserApi.getUserDetailInfo(notify.user1.uid)).uin
|
||||||
log('获取加群人QQ号失败', e)
|
} catch (e) {
|
||||||
|
log('获取加群人QQ号失败', e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
groupRequestEvent.user_id = parseInt(requestQQ) || 0
|
groupRequestEvent.user_id = parseInt(requestQQ) || 0
|
||||||
groupRequestEvent.sub_type = 'add'
|
groupRequestEvent.sub_type = 'add'
|
||||||
groupRequestEvent.comment = notify.postscript
|
groupRequestEvent.comment = notify.postscript
|
||||||
groupRequestEvent.flag = notify.seq
|
groupRequestEvent.flag = notify.seq
|
||||||
|
if (notify.type == GroupNotifyTypes.JOIN_REQUEST_BY_INVITED) {
|
||||||
|
// groupRequestEvent.sub_type = 'invite'
|
||||||
|
let invitorQQ = uidMaps[notify.user2.uid]
|
||||||
|
if (!invitorQQ) {
|
||||||
|
try {
|
||||||
|
let invitor = (await NTQQUserApi.getUserDetailInfo(notify.user2.uid))
|
||||||
|
groupRequestEvent.invitor_id = parseInt(invitor.uin)
|
||||||
|
} catch (e) {
|
||||||
|
groupRequestEvent.invitor_id = 0
|
||||||
|
log('获取邀请人QQ号失败', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
postOb11Event(groupRequestEvent)
|
postOb11Event(groupRequestEvent)
|
||||||
}
|
}
|
||||||
else if (notify.type == GroupNotifyTypes.INVITE_ME) {
|
else if (notify.type == GroupNotifyTypes.INVITE_ME) {
|
||||||
log('收到邀请我加群通知')
|
log('收到邀请我加群通知')
|
||||||
let groupInviteEvent = new OB11GroupRequestEvent()
|
let groupInviteEvent = new OB11GroupRequestEvent()
|
||||||
groupInviteEvent.group_id = parseInt(notify.group.groupCode)
|
groupInviteEvent.group_id = parseInt(notify.group.groupCode)
|
||||||
let user_id = (await getFriend(notify.user2.uid))?.uin
|
let user_id = uidMaps[notify.user2.uid]
|
||||||
if (!user_id) {
|
if (!user_id) {
|
||||||
user_id = (await NTQQUserApi.getUserDetailInfo(notify.user2.uid))?.uin
|
user_id = (await NTQQUserApi.getUserDetailInfo(notify.user2.uid))?.uin
|
||||||
}
|
}
|
||||||
groupInviteEvent.user_id = parseInt(user_id)
|
groupInviteEvent.user_id = parseInt(user_id)
|
||||||
groupInviteEvent.sub_type = 'invite'
|
groupInviteEvent.sub_type = 'invite'
|
||||||
|
// groupInviteEvent.invitor_id = parseInt(user_id)
|
||||||
groupInviteEvent.flag = notify.seq
|
groupInviteEvent.flag = notify.seq
|
||||||
postOb11Event(groupInviteEvent)
|
postOb11Event(groupInviteEvent)
|
||||||
}
|
}
|
||||||
|
@ -47,9 +47,12 @@ export class NTQQUserApi {
|
|||||||
return result.profiles.get(uid)
|
return result.profiles.get(uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getUserDetailInfo(uid: string, getLevel = false) {
|
static async getUserDetailInfo(uid: string, getLevel = false, withBizInfo = true) {
|
||||||
// this.getUserInfo(uid);
|
// this.getUserInfo(uid);
|
||||||
let methodName = !isQQ998 ? NTQQApiMethod.USER_DETAIL_INFO : NTQQApiMethod.USER_DETAIL_INFO_WITH_BIZ_INFO
|
let methodName = !isQQ998 ? NTQQApiMethod.USER_DETAIL_INFO : NTQQApiMethod.USER_DETAIL_INFO_WITH_BIZ_INFO
|
||||||
|
if (!withBizInfo) {
|
||||||
|
methodName = NTQQApiMethod.USER_DETAIL_INFO
|
||||||
|
}
|
||||||
const fetchInfo = async () => {
|
const fetchInfo = async () => {
|
||||||
const result = await callNTQQApi<{ info: User }>({
|
const result = await callNTQQApi<{ info: User }>({
|
||||||
methodName,
|
methodName,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
export enum GroupNotifyTypes {
|
export enum GroupNotifyTypes {
|
||||||
INVITE_ME = 1,
|
INVITE_ME = 1,
|
||||||
INVITED_JOIN = 4, // 有人接受了邀请入群
|
INVITED_JOIN = 4, // 有人接受了邀请入群
|
||||||
|
JOIN_REQUEST_BY_INVITED = 5, // 有人邀请了别人入群
|
||||||
JOIN_REQUEST = 7,
|
JOIN_REQUEST = 7,
|
||||||
ADMIN_SET = 8,
|
ADMIN_SET = 8,
|
||||||
KICK_MEMBER = 9,
|
KICK_MEMBER = 9,
|
||||||
|
@ -5,6 +5,7 @@ export class OB11GroupRequestEvent extends OB11GroupNoticeEvent {
|
|||||||
post_type = EventType.REQUEST
|
post_type = EventType.REQUEST
|
||||||
request_type: 'group' = 'group'
|
request_type: 'group' = 'group'
|
||||||
sub_type: 'add' | 'invite' = 'add'
|
sub_type: 'add' | 'invite' = 'add'
|
||||||
|
invitor_id: number | undefined = undefined
|
||||||
comment: string
|
comment: string
|
||||||
flag: string
|
flag: string
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user