mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Merge pull request #358 from piLovr/master
add memberAddMode and isCommunity / isCommunityAnnounce in groupMetadata
This commit is contained in:
@@ -318,6 +318,7 @@ export const extractGroupMetadata = (result: BinaryNode) => {
|
|||||||
|
|
||||||
const groupId = group.attrs.id.includes('@') ? group.attrs.id : jidEncode(group.attrs.id, 'g.us')
|
const groupId = group.attrs.id.includes('@') ? group.attrs.id : jidEncode(group.attrs.id, 'g.us')
|
||||||
const eph = getBinaryNodeChild(group, 'ephemeral')?.attrs.expiration
|
const eph = getBinaryNodeChild(group, 'ephemeral')?.attrs.expiration
|
||||||
|
const memberAddMode = getBinaryNodeChildString(group, 'member_add_mode') == "all_member_add"
|
||||||
const metadata: GroupMetadata = {
|
const metadata: GroupMetadata = {
|
||||||
id: groupId,
|
id: groupId,
|
||||||
subject: group.attrs.subject,
|
subject: group.attrs.subject,
|
||||||
@@ -330,6 +331,9 @@ export const extractGroupMetadata = (result: BinaryNode) => {
|
|||||||
descId,
|
descId,
|
||||||
restrict: !!getBinaryNodeChild(group, 'locked'),
|
restrict: !!getBinaryNodeChild(group, 'locked'),
|
||||||
announce: !!getBinaryNodeChild(group, 'announcement'),
|
announce: !!getBinaryNodeChild(group, 'announcement'),
|
||||||
|
isCommunity: !!getBinaryNodeChild(group, 'parent'),
|
||||||
|
isCommunityAnnounce: !!getBinaryNodeChild(group, 'default_sub_group'),
|
||||||
|
memberAddMode,
|
||||||
participants: getBinaryNodeChildren(group, 'participant').map(
|
participants: getBinaryNodeChildren(group, 'participant').map(
|
||||||
({ attrs }) => {
|
({ attrs }) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ export interface GroupMetadata {
|
|||||||
restrict?: boolean
|
restrict?: boolean
|
||||||
/** is set when the group only allows admins to write messages */
|
/** is set when the group only allows admins to write messages */
|
||||||
announce?: boolean
|
announce?: boolean
|
||||||
|
/** is set when the group also allows members to add participants */
|
||||||
|
memberAddMode?: boolean
|
||||||
|
/** is this a community */
|
||||||
|
isCommunity?: boolean
|
||||||
|
/** is this the announce of a community */
|
||||||
|
isCommunityAnnounce?: boolean
|
||||||
/** number of group participants */
|
/** number of group participants */
|
||||||
size?: number
|
size?: number
|
||||||
// Baileys modified array
|
// Baileys modified array
|
||||||
|
|||||||
Reference in New Issue
Block a user