From 77a91fe1f03e20196655a9889dff18c157b8496a Mon Sep 17 00:00:00 2001 From: Edgard Date: Sat, 28 Jan 2023 18:45:03 -0300 Subject: [PATCH] feat: Added WPP.group.getGroupSizeLimit function (close #691) --- src/group/functions/getGroupSizeLimit.ts | 34 +++++++++++++++++++++ src/group/functions/index.ts | 1 + src/whatsapp/functions/getGroupSizeLimit.ts | 30 ++++++++++++++++++ src/whatsapp/functions/index.ts | 1 + 4 files changed, 66 insertions(+) create mode 100644 src/group/functions/getGroupSizeLimit.ts create mode 100644 src/whatsapp/functions/getGroupSizeLimit.ts diff --git a/src/group/functions/getGroupSizeLimit.ts b/src/group/functions/getGroupSizeLimit.ts new file mode 100644 index 0000000000..35339b7607 --- /dev/null +++ b/src/group/functions/getGroupSizeLimit.ts @@ -0,0 +1,34 @@ +/*! + * Copyright 2023 WPPConnect Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { functions } from '../../whatsapp'; + +/** + * Get the max number of participants for a group + * + * @example + * ```javascript + * const limit = await WPP.group.getGroupSizeLimit(); + * console.log(limit); + * ``` + * + * @category Group + */ +export async function getGroupSizeLimit() { + const limit = functions.getGroupSizeLimit(); + + return limit; +} diff --git a/src/group/functions/index.ts b/src/group/functions/index.ts index 7f2035de7a..10f916bf41 100644 --- a/src/group/functions/index.ts +++ b/src/group/functions/index.ts @@ -25,6 +25,7 @@ export { ensureGroup } from './ensureGroup'; export { ensureGroupAndParticipants } from './ensureGroupAndParticipants'; export { getAllGroups } from './getAllGroups'; export { getGroupInfoFromInviteCode } from './getGroupInfoFromInviteCode'; +export { getGroupSizeLimit } from './getGroupSizeLimit'; export { getInviteCode } from './getInviteCode'; export { getParticipants } from './getParticipants'; export { iAmAdmin } from './iAmAdmin'; diff --git a/src/whatsapp/functions/getGroupSizeLimit.ts b/src/whatsapp/functions/getGroupSizeLimit.ts new file mode 100644 index 0000000000..2ff8d4a74a --- /dev/null +++ b/src/whatsapp/functions/getGroupSizeLimit.ts @@ -0,0 +1,30 @@ +/*! + * Copyright 2022 WPPConnect Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { exportModule } from '../exportModule'; + +/** + * @whatsapp 97858 >= 2.2304.7 + */ +export declare function getGroupSizeLimit(groupType?: string): number; + +exportModule( + exports, + { + getGroupSizeLimit: 'getGroupSizeLimit', + }, + (m) => m.getGroupSizeLimit +); diff --git a/src/whatsapp/functions/index.ts b/src/whatsapp/functions/index.ts index f99492504b..1ad2bd87ad 100644 --- a/src/whatsapp/functions/index.ts +++ b/src/whatsapp/functions/index.ts @@ -34,6 +34,7 @@ export * from './generateVideoThumbsAndDuration'; export * from './genMinimalLinkPreview'; export * from './getFanOutList'; export * from './getGroupSenderKeyList'; +export * from './getGroupSizeLimit'; export * from './getHistorySyncProgress'; export * from './getQuotedMsgObj'; export * from './getReactions';