EDA.API.Channel (EDA v0.3.0)

Copy Markdown View Source

REST API endpoints for Discord channels.

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

Summary

Functions

Creates a channel in a guild.

Deletes a channel.

Deletes channel permission overwrites for a user or role.

Edits channel permission overwrites for a user or role.

Gets a channel by ID.

Modifies guild channel positions.

Sets a voice channel's status (up to 500 characters, or nil to clear it).

Triggers the typing indicator in a channel.

Functions

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

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

Creates a channel in a guild.

delete(channel_id, opts \\ [])

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

Deletes a channel.

delete_permissions(channel_id, overwrite_id)

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

Deletes channel permission overwrites for a user or role.

edit_permissions(channel_id, overwrite_id, opts)

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

Edits channel permission overwrites for a user or role.

get(channel_id)

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

Gets a channel by ID.

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

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

Modifies a channel.

modify_positions(guild_id, positions)

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

Modifies guild channel positions.

set_voice_status(channel_id, status, opts \\ [])

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

Sets a voice channel's status (up to 500 characters, or nil to clear it).

Requires the SET_VOICE_CHANNEL_STATUS permission, plus MANAGE_CHANNELS if the bot is not connected to the channel.

Options

  • :reason - Audit log reason

trigger_typing(channel_id)

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

Triggers the typing indicator in a channel.