mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: group metadata mapping on legacy
This commit is contained in:
@@ -45,11 +45,23 @@ const makeGroupsSocket = (config: LegacySocketConfig) => {
|
|||||||
json: ['query', 'GroupMetadata', jid],
|
json: ['query', 'GroupMetadata', jid],
|
||||||
expect200: true
|
expect200: true
|
||||||
})
|
})
|
||||||
metadata.participants = metadata.participants.map(p => (
|
|
||||||
{ ...p, id: undefined, jid: jidNormalizedUser(p.id) }
|
const meta: GroupMetadata = {
|
||||||
))
|
id: metadata.id,
|
||||||
metadata.owner = jidNormalizedUser(metadata.owner)
|
subject: metadata.subject,
|
||||||
return metadata as GroupMetadata
|
creation: +metadata.creation,
|
||||||
|
owner: jidNormalizedUser(metadata.owner),
|
||||||
|
desc: metadata.desc,
|
||||||
|
descOwner: metadata.descOwner,
|
||||||
|
participants: metadata.participants.map(
|
||||||
|
p => ({
|
||||||
|
id: jidNormalizedUser(p.id),
|
||||||
|
admin: p.isSuperAdmin ? 'super-admin' : p.isAdmin ? 'admin' : undefined
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return meta
|
||||||
}
|
}
|
||||||
/** Get the metadata (works after you've left the group also) */
|
/** Get the metadata (works after you've left the group also) */
|
||||||
const groupMetadataMinimal = async (jid: string) => {
|
const groupMetadataMinimal = async (jid: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user