Nostr.Event.Communities (Nostr Lib v0.2.1) (event) (nip51)

View Source

Communities List (Kind 10004)

A list of NIP-72 communities the user belongs to. Contains references to community definition events (kind:34550) via a tags.

Defined in NIP 51 https://github.com/nostr-protocol/nips/blob/master/51.md

Summary

Functions

Creates a new communities list (kind 10004).

Parses a kind 10004 event into a Communities struct.

Types

t()

@type t() :: %Nostr.Event.Communities{communities: [binary()], event: Nostr.Event.t()}

Functions

create(community_refs, opts \\ [])

@spec create([binary()], Keyword.t()) :: t()

Creates a new communities list (kind 10004).

Arguments

  • community_refs - List of community addresses (kind:34550 addressable references)
  • opts - Optional event arguments (pubkey, created_at)

Example

iex> Communities.create(["34550:pubkey:community-name"])

parse(event)

@spec parse(Nostr.Event.t()) :: t()

Parses a kind 10004 event into a Communities struct.