EDA.API.Guild (EDA v0.3.0)

Copy Markdown View Source

REST API endpoints for Discord guilds.

All functions return {:ok, result} or {:error, reason}.

Summary

Functions

Gets the audit log for a guild.

Gets channels in a guild.

Gets a guild by ID.

Gets invites for a guild.

Begins a guild prune.

Gets the number of members that would be pruned.

Functions

audit_log(guild_id, opts \\ [])

@spec audit_log(
  String.t() | integer(),
  keyword()
) ::
  {:ok, %{entries: [EDA.AuditLog.Entry.t()], users: [map()], webhooks: [map()]}}
  | {:error, term()}

Gets the audit log for a guild.

Options

  • :user_id - Filter by user who performed the action
  • :action_type - Filter by action type (integer or atom via EDA.AuditLog.action_type/1)
  • :before - Get entries before this entry ID
  • :after - Get entries after this entry ID
  • :limit - Number of entries (1-100, default 50)

channels(guild_id)

@spec channels(String.t() | integer()) :: {:ok, [map()]} | {:error, term()}

Gets channels in a guild.

get(guild_id)

@spec get(String.t() | integer()) :: {:ok, map()} | {:error, term()}

Gets a guild by ID.

invites(guild_id)

@spec invites(String.t() | integer()) :: {:ok, [map()]} | {:error, term()}

Gets invites for a guild.

modify(guild_id, payload, opts \\ [])

@spec modify(String.t() | integer(), map(), keyword()) ::
  {:ok, map()} | {:error, term()}

Modifies a guild.

prune(guild_id, opts)

@spec prune(String.t() | integer(), map()) :: {:ok, map()} | {:error, term()}

Begins a guild prune.

prune_count(guild_id, opts \\ [])

@spec prune_count(
  String.t() | integer(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Gets the number of members that would be pruned.