fix(onebot): restore group join request delivery

Refs #658
This commit is contained in:
DrSmoothl committed 2026-11-06 22:49:52 +08:00
1 parent b0612d8d12
commit 43b63e9a75
11 files changed
+315 -176

No files matched your search

@@ -8,7 +8,7 @@ import type { SendPacketResult } from '@snowluma/common/packet-sender';
import {
FetchGroupRequests,
FetchGroupRequestsByUid,
groupRequestOperationType,
groupRequestNotifyType,
} from '../../../src/oidb-services/contacts/fetch-group-requests';
interface ObservedGroupRequestUserByUin {
@@ -49,14 +49,15 @@ function makeSender() {
}
describe('FetchGroupRequests namespace', () => {
it('maps native list notification types to 0x10C8 operation types', () => {
expect(groupRequestOperationType(1)).toBe(2);
expect(groupRequestOperationType(2)).toBe(10);
expect(groupRequestOperationType(7)).toBe(1);
expect(groupRequestOperationType(17)).toBe(100);
expect(groupRequestOperationType(5)).toBe(22);
expect(groupRequestOperationType(22)).toBe(22);
expect(groupRequestOperationType(99)).toBeNull();
it('interprets list discriminators in the wire-to-notification direction', () => {
expect(groupRequestNotifyType(1)).toBe(7);
expect(groupRequestNotifyType(2)).toBe(1);
expect(groupRequestNotifyType(7)).toBe(10);
expect(groupRequestNotifyType(10)).toBe(2);
expect(groupRequestNotifyType(22)).toBe(5);
expect(groupRequestNotifyType(100)).toBe(17);
expect(groupRequestNotifyType(5)).toBeUndefined();
expect(groupRequestNotifyType(99)).toBeUndefined();
});
it('declares 0x10C0', () => {
@@ -131,7 +132,7 @@ describe('FetchGroupRequests namespace', () => {
requests: [
{
sequence: 1_785_525_232_784_291n,
eventType: 7,
eventType: 1,
state: 1,
group: { groupUin: 1_095_186_374, groupName: 'group' },
target: { uin: 1_234_567_890, name: 'requester' },
@@ -156,6 +157,7 @@ describe('FetchGroupRequests namespace', () => {
const response = await FetchGroupRequests.invoke(sender, { filtered: false });
expect(response.requests?.[0]).toMatchObject({
eventType: 1,
target: { uin: 1_234_567_890, uid: '', name: 'requester' },
invitor: { uin: 2_345_678_901, uid: '', name: 'inviter' },
operatorUser: { uin: 3_456_789_012, uid: '', name: 'operator' },
@@ -170,7 +172,7 @@ describe('FetchGroupRequests namespace', () => {
requests: [
{
sequence: 99n,
eventType: 5,
eventType: 22,
state: 1,
group: { groupUin: 1001, groupName: 'group' },
target: { uid: 'u_target', name: 'invitee' },
@@ -194,7 +196,7 @@ describe('FetchGroupRequests namespace', () => {
const response = await FetchGroupRequests.invoke(sender, { filtered: false });
expect(response.requests?.[0]).toMatchObject({
eventType: 5,
eventType: 22,
target: { uid: 'u_target', uin: 0, name: 'invitee' },
invitor: { uid: 'u_inviter', uin: 0, name: 'inviter' },
comment: 'join us',