Represents a Discord guild.
Summary
Functions
Applies a changeset to a guild. No-op if the changeset has no changes.
Adds a change to an existing changeset for this entity.
Creates a changeset for batching mutations to this entity.
Gets channels for a guild, returned as %EDA.Channel{} structs.
Deletes a guild. The bot must be the owner.
Fetches a guild by ID. Checks cache first, falls back to REST.
Fetches a guild by ID. Raises on error.
Returns the CDN URL for the guild's icon, or nil if the guild has no icon.
Modifies a guild. Accepts a struct or ID, a map of changes, and options.
Types
@type t() :: %EDA.Guild{ channels: [EDA.Channel.t()] | nil, icon: String.t() | nil, id: String.t() | nil, large: boolean() | nil, member_count: integer() | nil, members: [EDA.Member.t()] | nil, name: String.t() | nil, owner_id: String.t() | nil, presences: [map()] | nil, roles: [EDA.Role.t()] | nil, unavailable: boolean() | nil, voice_states: [map()] | nil }
Functions
@spec apply_changeset( EDA.Entity.Changeset.t(), keyword() ) :: {:ok, t()} | {:error, term()}
Applies a changeset to a guild. No-op if the changeset has no changes.
Options
:reason- Audit log reason
@spec change(EDA.Entity.Changeset.t(), atom(), term()) :: EDA.Entity.Changeset.t()
Adds a change to an existing changeset for this entity.
@spec changeset(t()) :: EDA.Entity.Changeset.t()
Creates a changeset for batching mutations to this entity.
@spec channels(t() | String.t() | integer()) :: {:ok, [EDA.Channel.t()]} | {:error, term()}
Gets channels for a guild, returned as %EDA.Channel{} structs.
Deletes a guild. The bot must be the owner.
Fetches a guild by ID. Checks cache first, falls back to REST.
Accepts a guild struct or a string/integer ID.
Fetches a guild by ID. Raises on error.
Returns the CDN URL for the guild's icon, or nil if the guild has no icon.
Examples
EDA.Guild.icon_url(guild)
#=> "https://cdn.discordapp.com/icons/123/abc.png"
Modifies a guild. Accepts a struct or ID, a map of changes, and options.
Options
:reason- Audit log reason