-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Community
#2531
base: main
Are you sure you want to change the base?
feat: Community
#2531
Conversation
47a16fa
to
2bef97e
Compare
a6a547b
to
e5e15ea
Compare
Hi, when I get the subgroups participants of a community, I get many @lid numbers. For sample:
Here, 'participants' has many @lid numbers. Is possible I get the contact names of this @lid numbers? |
Please, What's difference between join a group and link a group to community? |
With |
Hi, But in your sample, you are joining a group to community, not a user. Is this ok?
|
In the sample I am not joining a group to community, but the current user (a bot) joins the subgroup of a community |
I got it. Thanks.
|
Hi, does a specific subgroup can be linked to many communities? |
Really required feature!! Please approve and merge :) |
Hi, is there some news about it? Sorry to ask you. |
Does group_join and group_ leave with communities as well? |
If you join a community and the administrator sets the case that you cannot view group members, can you export group members' mobile phone numbers? All I got was group member lid |
Table of Contents
- Description
- Related Issues
- Usage Example
- I Want to Test this PR
- I Got an Error While Testing This PR ❌
- How Has the PR Been Tested (latest test on 30.11.2023)
- Types of Changes
Description
The PR introduces new functionality for managing communities.
By default, a community consists of two components: the parent group and its default subgroup, which serves as an announcement group. The default subgroup is represented by an instance of
GroupChat
as it functions like a typical "closed" group. The parent group, however, is an instance of theCommunity
class, and all community-related operations are carried out on it.The
Community
class extends theGroupChat
class, making all the methods available to theCommunity
class as well.You can simply retrieve a parent group object or its subgroup object.
group_join
event: is now emitted also when a user joins community linked subgroupsgroup_admin_changed
event: is now emitted also when a user is promoted/demoted in community linked subgroupsClient.createCommunity
that takes required parametertitle
and can also take an optional objectoptions
with properties:description
for a community descriptionsubGroupIds
for linking these groups to the community at a time of its creationmembershipApprovalMode
, false by defaultallowNonAdminSubGroupCreation
, false by defaultCommunity.linkSubgroups
that takes a single group ID or an array of group IDs to link to the communityCommunity.unlinkSubgroups
, the same as previous but for group unlinking, can also take an optional objectoptions
with a boolean propertyremoveOrphanMembers
(false by default). If true, the method will remove specified subgroups from the community along with their members who are not part of any other subgroups within the communityClient.joinSubgroup
andCommunity.joinSubgroup
methods to join a community subgroup by community ID and a subgroup IDCommunity.promoteParticipants
andCommunity.demoteParticipants
now supports communitiesCommunity.removeParticipants
method now supports communitiesCommunity.getParticipants
method to retrieve community participantsCommunity.getSubgroups
method to retrieve the list of community subgroupsCommunity.getJoinedSubgroups
method to retrieve the community subgroups the current user is a member ofCommunity.getUnjoinedSubgroups
method to retrieve all community subgroups in which the current user is not yet a member, preferable to use in a case when the current user is not a community owner/admin but only a member, otherwise, the result will be an empty arrayCommunity.setNonAdminSubGroupCreation
method that sets who can add groups to the community (only admins or all members)Client.deactivateCommunity
andCommunity.deactivate
methods for community creatorsCommunity.leave
method now supports communitiesRelated Issues
The PR closes #2533, closes #2483
Usage Example
1. To get the community object (the parent group, is an instance of
Community
):2. To get the default community subgroup object (is an instance of
GroupChat
):3. To create the community:
4. To link subgroups to the community:
5. To unlink subgroups from the community:
6. To join community subgroup:
7. To promote/demote community members:
8. To remove participants:
9. To get community participants:
10. To get community subgroups:
11. To get joined subgroups:
12. To get unjoined subgroups:
13. To set who can add groups to the community (only admins or all members):
14. To deactivate the community:
15. To leave the community:
To test this PR by yourself you can run one of the following commands:
If you encounter any errors while testing this PR, please provide in a comment:
console.log(await client.getWWebVersion());
Important
You have to reapply the PR each time it is changed (new commits were pushed since your last application)
How Has The PR Been Tested (latest test on 30.11.2023)
Tested with the code provided in usage example.
Tested On:
Types of accounts:
Environment:
Types of Changes
Checklist