feat(onebot): report the invited account on group invite events
request.group.invite already identified the inviter. The event now also reports the invited account when QQ provides it. Closes #394
This commit is contained in:
12 files changed
+181
-3
No files matched your search
@@ -363,6 +363,23 @@ describe('convertEvent — request kinds', () => {
|
||||
} as QQEventVariant);
|
||||
expect(withSubType!.sub_type).toBe('add');
|
||||
});
|
||||
|
||||
it('group_invite: reports the invitee without replacing user_id (#394)', async () => {
|
||||
const out = await convertEvent(bareCtx(), {
|
||||
kind: 'group_invite', time: 1, selfUin: SELF_ID, groupId: GROUP_ID,
|
||||
fromUin: PEER_UIN, invitedUin: 4242, message: '', flag: 'gflag', subType: 'invite',
|
||||
} as QQEventVariant);
|
||||
expect(out!.user_id).toBe(PEER_UIN);
|
||||
expect(out!.invited_id).toBe(4242);
|
||||
});
|
||||
|
||||
it('group_invite: omits invited_id when the invitee is unknown', async () => {
|
||||
const out = await convertEvent(bareCtx(), {
|
||||
kind: 'group_invite', time: 1, selfUin: SELF_ID, groupId: GROUP_ID,
|
||||
fromUin: PEER_UIN, message: '', flag: 'gflag', subType: 'invite',
|
||||
} as QQEventVariant);
|
||||
expect(out).not.toHaveProperty('invited_id');
|
||||
});
|
||||
});
|
||||
|
||||
describe('convertEvent — message elements', () => {
|
||||
|
||||
@@ -63,6 +63,8 @@ describe('GroupRequestPoller', () => {
|
||||
groupId: 999,
|
||||
fromUin: 456,
|
||||
fromUid: 'inviter_uid',
|
||||
invitedUin: 123,
|
||||
invitedUid: 'target_uid',
|
||||
subType: 'invite',
|
||||
message: 'please',
|
||||
flag: 'slreq:1:42:999:2:0',
|
||||
|
||||
Reference in new issue
Block a user