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

View Source

Emoji Sets (Kind 30030)

Categorized custom emoji groups. This is an addressable event with a d tag identifier. Contains emoji tags in NIP-30 format.

Sets can have optional metadata: title, image, and description.

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

Summary

Functions

Creates a new emoji set (kind 30030).

Parses a kind 30030 event into an EmojiSets struct.

Types

emoji_entry()

@type emoji_entry() :: %{shortcode: binary(), url: binary()}

t()

@type t() :: %Nostr.Event.EmojiSets{
  description: binary() | nil,
  emojis: [emoji_entry()],
  event: Nostr.Event.t(),
  identifier: binary(),
  image: binary() | nil,
  title: binary() | nil
}

Functions

create(identifier, emojis, opts \\ [])

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

Creates a new emoji set (kind 30030).

Arguments

  • identifier - Unique identifier for this set (used in d tag)
  • emojis - List of emoji entries
  • opts - Optional event arguments and set metadata

Emoji Entry Formats

Emojis can be specified as:

  • {"shortcode", "https://url.to/emoji.png"} - Tuple format
  • %{shortcode: "name", url: "https://..."} - Map format

Options

  • :title - Set title for display
  • :image - Set image URL
  • :description - Set description
  • :pubkey - Event author pubkey
  • :created_at - Event timestamp

Example

EmojiSets.create("party-emojis", [
  {"party", "https://example.com/party.gif"},
  {"celebrate", "https://example.com/celebrate.png"}
],
  title: "Party Emojis",
  description: "Celebration themed custom emojis"
)

parse(event)

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

Parses a kind 30030 event into an EmojiSets struct.