fix(onebot): approve bot self-invite via private card msgseq (#125)
When the bot is invited to a group via a private-chat "qun.invite" ark card, set_group_add_request failed: handleGroupAddRequest re-derived the approval tuple from fetchGroupRequests (0x10c8_2), but for a self-invite the only sequence the server accepts at 0x10c8_1 is the msgseq embedded in the card's mqqapi://group/invite_join jumpUrl, applied with eventType=2 / filtered=false. The MSF invite push (PkgType 87) never carries that msgseq, so approval returned 120161001 'handle async message fail'. - friend-message decoder: parse the private invite card's jumpUrl and stash groupUin -> msgseq on the per-instance IdentityService. - ContactsApi.getGroupInviteCardSequence(groupId) exposes it. - handleGroupAddRequest: for an invite flag, if a card msgseq is cached, approve with setAddRequest(groupId, msgseq, 2, approve, reason, false); otherwise fall back to the existing fetchGroupRequests path. Validated on-target (Docker): private invite card -> set_group_add_request approve -> 0x10c8_1 ok -> bot joined the group (get_group_member_info shows role=member, fresh join_time); no 120161001.
This commit is contained in:
4 files changed
+65
-1
No files matched your search
@@ -15,6 +15,18 @@ export async function handleGroupAddRequest(
|
||||
if (!groupId) throw new Error('invalid group_id in flag');
|
||||
if (!targetUid) throw new Error('invalid request target in flag');
|
||||
|
||||
// Bot self-invited via a private "qun.invite" card: the only sequence the
|
||||
// server accepts at 0x10c8_1 is that card's jumpUrl msgseq, with eventType=2
|
||||
// / filtered=false. The fetchGroupRequests tuple below fails this case with
|
||||
// 120161001 ("handle async message fail"). See issue #125.
|
||||
if (requestType === 'invite') {
|
||||
const cardSequence = bridge.apis.contacts.getGroupInviteCardSequence(groupId);
|
||||
if (cardSequence) {
|
||||
await bridge.apis.groupAdmin.setAddRequest(groupId, cardSequence, 2, approve, reason, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const requests = await bridge.apis.contacts.fetchGroupRequests();
|
||||
const matching = requests.find((r) => {
|
||||
if (r.groupId !== groupId) return false;
|
||||
|
||||
Reference in new issue
Block a user