8 files changed
+184
-8
No files matched your search
@@ -7,6 +7,7 @@ import {
|
||||
} from '@snowluma/protocol/dataline/device-contacts';
|
||||
import {
|
||||
formatGroupRequestFlag,
|
||||
isSelfGroupInvitation,
|
||||
type GroupMemberInfo,
|
||||
type GroupRequestInfo,
|
||||
type UserProfileInfo,
|
||||
@@ -573,11 +574,12 @@ async function resolveRequesterUins(
|
||||
return resolved;
|
||||
}
|
||||
|
||||
/** Join request (7) or invite that still needs an admin (5 / mapped 22). */
|
||||
/** Join requests, self invitations, and invitations awaiting administrator approval. */
|
||||
function isJoinOrInviteNotify(notifyType: number | undefined): boolean {
|
||||
return (
|
||||
notifyType === undefined ||
|
||||
notifyType === 1 ||
|
||||
notifyType === 2 ||
|
||||
notifyType === 5 ||
|
||||
notifyType === 7 ||
|
||||
notifyType === 22
|
||||
@@ -589,7 +591,7 @@ function groupRequestActor(request: GroupRequestInfo): {
|
||||
uin: number;
|
||||
name: string;
|
||||
} {
|
||||
if (request.notifyType === 1) {
|
||||
if (isSelfGroupInvitation(request)) {
|
||||
return {
|
||||
uid: request.invitorUid,
|
||||
uin: request.invitorUin,
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { createLogger } from '@snowluma/common/logger';
|
||||
import type { BridgeInterface } from '@snowluma/core/bridge-interface';
|
||||
import type { GroupRequestHandle, GroupRequestInfo } from '@snowluma/protocol/qq-info';
|
||||
import {
|
||||
isSelfGroupInvitation,
|
||||
type GroupRequestHandle,
|
||||
type GroupRequestInfo,
|
||||
} from '@snowluma/protocol/qq-info';
|
||||
|
||||
const log = createLogger('OneBot.Request');
|
||||
|
||||
@@ -265,7 +269,7 @@ export async function handleGroupAddRequest(
|
||||
|
||||
if (
|
||||
notice &&
|
||||
(request.eventType !== 2 ||
|
||||
(!isSelfGroupInvitation(request) ||
|
||||
(request.targetUin > 0 && request.targetUin !== Number(bridge.identity.uin)) ||
|
||||
(request.targetUid &&
|
||||
bridge.identity.selfUid &&
|
||||
@@ -282,6 +286,19 @@ export async function handleGroupAddRequest(
|
||||
const matching = candidates[0];
|
||||
|
||||
if (!matching) {
|
||||
log.warn(
|
||||
'group request match failed: group=%d kind=%s selfInvitation=%s inboxTypes=%s',
|
||||
parsed.groupId,
|
||||
parsed.requestType,
|
||||
Boolean(notice),
|
||||
lookup.requests
|
||||
.filter((request) => request.groupId === parsed.groupId)
|
||||
.map(
|
||||
(request) =>
|
||||
`${request.notifyType ?? '?'}:${request.eventType}:${request.state}`,
|
||||
)
|
||||
.join(','),
|
||||
);
|
||||
throwMissingGroupRequest('matching group request not found', lookup.failures);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user