EDA.GuildTemplate (EDA v0.3.0)

Copy Markdown View Source

Represents a Discord Guild Template.

Guild Templates allow users to create guilds from a predefined structure of channels, roles, and settings. Templates are identified by a unique alphanumeric code (e.g. "hgM48av5Q69A").

Fields

FieldTypeDescription
codestringUnique template code
namestringTemplate name (1-100 chars)

| description | string | nil | Description (0-120 chars) | | usage_count | integer | Times this template has been used | | creator_id | snowflake | ID of the template creator | | creator | map | User object of the creator | | created_at | string | ISO8601 creation timestamp | | updated_at | string | ISO8601 last sync timestamp | | source_guild_id | snowflake | ID of the source guild | | serialized_source_guild | SourceGuild.t() | Guild snapshot | | is_dirty | boolean | nil | Has unsynced changes |

Constants

EDA.GuildTemplate.max_name_length()        # => 100
EDA.GuildTemplate.max_description_length()  # => 120

Summary

Functions

Converts a raw Discord guild template map into this struct.

Maximum length for a template description (0-120 characters).

Maximum length for a template name (1-100 characters).

Types

t()

@type t() :: %EDA.GuildTemplate{
  code: String.t() | nil,
  created_at: String.t() | nil,
  creator: map() | nil,
  creator_id: String.t() | nil,
  description: String.t() | nil,
  is_dirty: boolean() | nil,
  name: String.t() | nil,
  serialized_source_guild: EDA.GuildTemplate.SourceGuild.t() | nil,
  source_guild_id: String.t() | nil,
  updated_at: String.t() | nil,
  usage_count: integer() | nil
}

Functions

from_raw(raw)

@spec from_raw(map()) :: t()

Converts a raw Discord guild template map into this struct.

Parses serialized_source_guild into a SourceGuild struct.

Examples

iex> EDA.GuildTemplate.from_raw(%{"code" => "abc", "name" => "My Template", "usage_count" => 3})
%EDA.GuildTemplate{code: "abc", name: "My Template", usage_count: 3}

max_description_length()

@spec max_description_length() :: 120

Maximum length for a template description (0-120 characters).

max_name_length()

@spec max_name_length() :: 100

Maximum length for a template name (1-100 characters).