REST API endpoints for Discord guild templates.
All functions return {:ok, result} or {:error, reason}.
Summary
Functions
Creates a guild template.
Creates a new guild from a template.
Deletes a guild template. Returns the deleted template.
Gets a guild template by its code.
Lists all templates for a guild.
Modifies a guild template's metadata.
Syncs a guild template with the current guild state.
Functions
@spec create(String.t() | integer(), map()) :: {:ok, EDA.GuildTemplate.t()} | {:error, term()}
Creates a guild template.
Requires the MANAGE_GUILD permission.
Parameters
guild_id- The guild IDparams- Map with::name- Template name (required, 1-100 chars):description- Template description (optional, 0-120 chars)
Creates a new guild from a template.
The bot must be in fewer than 10 guilds. Returns the raw guild object as a map.
Parameters
code- The template codeparams- Map with::name- Guild name (required, 2-100 chars):icon- Base64 128x128 image for the guild icon (optional)
@spec delete(String.t() | integer(), String.t()) :: {:ok, EDA.GuildTemplate.t()} | {:error, term()}
Deletes a guild template. Returns the deleted template.
Requires the MANAGE_GUILD permission.
Parameters
guild_id- The guild IDcode- The template code
@spec get(String.t()) :: {:ok, EDA.GuildTemplate.t()} | {:error, term()}
Gets a guild template by its code.
This endpoint does not require authentication.
Parameters
code- The template code (e.g."hgM48av5Q69A")
@spec list(String.t() | integer()) :: {:ok, [EDA.GuildTemplate.t()]} | {:error, term()}
Lists all templates for a guild.
Requires the MANAGE_GUILD permission.
Parameters
guild_id- The guild ID
@spec modify(String.t() | integer(), String.t(), map()) :: {:ok, EDA.GuildTemplate.t()} | {:error, term()}
Modifies a guild template's metadata.
Requires the MANAGE_GUILD permission.
Parameters
guild_id- The guild IDcode- The template codeparams- Map with::name- Template name (optional, 1-100 chars):description- Template description (optional, 0-120 chars)
@spec sync(String.t() | integer(), String.t()) :: {:ok, EDA.GuildTemplate.t()} | {:error, term()}
Syncs a guild template with the current guild state.
Requires the MANAGE_GUILD permission. This is a PUT with no body.
Parameters
guild_id- The guild IDcode- The template code