feat(onebot): implement set_group_portrait via highway cmdId 3000
Port the Lagrange.Core protocol path for group avatar upload —
napcat's NTQQ GroupService.setHeader has no oidb wrapper, but
Lagrange.Core/Internal/Context/Logic/Implementation/OperationLogic.cs
spells out the wire shape: same highway HTTP endpoint as personal
avatar, but with cmdId=3000 and a GroupAvatarExtra proto carried as
the `extend` blob (type=101, groupUin, field3={field1=1}, field5=3,
field6=1 — all four are protocol-prescribed constants).
Adds:
- GroupAvatarExtraSchema in proto/oidb-action.ts
- bridge.setGroupAvatar(groupId, source) wrapping the highway upload
- BridgeInterface.setGroupAvatar
- OneBot set_group_portrait action (was a stub returning
'not yet implemented'; accepts the same file-source variants as
set_qq_avatar)
5 new tests: 3 bridge-action (cmdId, extra-blob round-trip, empty-file
guard) + 2 OneBot (forwarding, param validation) — also tightens the
existing setAvatar test to assert the extend blob stays empty.
This commit is contained in:
7 files changed
+134
-3
No files matched your search
@@ -1257,4 +1257,20 @@ export const OidbAiVoiceRespSchema = {
|
||||
field2: { field: 2, type: 'uint32' as const },
|
||||
field3: { field: 3, type: 'uint32' as const },
|
||||
msgInfo: { field: 4, type: 'message' as const, schema: OidbAiVoiceMsgInfoSchema },
|
||||
} satisfies ProtoSchema;
|
||||
|
||||
// --- Highway cmdId 3000: GroupAvatarExtra ---
|
||||
// Ported from Lagrange.Core/Internal/Packets/Service/Highway/GroupAvatarExtra.cs.
|
||||
// Field values are protocol-prescribed constants (Lagrange comments on each).
|
||||
|
||||
export const GroupAvatarExtraField3Schema = {
|
||||
field1: { field: 1, type: 'uint32' as const }, // observed value: 1
|
||||
} satisfies ProtoSchema;
|
||||
|
||||
export const GroupAvatarExtraSchema = {
|
||||
type: { field: 1, type: 'uint32' as const }, // observed value: 101
|
||||
groupUin: { field: 2, type: 'uint32' as const },
|
||||
field3: { field: 3, type: 'message' as const, schema: GroupAvatarExtraField3Schema },
|
||||
field5: { field: 5, type: 'uint32' as const }, // observed value: 3
|
||||
field6: { field: 6, type: 'uint32' as const }, // observed value: 1
|
||||
} satisfies ProtoSchema;
|
||||
Reference in new issue
Block a user