forked from wppconnect-team/wa-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added option to create a subgroup for community
- Loading branch information
1 parent
590c9ce
commit 445bc79
Showing
3 changed files
with
17 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,13 +46,17 @@ import * as wa_functions from '../../whatsapp/functions'; | |
* // How to send a custom invite link | ||
* const link = 'https://chat.whatsapp.com/' + result['[email protected]'].invite_code; | ||
* console.log(link); | ||
* | ||
* // Create a Subgroup for a community | ||
* const result = await WPP.group.create('Test Group', ['[email protected]'], '[email protected]'); | ||
* ``` | ||
* | ||
* @category Group | ||
*/ | ||
export async function create( | ||
groupName: string, | ||
participantsIds: (string | Wid) | (string | Wid)[] | ||
participantsIds: (string | Wid) | (string | Wid)[], | ||
parentGroup: string | Wid | ||
): Promise<{ | ||
gid: Wid; | ||
participants: { | ||
|
@@ -99,7 +103,14 @@ export async function create( | |
wids.push(info.wid); | ||
} | ||
|
||
const result = await wa_functions.sendCreateGroup(groupName, wids); | ||
const parentWid = parentGroup ? assertWid(parentGroup) : undefined; | ||
|
||
const result = await wa_functions.sendCreateGroup( | ||
groupName, | ||
wids, | ||
undefined, | ||
parentWid | ||
); | ||
|
||
if (result.gid) { | ||
const chatGroup = await Chat.find(result.gid); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters