# `BaileysEx.Feature.Community`
[🔗](https://github.com/jeffhuen/baileys_ex/blob/main/lib/baileys_ex/feature/community.ex#L1)

Community-management helpers mapped from Baileys' `communities.ts`.

# `participant_result`

```elixir
@type participant_result() :: %{
  :jid =&gt; String.t(),
  :status =&gt; String.t(),
  optional(:content) =&gt; BaileysEx.BinaryNode.t()
}
```

# `accept_invite`

```elixir
@spec accept_invite(term(), String.t()) :: {:ok, String.t() | nil} | {:error, term()}
```

Accept a legacy invite code and return the joined community JID.

# `accept_invite_v4`

```elixir
@spec accept_invite_v4(term(), String.t() | map(), map(), keyword()) ::
  {:ok, String.t() | nil} | {:error, term()}
```

Accept a v4 invite and emit the same post-join side effects Baileys performs.

# `create`

```elixir
@spec create(term(), String.t(), String.t() | nil, keyword()) ::
  {:ok, map() | nil} | {:error, term()}
```

Create a new community and return the created metadata when the follow-up metadata fetch succeeds.

# `create_group`

```elixir
@spec create_group(term(), String.t(), [String.t()], String.t(), keyword()) ::
  {:ok, map() | nil} | {:error, term()}
```

Create a linked subgroup inside a community.

# `extract_metadata`

```elixir
@spec extract_metadata(BaileysEx.BinaryNode.t()) :: map()
```

Extract Baileys-aligned community metadata from a community IQ result node.

# `fetch_all_participating`

```elixir
@spec fetch_all_participating(
  term(),
  keyword()
) :: {:ok, %{required(String.t()) =&gt; map()}} | {:error, term()}
```

Fetch all participating communities and optionally emit a `groups_update` event.

# `fetch_linked_groups`

```elixir
@spec fetch_linked_groups(term(), String.t()) ::
  {:ok,
   %{community_jid: String.t(), is_community: boolean(), linked_groups: [map()]}}
  | {:error, term()}
```

Fetch all linked groups for a community or subgroup JID.

# `get_invite_info`

```elixir
@spec get_invite_info(term(), String.t()) :: {:ok, map()} | {:error, term()}
```

Fetch the metadata associated with an invite code without joining.

# `handle_dirty_update`

```elixir
@spec handle_dirty_update(term(), %{type: String.t()}, keyword()) ::
  {:ok, %{required(String.t()) =&gt; map()}} | :ignore | {:error, term()}
```

Handle a dirty community update by refetching communities and cleaning the groups dirty bucket.

# `invite_code`

```elixir
@spec invite_code(term(), String.t()) :: {:ok, String.t() | nil} | {:error, term()}
```

Fetch the current invite code for a community.

# `join_approval_mode`

```elixir
@spec join_approval_mode(term(), String.t(), :on | :off) :: :ok | {:error, term()}
```

Toggle join-approval mode for a community.

# `leave`

```elixir
@spec leave(term(), String.t()) :: :ok | {:error, term()}
```

Leave a community.

# `link_group`

```elixir
@spec link_group(term(), String.t(), String.t()) :: :ok | {:error, term()}
```

Link an existing subgroup into a community.

# `member_add_mode`

```elixir
@spec member_add_mode(term(), String.t(), :admin_add | :all_member_add) ::
  :ok | {:error, term()}
```

Switch whether only admins or all members can add participants.

# `metadata`

```elixir
@spec metadata(term(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
```

Fetch interactive metadata for a community.

# `participants_update`

```elixir
@spec participants_update(
  term(),
  String.t(),
  [String.t()],
  :add | :remove | :promote | :demote
) ::
  {:ok, [participant_result()]} | {:error, term()}
```

Add, remove, promote, or demote participants in a community.

# `request_participants_list`

```elixir
@spec request_participants_list(term(), String.t()) ::
  {:ok, [map()]} | {:error, term()}
```

Fetch the pending membership-approval request list for a community.

# `request_participants_update`

```elixir
@spec request_participants_update(
  term(),
  String.t(),
  [String.t()],
  :approve | :reject
) ::
  {:ok, [participant_result()]} | {:error, term()}
```

Approve or reject pending community membership requests.

# `revoke_invite`

```elixir
@spec revoke_invite(term(), String.t()) :: {:ok, String.t() | nil} | {:error, term()}
```

Revoke the current invite code and return the new one.

# `revoke_invite_v4`

```elixir
@spec revoke_invite_v4(term(), String.t(), String.t()) :: :ok | {:error, term()}
```

Revoke a v4 invite for a specific invited user.

# `setting_update`

```elixir
@spec setting_update(
  term(),
  String.t(),
  :announcement | :not_announcement | :locked | :unlocked
) :: :ok | {:error, term()}
```

Update announcement or locked settings for a community.

# `toggle_ephemeral`

```elixir
@spec toggle_ephemeral(term(), String.t(), non_neg_integer()) ::
  :ok | {:error, term()}
```

Enable or disable disappearing messages for a community.

# `unlink_group`

```elixir
@spec unlink_group(term(), String.t(), String.t()) :: :ok | {:error, term()}
```

Unlink a subgroup from a community.

# `update_description`

```elixir
@spec update_description(term(), String.t(), String.t() | nil, keyword()) ::
  :ok | {:error, term()}
```

Update or clear the community description.

# `update_subject`

```elixir
@spec update_subject(term(), String.t(), String.t()) :: :ok | {:error, term()}
```

Update the subject for an existing community.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
