Crux vdev Crux.Rest behaviour View Source

Main entry point for Crux.Rest.

This module fits under a supervision tree, see start_link/1's' arguments for configuration.

Link to this section Summary

Types

Used to add a member to a guild via add_guild_member/3

Used to filter audit log results via get_audit_logs/2.
The :user_id field refers to the executor and not the target of the log

Used to prune inactive guild members with begin_guild_prune/2

Used to send messages via create_message/2

Used to edit overwrites for a role or member with edit_channel_permissions/3

Used to send and embed via create_message/2

Used for sending discord webhooks. For more information on non-discord webhooks, check
Slack Docs or
Github Docs

Used to list the current user's guilds in c:get_current_user_guild_/1

Used to get messages from the api via get_messages/2

Used to get more specific users who reacted to a message from the api via get_reactions/4

Used to create a role in a guild with create_guild_role/2

Used to list guild members via c:listt_guild_members/2

Used to edit messages via edit_message/2 or edit_message/3

Used to modify a channel via modify_channel/2

Used to modify the currently logged in modify_current_user/1

Used to modify a guild emoji via modify_guild_emoji/3

Used to modify a member with modify_guild_member/3

Options used to start Crux.Rest

A Discord snowflake, fits in a 64bit integer

Functions

Executes a request

Executes a request, but raises on error

Starts a Crux.Rest process linked to the current process

Callbacks

Adds a user to a guild via a provided oauth2 access token with the guilds.join scope

The same as add_guild_member/3, but raises an exception if it fails

The same as add_guild_member_role/4, but raises an exception if it fails

Adds a message to the pinned messages of a channel

Adds a message to the pinned messages of a channel

The same as add_pinned_message/1, but raises an exception if it fails

The same as add_pinned_message/2, but raises an exception if it fails

Prunes members in a guild

The same as begin_guild_prune/2, but raises an exception if it fails

Creates an invite to a channel, see Crux.Rest.create_channel_invite_data/0 for available options

The same as create_channel_invite/2, but raises an exception if it fails

Creates a new dm channel with a user

The same as create_dm/1, but raises an exception if it fails

The same as create_guild/1, but raises an exception if it fails

Bans a user from a guild; The user does not have to be part of the guild

The same as create_guild_ban/3, but raises an exception if it fails

Creates a channel in a guild, see Crux.Rest.create_guild_channel_data/0 for available options

The same as create_guild_channel/2, but raises an exception if it fails

Creates an emoji in a guild, see Crux.Rest.create_guild_emoji_data/0 for available options

The same as create_guild_emoji/2, but raises an exception if it fails

Attaches an integration from the current user to a guild

The same as create_guild_integration/2, but raises an exception if it fails

Creates a role in a guild

The same as create_guild_role/2, but raises an exception if it fails

Sends a message to a channel

The same as create_message/2, but raises an exception if it fails

Creates a reaction on a message, or increases its count by one

Creates a reaction on a message, or increases its count by one

The same as create_reaction/2, but raises an exception if it fails

The same as create_reaction/3, but raises an exception if it fails

Deletes all reactions from a message

Deletes all reactions from a message

The same as delete_all_reactions/2, but raises an exception if it fails

The same as delete_all_reactions/3, but raises an exception if it fails

The same as delete_channel/2, but raises an exception if it fails

Deletes an overwrite from a channel

Deletes a guild, can only be used if the executing user is the owner

The same as delete_guild/1, but raises an exception if it fails

Deletes an emoji from a guild

The same as delete_guild_emoji/3, but raises an exception if it fails

Deletes an integration from a guild

The same as delete_guild_integration/2, but raises an exception if it fails

Deletes a role in a guild

The same as delete_guild_role/3, but raises an exception if it fails

Deletes an invite

The same as delete_invite/1, but raises an exception if it fails

Deletes a message

The same as delete_message/1, but raises an exception if it fails

The same as delete_message/2, but raises an exception if it fails

Deletes 2-100 messages not older than 14 days

The same as delete_messages/2, but raises an exception if it fails

Deletes a message from the pinned messages. This does not delete the message itself

Deletes a message from the pinned messages. This does not delete the message itself

The same as delete_pinned_message/1, but raises an exception if it fails

The same as delete_pinned_message/2, but raises an exception if it fails

Deletes a user from a reaction

The same as delete_reaction/4, but raises an exception if it fails

Deletes a webhook

The same as delete_webhook/2, but raises an exception if it fails

Edits or creates an overwrite for a user, or member

The same as edit_channel_permissions/3, but raises an exception if it fails

Edits a message

The same as edit_message/2, but raises an exception if it fails

The same as edit_message/3, but raises an exception if it fails

The same as execute_github_webhook/4, but raises an exception if it fails

The same as execute_slack_webhook/3, but raises an exception if it fails

The same as execute_slack_webhook/4, but raises an exception if it fails

The same as execute_webhook/3, but raises an exception if it fails

The same as execute_webhook/4, but raises an exception if it fails

Gets the gateway url from the api

The same as gateway/0, but raises an exception if it fails

Gets the gateway url along a recommended shards count from the api

The same as gateway_bot/0, but raises an exception if it fails

Gets the audit logs for a guild

The same as get_audit_logs/2, but raises an exception if it fails

Gets a channel from the api.
This should NOT be necessary

The same as get_channel/1, but raises an exception if it fails

Gets invites for the specified channel from the api

The same as get_channel_invites/1, but raises an exception if it fails

Gets a list of partial Crux.Structs.Guilds the current user is a member of

The same as get_current_user_guilds/1, but raises an exception if it fails

Gets a guild from the api.
This should usually, due to cache, NOT be necessary

The same as get_guild/1, but raises an exception if it fails

Gets a single ban entry by id

The same as get_guild_ban/2, but raises an exception if it fails

Gets a map of banned users along their ban reasons

The same as get_guild_bans/1, but raises an exception if it fails

Gets all channels from a guild via the api.
This should usually, due to caching, NOT be necessary

The same as get_guild_channels/1, but raises an exception if it fails

Gets a guild's embed (server widget)

The same as get_guild_embed/1, but raises an exception if it fails

Gets an emoji from a guild
This should usually, due to cache, NOT be necessary

The same as get_guild_emoji/2, but raises an exception if it fails

Gets a list of guild integrations

The same as get_guild_integrations/1, but raises an exception if it fails

Gets all available invites in a guild

The same as get_guild_invites/1, but raises an exception if it fails

Gets a member from the api

The same as get_guild_member/2, but raises an exception if it fails

Gets the number of members in a guild that would be removed when pruned

The same as get_guild_prune_count/2, but raises an exception if it fails

Gets a list of roles in a guild.
This should usually, due to caching, NOT be necessary

The same as get_guild_roles/1, but raises an exception if it fails

Gets the vanity url of a guild, if any

The same as get_guild_vanity_url/1, but raises an exception if it fails

Gets a list of voice regions for a guild. Returns VIP servers when the guild is VIP-enabled

The same as get_guild_voice_regions/1, but raises an exception if it fails

Gets an invite from the api

The same as get_invite/1, but raises an exception if it fails

Gets a message from the api

The same as get_message/2, but raises an exception if it fails

Gets 1-100 messages from the api, this limit is enforced on discord's end

The same as get_messages/2, but raises an exception if it fails

Gets a list of pinned messages from the api

The same as get_pinned_messages/1, but raises an exception if it fails

Gets users who reacted to a message

The same as get_reactions/3, but raises an exception if it fails

The same as get_reactions/4, but raises an exception if it fails

Gets a user from the api

The same as get_user/1, but raises an exception if it fails

Gets a webhook

The same as get_webhook/2, but raises an exception if it fails

Leaves a guild

The same as leave_guild/1, but raises an exception if it fails

Gets a channel's webhook list

The same as list_channel_webhooks/1, but raises an exception if it fails

Gets a list of emojis in a guild.
This should usually, due to cache, NOT be necessary

The same as list_guild_emojis/1, but raises an exception if it fails

Gets a list of members from the guild

The same as list_guild_members/2, but raises an exception if it fails

Gets a guild's webhook list

The same as list_guild_webhooks/1, but raises an exception if it fails

Modifies a channel, see Crux.Rest.modify_channel_data/0 for available options

The same as modify_channel/2, but raises an exception if it fails

Modifes the currently logged in user

The same as modify_current_user/1, but raises an exception if it fails

Modifies the nickname of the current user in a guild

The same as modify_current_users_nick/3, but raises an exception if it fails

Updates a guild, see Crux.Rest.modify_guild_data/0 for available options

The same as modify_guild/2, but raises an exception if it fails

Modifyies the position of a list of channels in a guild

Modifies a guild's embed (server widget)

The same as modify_guild_embed/2, but raises an exception if it fails

The same as modify_guild_emoji/3, but raises an exception if it fails

Modifies an integreation for a guild

Modifies a member in a guild

The same as modify_guild_member/3, but raises an exception if it fails

Modifies a role in a guild

The same as modify_guild_role/3, but raises an exception if it fails

Modifies the positions of a list of role objects for a guild

The same as modify_guild_role_positions/2, but raises an exception if it fails

Removes a ban for a user from a guild

The same as remove_guild_ban/3, but raises an exception if it fails

Syncs an integration for a guild

The same as sync_guild_integration/2, but raises an exception if it fails

Lets the bot appear as typing for roughly ~9 seconds or until a message is sent.
Should generally be used sparingly for commands that may take a while as a form of acknowledging

The same as trigger_typing/1, but raises an exception if it fails

The same as update_webhook/3, but raises an exception if it fails

Link to this section Types

Link to this type

add_guild_member_data() View Source (since 0.1.0)
add_guild_member_data() ::
  %{
    :access_token => String.t(),
    optional(:nick) => String.t() | nil,
    optional(:roles) => [Crux.Rest.snowflake()],
    optional(:mute) => boolean(),
    optional(:deaf) => boolean(),
    optional(:reason) => String.t()
  }
  | [
      access_token: String.t(),
      nick: String.t() | nil,
      roles: [Crux.Rest.snowflake()],
      mute: boolean(),
      deaf: boolean(),
      reason: String.t()
    ]

Used to add a member to a guild via add_guild_member/3.

Link to this type

audit_log_options() View Source (since 0.1.7)
audit_log_options() ::
  %{
    optional(:user_id) => Crux.Rest.snowflake(),
    optional(:action_type) => pos_integer(),
    optional(:before) => Crux.Rest.snowflake(),
    optional(:limit) => pos_integer()
  }
  | [
      user_id: Crux.Rest.snowflake(),
      action_type: pos_integer(),
      before: Crux.Rest.snowflake(),
      limit: pos_integer()
    ]

Used to filter audit log results via get_audit_logs/2.
The :user_id field refers to the executor and not the target of the log.

Link to this type

begin_guild_prune_opts() View Source (since 0.2.0)
begin_guild_prune_opts() ::
  %{
    optional(:days) => pos_integer(),
    optional(:compute_prune_count) => boolean()
  }
  | [days: pos_integer(), compute_prune_count: boolean()]

Used to prune inactive guild members with begin_guild_prune/2.

Link to this type

create_channel_invite_data() View Source (since 0.1.0)
create_channel_invite_data() ::
  %{
    optional(:max_age) => non_neg_integer(),
    optional(:max_uses) => non_neg_integer(),
    optional(:temporary) => boolean(),
    optional(:unique) => boolean(),
    optional(:reason) => String.t()
  }
  | [
      max_age: non_neg_integer(),
      max_uses: non_neg_integer(),
      temporary: boolean(),
      unique: boolean(),
      reason: String.t()
    ]

Used to create invites via create_channel_invite/2.

Notes:

  • :max_age 0 indicates no max age, defaults to 86_400 (1 day)
  • :max_uses 0 indicates no max uses, defaults to 0
  • :temporary if true, members which do not get a role assigned within 24 hours get automatically kicked, defaults to false
  • :unique if true, always creates a new invite instead of maybe returning a similar one, defaults to false

    For more informations see Discord Docs.

Link to this type

create_guild_channel_data() View Source (since 0.1.0)
create_guild_channel_data() ::
  %{
    optional(:name) => String.t(),
    optional(:type) => non_neg_integer(),
    optional(:bitrate) => non_neg_integer() | nil,
    optional(:user_limit) => integer() | nil,
    optional(:permission_overwrites) => [
      Overwrite.t()
      | %{
          :id => Crux.Rest.snowflake(),
          :type => String.t(),
          optional(:allow) => non_neg_integer(),
          optional(:deny) => non_neg_integer()
        }
    ],
    optional(:parent_id) => Crux.Rest.snowflake() | nil,
    optional(:nsfw) => boolean(),
    optional(:reason) => String.t()
  }
  | [
      name: String.t(),
      type: pos_integer(),
      bitrate: non_neg_integer() | nil,
      user_limit: integer() | nil,
      permission_overwrites: [
        Overwrite.t()
        | %{
            :id => Crux.Rest.snowflake(),
            :type => String.t(),
            optional(:allow) => non_neg_integer(),
            optional(:deny) => non_neg_integer()
          }
      ],
      parent_id: Crux.Rest.snowflake() | nil,
      nsfw: boolean(),
      reason: String.t()
    ]

Used to create a channel via create_guild_channel/2.

Notes:

  • :name has to be [2-100] chars and may only contain [a-Z_-]
Link to this type

create_guild_emoji_data() View Source (since 0.1.0)
create_guild_emoji_data() ::
  %{
    :name => String.t(),
    :image => Crux.Rest.Util.image(),
    optional(:roles) => [Role.t() | Crux.Rest.snowflake()],
    optional(:reason) => String.t()
  }
  | [
      name: String.t(),
      image: Crux.Rest.Util.image(),
      roles: [Role.t() | Crux.Rest.snowflake()],
      reason: String.t()
    ]

Used to create emojis via create_guild_emoji/2.

Notes:

  • :name has to be [1-32] chars long, valid chars are [a-Z0-9] (invalid chars may get filtered out instead of erroring).
    A 1 char long name gets suffixed with `
    ` to be 2 chars long.
  • :image may not be larger than 256kb
  • :roles, if present limits the emoji to only those roles
Link to this type

create_message_data() View Source (since 0.1.0)
create_message_data() ::
  %{
    optional(:content) => String.t(),
    optional(:nonce) => non_neg_integer(),
    optional(:tts) => boolean(),
    optional(:embed) => embed(),
    optional(:files) => [Crux.Rest.Util.attachment()]
  }
  | [
      content: String.t(),
      nonce: non_neg_integer(),
      tts: boolean(),
      embed: embed(),
      files: [Crux.Rest.Util.attachment()]
    ]

Used to send messages via create_message/2.

The content my not exceed 2000 chars.
The nonce has to fit in a 64 bit integer.
The whole message payload may not be larger than 8mb, this should only be possible when attaching (a) large file(s).

Link to this type

edit_channel_permissions_data() View Source (since 0.1.0)
edit_channel_permissions_data() ::
  %{
    optional(:allow) => non_neg_integer(),
    optional(:deny) => non_neg_integer(),
    optional(:type) => String.t(),
    optional(:reason) => String.t()
  }
  | {{:allow, non_neg_integer()}
     | {:deny, non_neg_integer()}
     | {:type, :member | :role | String.t()}
     | {:reason, String.t()}}

Used to edit overwrites for a role or member with edit_channel_permissions/3

See Permissions for available bitflags.

Link to this type

embed() View Source (since 0.1.0)
embed() :: %{
  optional(:title) => String.t(),
  optional(:description) => String.t(),
  optional(:url) => String.t(),
  optional(:timestamp) => String.t(),
  optional(:color) => non_neg_integer(),
  optional(:footer) => %{
    optional(:text) => String.t(),
    optional(:icon_url) => String.t()
  },
  optional(:image) => %{optional(:url) => String.t()},
  optional(:thumbnail) => %{optional(:url) => String.t()},
  optional(:author) => %{
    optional(:name) => String.t(),
    optional(:url) => String.t(),
    optional(:icon_url) => String.t()
  },
  optional(:fields) => [
    %{:name => String.t(), :value => String.t(), optional(:inline) => boolean()}
  ]
}

Used to send and embed via create_message/2.

You should probably consult the Embed Limits page.

Link to this type

execute_webhook_options() View Source (since 0.1.7)
execute_webhook_options() :: %{
  optional(:content) => String.t(),
  optional(:username) => String.t(),
  optional(:avatar_url) => String.t(),
  optional(:tts) => boolean(),
  optional(:files) => [Crux.Rest.Util.attachment()],
  optional(:embeds) => [embed()]
}

Used for sending discord webhooks. For more information on non-discord webhooks, check
Slack Docs or
Github Docs

Link to this type

get_current_user_guild_data() View Source (since 0.1.4)
get_current_user_guild_data() :: %{
  optional(:before) => Crux.Rest.snowflake(),
  optional(:after) => Crux.Rest.snowflake(),
  optional(:limit) => pos_integer()
}

Used to list the current user's guilds in c:get_current_user_guild_/1.

Link to this type

get_messages_data() View Source (since 0.1.0)
get_messages_data() ::
  %{
    optional(:around) => Crux.Rest.snowflake(),
    optional(:before) => Crux.Rest.snowflake(),
    optional(:after) => Crux.Rest.snowflake(),
    optional(:limit) => pos_integer()
  }
  | [
      around: Crux.Rest.snowflake(),
      before: Crux.Rest.snowflake(),
      after: Crux.Rest.snowflake(),
      limit: pos_integer()
    ]

Used to get messages from the api via get_messages/2.

Notes:

  • :around is inclusive
  • :before and :after are exclusive
  • :limit has to be [1-100], defaults to 50
Link to this type

get_reactions_data() View Source (since 0.1.0)
get_reactions_data() ::
  %{
    optional(:before) => Crux.Rest.snowflake(),
    optional(:after) => Crux.Rest.snowflake(),
    optional(:limit) => pos_integer()
  }
  | [
      before: Crux.Rest.snowflake(),
      after: Crux.Rest.snowflake(),
      limit: pos_integer()
    ]

Used to get more specific users who reacted to a message from the api via get_reactions/4

Notes:

  • :before seems currently broken on discord's end
  • :after is exclusive
Link to this type

guild_role_data() View Source (since 0.1.2)
guild_role_data() ::
  %{
    optional(:name) => String.t(),
    optional(:permissions) => non_neg_integer(),
    optional(:color) => non_neg_integer(),
    optional(:hoist) => boolean(),
    optional(:mentionable) => boolean(),
    optional(:reason) => String.t()
  }
  | [
      name: String.t(),
      permissions: non_neg_integer(),
      color: non_neg_integer(),
      hoist: boolean(),
      mentionable: boolean(),
      reason: String.t()
    ]

Used to create a role in a guild with create_guild_role/2.

Link to this type

list_guild_members_options() View Source (since 0.1.0)
list_guild_members_options() ::
  %{
    optional(:limit) => pos_integer(),
    optional(:after) => Crux.Rest.snowflake()
  }
  | [limit: pos_integer(), after: Crux.Rest.snowflake()]

Used to list guild members via c:listt_guild_members/2.

Link to this type

message_edit_data() View Source (since 0.1.0)
message_edit_data() ::
  %{optional(:content) => String.t() | nil, optional(:embed) => embed() | nil}
  | [content: String.t(), embed: embed()]

Used to edit messages via edit_message/2 or edit_message/3.

The content my not exceed 2000 chars, this limit is enfored on discord's end.

Link to this type

modify_channel_data() View Source (since 0.1.0)
modify_channel_data() ::
  %{
    optional(:bitrate) => non_neg_integer(),
    optional(:icon) => Crux.Rest.Util.image(),
    optional(:name) => String.t() | nil,
    optional(:nsfw) => boolean(),
    optional(:parent_id) => Crux.Rest.snowflake() | nil,
    optional(:permission_overwrites) => [Overwrite.t()],
    optional(:position) => non_neg_integer(),
    optional(:rate_limit_per_user) => non_neg_integer(),
    optional(:reason) => String.t(),
    optional(:topic) => String.t() | nil,
    optional(:user_limit) => non_neg_integer() | nil
  }
  | [
      bitrate: non_neg_integer(),
      icon: Crux.Rest.Util.image(),
      name: String.t() | nil,
      nsfw: boolean(),
      parent_id: Crux.Rest.snowflake() | nil,
      permission_overwrites: [Overwrite.t()],
      position: non_neg_integer(),
      rate_limit_per_user: non_neg_integer(),
      reason: String.t(),
      topic: String.t() | nil,
      user_limit: integer() | nil
    ]

Used to modify a channel via modify_channel/2.

Notes

  • :name has to be [2-100] chars long.
  • :topic has to be [0-1024] chars long
  • :bitrate is in bits [8_000-96_000] (128_000 for VIP servers)
  • :user_limit has to be [0-99], 0 refers to no limit
  • :rate_limit_per_user has to be [0-120], 0 refers to no limit

    For more informations see Discord Docs.

Link to this type

modify_current_user_data() View Source (since 0.1.4)
modify_current_user_data() ::
  %{
    optional(:username) => String.t(),
    optional(:avatar) => Crux.Rest.Util.image()
  }
  | [username: String.t(), avatar: Crux.Rest.Util.image() | nil]

Used to modify the currently logged in modify_current_user/1.

Link to this type

modify_guild_channel_positions_data_entry() View Source (since 0.1.0)
modify_guild_channel_positions_data_entry() ::
  {Channel.t(), integer()}
  | {Crux.Rest.snowflake(), integer()}
  | %{channel: Channel.t(), position: integer()}
  | %{id: Crux.Rest.snowflake(), position: integer()}

Used to change a channel's position via modify_guild_channel_positions/2.

Link to this type

modify_guild_data() View Source (since 0.1.0)
modify_guild_data() ::
  %{
    optional(:name) => String.t(),
    optional(:region) => String.t(),
    optional(:verification_level) => non_neg_integer(),
    optional(:default_message_notifications) => non_neg_integer(),
    optional(:explicit_content_filter) => non_neg_integer(),
    optional(:afk_channel_id) => Crux.Rest.snowflake() | nil,
    optional(:afk_timeout) => non_neg_integer(),
    optional(:icon) => Crux.Rest.Util.image(),
    optional(:splash) => Crux.Rest.Util.image(),
    optional(:owner_id) => Crux.Rest.snowflake(),
    optional(:system_channel_id) => Crux.Rest.snowflake() | nil,
    optional(:reason) => String.t()
  }
  | [
      name: String.t(),
      region: String.t(),
      verification_level: non_neg_integer(),
      default_message_notifications: non_neg_integer(),
      explicit_content_filter: non_neg_integer(),
      afk_channel_id: Crux.Rest.snowflake() | nil,
      afk_timeout: non_neg_integer(),
      icon: Crux.Rest.Util.image(),
      splash: Crux.Rest.Util.image(),
      owner_id: Crux.Rest.snowflake(),
      system_channel_id: Crux.Rest.snowflake() | nil,
      reason: String.t()
    ]

TBD, see modify_guild/2

Link to this type

modify_guild_emoji_data() View Source (since 0.1.0)
modify_guild_emoji_data() ::
  %{
    optional(:name) => String.t(),
    optional(:roles) => [Role.t() | Crux.Rest.snowflake()],
    optional(:reason) => String.t()
  } :: [
    name: String.t(),
    roles: [Role.t() | Crux.Rest.snowflake()],
    reason: String.t()
  ]

Used to modify a guild emoji via modify_guild_emoji/3.

See Crux.Rest.create_guild_emoji_data/0 for name restrictions.

Link to this type

modify_guild_member_data() View Source (since 0.1.0)
modify_guild_member_data() ::
  %{
    optional(:nick) => String.t() | nil,
    optional(:roles) => [Crux.Rest.snowflake()],
    optional(:mute) => boolean(),
    optional(:deaf) => boolean(),
    optional(:channel_id) => Crux.Rest.snowflake(),
    optional(:reason) => String.t()
  }
  | [
      nick: String.t() | nil,
      roles: [Crux.Rest.snowflake()],
      mute: boolean(),
      deaf: boolean(),
      channel_id: Crux.Rest.snowflake(),
      reason: String.t()
    ]

Used to modify a member with modify_guild_member/3.

Notes:

  • :mute, :deaf, and :channel_id will silently be discarded by discord if the member is not connected to a voice channel.
Link to this type

options() View Source (since 0.2.0)
options() ::
  %{
    :token => String.t(),
    optional(:retry_limit) => non_neg_integer() | :infinity
  }
  | [token: String.t(), retry_limit: non_neg_integer() | :infinity]

Options used to start Crux.Rest.

Link to this type

snowflake() View Source (since 0.1.0)
snowflake() :: non_neg_integer()

A Discord snowflake, fits in a 64bit integer.

Received as integers via the gateway, but as strings via http.

They are normalized to integers via Crux.Structs.

Link to this section Functions

Link to this function

request(name, request) View Source (since 0.2.0)
request(name :: atom(), request :: Crux.Rest.Request.t()) ::
  {:ok, term()} | {:error, term()}

Executes a request.

Link to this function

request!(name, request) View Source (since 0.2.0)
request!(name :: atom(), request :: Crux.Rest.Request.t()) ::
  term() | no_return()

Executes a request, but raises on error.

Link to this function

start_link(args) View Source
start_link({name :: atom(), options()}) :: Supervisor.on_start()

Starts a Crux.Rest process linked to the current process.

Options are a tuple of a name atom and options/0.

Link to this section Callbacks

Link to this callback

add_guild_member(guild, user, data) View Source (since 0.2.0)
add_guild_member(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable(),
  data :: Crux.Rest.add_guild_member_data()
) :: {:ok, Member.t()} | {:error, term()}

Adds a user to a guild via a provided oauth2 access token with the guilds.join scope.

For more informations see Discord Docs.

Link to this callback

add_guild_member!(guild, user, data) View Source (optional) (since 0.2.0)
add_guild_member!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable(),
  data :: Crux.Rest.add_guild_member_data()
) :: Member.t() | no_return()

The same as add_guild_member/3, but raises an exception if it fails.

Link to this callback

add_guild_member_role(guild, member, role, reason) View Source (since 0.2.0)
add_guild_member_role(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  member :: Crux.Rest.Util.user_id_resolvable(),
  role :: Crux.Rest.Util.role_id_resolvable(),
  reason :: String.t()
) :: :ok | {:error, term()}

Adds a role to a member.

For more informations see Discord Docs.

Link to this callback

add_guild_member_role!(guild, member, role, reason) View Source (optional) (since 0.2.0)
add_guild_member_role!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  member :: Crux.Rest.Util.user_id_resolvable(),
  role :: Crux.Rest.Util.role_id_resolvable(),
  reason :: String.t()
) :: :ok | no_return()

The same as add_guild_member_role/4, but raises an exception if it fails.

Link to this callback

add_pinned_message(message) View Source (since 0.2.0)
add_pinned_message(message :: Message.t()) :: :ok | {:error, term()}

Adds a message to the pinned messages of a channel.

You may only have up to 50 pinned messages per channel.
For more informations see Discord Docs.

Link to this callback

add_pinned_message(channel, message) View Source (since 0.2.0)
add_pinned_message(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  message :: Crux.Rest.Util.message_id_resolvable()
) :: :ok | {:error, term()}

Adds a message to the pinned messages of a channel.

You may only have up to 50 pinned messages per channel.
For more informations see Discord Docs.

Link to this callback

add_pinned_message!(message) View Source (optional) (since 0.2.0)
add_pinned_message!(message :: Message.t()) :: :ok | no_return()

The same as add_pinned_message/1, but raises an exception if it fails.

Link to this callback

add_pinned_message!(channel, message) View Source (optional) (since 0.2.0)
add_pinned_message!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  message :: Crux.Rest.Util.message_id_resolvable()
) :: :ok | no_return()

The same as add_pinned_message/2, but raises an exception if it fails.

Link to this callback

begin_guild_prune(guild, opts) View Source (since 0.2.0)
begin_guild_prune(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  opts :: Crux.Rest.begin_guild_prune_opts()
) :: {:ok, non_neg_integer()} | {:error, term()}

Prunes members in a guild.

For more informations see Discord Docs.

Link to this callback

begin_guild_prune!(guild, opts) View Source (optional) (since 0.2.0)

The same as begin_guild_prune/2, but raises an exception if it fails.

Link to this callback

create_channel_invite(channel, args) View Source (since 0.2.0)
create_channel_invite(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  args :: Crux.Rest.create_channel_invite_data()
) :: {:ok, Invite.t()} | {:error, term()}

Creates an invite to a channel, see Crux.Rest.create_channel_invite_data/0 for available options.

For more informations see Discord Docs.

Link to this callback

create_channel_invite!(channel, args) View Source (optional) (since 0.2.0)
create_channel_invite!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  args :: Crux.Rest.create_channel_invite_data()
) :: Invite.t() | no_return()

The same as create_channel_invite/2, but raises an exception if it fails.

Link to this callback

create_dm(user) View Source (since 0.2.0)
create_dm(user :: Crux.Rest.Util.user_id_resolvable()) ::
  {:ok, Channel.t()} | {:error, term()}

Creates a new dm channel with a user.

For more informations see Discord Docs.

Link to this callback

create_dm!(user) View Source (optional) (since 0.2.0)
create_dm!(user :: Crux.Rest.Util.user_id_resolvable()) ::
  Channel.t() | no_return()

The same as create_dm/1, but raises an exception if it fails.

Link to this callback

create_guild(term) View Source (since 0.2.0)
create_guild(term()) :: {:ok, Guild.t()} | {:error, term()}

Link to this callback

create_guild!(term) View Source (optional) (since 0.2.0)
create_guild!(term()) :: Guild.t() | no_return()

The same as create_guild/1, but raises an exception if it fails.

Link to this callback

create_guild_ban(guild, user, reason) View Source (since 0.2.0)
create_guild_ban(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable(),
  reason :: String.t()
) :: :ok | {:error, term()}

Bans a user from a guild; The user does not have to be part of the guild.

For more informations see Discord Docs.

Link to this callback

create_guild_ban!(guild, user, reason) View Source (optional) (since 0.2.0)
create_guild_ban!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable(),
  reason :: String.t()
) :: :ok | no_return()

The same as create_guild_ban/3, but raises an exception if it fails.

Link to this callback

create_guild_channel(guild, data) View Source (since 0.2.0)
create_guild_channel(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: Crux.Rest.create_guild_channel_data()
) :: {:ok, Channel.t()} | {:error, term()}

Creates a channel in a guild, see Crux.Rest.create_guild_channel_data/0 for available options.

For more informations see Discord Docs.

Link to this callback

create_guild_channel!(guild, data) View Source (optional) (since 0.2.0)
create_guild_channel!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: Crux.Rest.create_guild_channel_data()
) :: Channel.t() | no_return()

The same as create_guild_channel/2, but raises an exception if it fails.

Link to this callback

create_guild_emoji(guild, data) View Source (since 0.2.0)
create_guild_emoji(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: Crux.Rest.create_guild_emoji_data()
) :: {:ok, Emoji} | {:error, term()}

Creates an emoji in a guild, see Crux.Rest.create_guild_emoji_data/0 for available options.

For more informations see Discord Docs.

Link to this callback

create_guild_emoji!(guild, data) View Source (optional) (since 0.2.0)
create_guild_emoji!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: Crux.Rest.create_guild_emoji_data()
) :: Emoji | no_return()

The same as create_guild_emoji/2, but raises an exception if it fails.

Link to this callback

create_guild_integration(guild, data) View Source (since 0.2.0)
create_guild_integration(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data ::
    %{type: String.t(), id: Crux.Rest.snowflake()}
    | [type: String.t(), id: Crux.Rest.snowflake()]
) :: :ok | {:error, term()}

Attaches an integration from the current user to a guild.

For more informations see Discord Docs.

Link to this callback

create_guild_integration!(guild, data) View Source (optional) (since 0.2.0)
create_guild_integration!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data ::
    %{type: String.t(), id: Crux.Rest.snowflake()}
    | [type: String.t(), id: Crux.Rest.snowflake()]
) :: :ok | no_return()

The same as create_guild_integration/2, but raises an exception if it fails.

Link to this callback

create_guild_role(guild, data) View Source (since 0.2.0)
create_guild_role(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: Crux.Rest.guild_role_data()
) :: {:ok, Role.t()} | {:error, term()}

Creates a role in a guild.

For more informations see Discord Docs.

Link to this callback

create_guild_role!(guild, data) View Source (optional) (since 0.2.0)
create_guild_role!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: Crux.Rest.guild_role_data()
) :: Role.t() | no_return()

The same as create_guild_role/2, but raises an exception if it fails.

Link to this callback

create_message(channel, args) View Source (since 0.2.0)
create_message(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  args :: Crux.Rest.create_message_data()
) :: {:ok, Message.t()} | {:error, term()}

Sends a message to a channel.

For more informations see Discord Docs

Link to this callback

create_message!(channel, args) View Source (optional) (since 0.2.0)
create_message!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  args :: Crux.Rest.create_message_data()
) :: Message.t() | no_return()

The same as create_message/2, but raises an exception if it fails.

Link to this callback

create_reaction(message, emoji) View Source (since 0.2.0)
create_reaction(
  message :: Crux.Rest.Util.message_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_identifier_resolvable()
) :: :ok | {:error, term()}

Creates a reaction on a message, or increases its count by one.

For more informations see Discord Docs.

Link to this callback

create_reaction(channel, message, emoji) View Source (since 0.2.0)
create_reaction(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  message :: Crux.Rest.Util.message_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_id_resolvable()
) :: :ok | {:error, term()}

Creates a reaction on a message, or increases its count by one.

For more informations see Discord Docs.

Link to this callback

create_reaction!(message, emoji) View Source (optional) (since 0.2.0)
create_reaction!(
  message :: Crux.Rest.Util.message_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_identifier_resolvable()
) :: :ok | no_return()

The same as create_reaction/2, but raises an exception if it fails.

Link to this callback

create_reaction!(channel, message, emoji) View Source (optional) (since 0.2.0)

The same as create_reaction/3, but raises an exception if it fails.

Link to this callback

delete_all_reactions(message, emoji) View Source (since 0.2.0)
delete_all_reactions(
  message :: Message.t(),
  emoji :: Crux.Rest.Util.emoji_identifier_resolvable()
) :: :ok | {:error, term()}

Deletes all reactions from a message.

For more informations see Discord Docs.

Link to this callback

delete_all_reactions(channel, message, emoji) View Source (since 0.2.0)
delete_all_reactions(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  message :: Crux.Rest.Util.message_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_identifier_resolvable()
) :: :ok | {:error, term()}

Deletes all reactions from a message.

For more informations see Discord Docs.

Link to this callback

delete_all_reactions!(message, emoji) View Source (optional) (since 0.2.0)
delete_all_reactions!(
  message :: Message.t(),
  emoji :: Crux.Rest.Util.emoji_identifier_resolvable()
) :: :ok | no_return()

The same as delete_all_reactions/2, but raises an exception if it fails.

Link to this callback

delete_all_reactions!(channel, message, emoji) View Source (optional) (since 0.2.0)

The same as delete_all_reactions/3, but raises an exception if it fails.

Link to this callback

delete_channel(channel, reason) View Source (since 0.2.0)
delete_channel(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  reason :: String.t()
) :: {:ok, Channel.t()} | {:error, term()}

Deletes a channel.

For more informations see Discord Docs.

Link to this callback

delete_channel!(channel, reason) View Source (optional) (since 0.2.0)
delete_channel!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  reason :: String.t()
) :: Channel.t() | no_return()

The same as delete_channel/2, but raises an exception if it fails.

Link to this callback

delete_channel_permissions(channel, target, reason) View Source (since 0.2.0)
delete_channel_permissions(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  target :: Crux.Rest.Util.overwrite_target_resolvable(),
  reason :: String.t()
) :: :ok | {:error, term()}

Deletes an overwrite from a channel.

For more informations see Discord Docs.

Link to this callback

delete_channel_permissions!(channel, target, reason) View Source (optional) (since 0.2.0)
delete_channel_permissions!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  target :: Crux.Rest.Util.overwrite_target_resolvable(),
  reason :: String.t()
) :: :ok | no_return()

The same as delete_channel_permissions/3, but raises an exception if it fails.

Link to this callback

delete_guild(guild) View Source (since 0.2.0)
delete_guild(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  :ok | {:error, term()}

Deletes a guild, can only be used if the executing user is the owner.

For more informations see Discord Docs.

Link to this callback

delete_guild!(guild) View Source (optional) (since 0.2.0)
delete_guild!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  :ok | no_return()

The same as delete_guild/1, but raises an exception if it fails.

Link to this callback

delete_guild_emoji(guild, emoji, reason) View Source (since 0.2.0)
delete_guild_emoji(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_id_resolvable(),
  reason :: String.t()
) :: :ok | {:error, term()}

Deletes an emoji from a guild.

For more informations see Discord Docs.

Link to this callback

delete_guild_emoji!(guild, emoji, reason) View Source (optional) (since 0.2.0)
delete_guild_emoji!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_id_resolvable(),
  reason :: String.t()
) :: :ok | no_return()

The same as delete_guild_emoji/3, but raises an exception if it fails.

Link to this callback

delete_guild_integration(guild, integration_id) View Source (since 0.2.0)
delete_guild_integration(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: Crux.Rest.snowflake()
) :: :ok | {:error, term()}

Deletes an integration from a guild.

For more informations see Discord Docs.

Link to this callback

delete_guild_integration!(guild, integration_id) View Source (optional) (since 0.2.0)
delete_guild_integration!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: Crux.Rest.snowflake()
) :: :ok | no_return()

The same as delete_guild_integration/2, but raises an exception if it fails.

Link to this callback

delete_guild_role(guild, role, reason) View Source (since 0.2.0)
delete_guild_role(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  role :: Crux.Rest.Util.role_id_resolvable(),
  reason :: String.t()
) :: :ok | {:error, term()}

Deletes a role in a guild.

For more informations see Discord Docs.

Link to this callback

delete_guild_role!(guild, role, reason) View Source (optional) (since 0.2.0)
delete_guild_role!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  role :: Crux.Rest.Util.role_id_resolvable(),
  reason :: String.t()
) :: :ok | no_return()

The same as delete_guild_role/3, but raises an exception if it fails.

Link to this callback

delete_invite(invite_or_code) View Source (since 0.2.0)
delete_invite(invite_or_code :: String.t() | Invite.t()) ::
  {:ok, Invite.t()} | {:error, term()}

Deletes an invite.

For more informations see Discord Docs.

Link to this callback

delete_invite!(invite_or_code) View Source (optional) (since 0.2.0)
delete_invite!(invite_or_code :: String.t() | Invite.t()) ::
  Invite.t() | no_return()

The same as delete_invite/1, but raises an exception if it fails.

Link to this callback

delete_message(message) View Source (since 0.2.0)
delete_message(message :: Message.t()) :: :ok | {:error, term()}

Deletes a message

For more informations see Discord Docs.

Link to this callback

delete_message(channel_id, message_id) View Source (since 0.2.0)
delete_message(
  channel_id :: Crux.Rest.Util.channel_id_resolvable(),
  message_id :: Crux.Rest.Util.message_id_resolvable()
) :: :ok | {:error, term()}

Deletes a message

For more informations see Discord Docs.

Link to this callback

delete_message!(message) View Source (optional) (since 0.2.0)
delete_message!(message :: Message.t()) :: :ok | no_return()

The same as delete_message/1, but raises an exception if it fails.

Link to this callback

delete_message!(channel_id, message_id) View Source (optional) (since 0.2.0)
delete_message!(
  channel_id :: Crux.Rest.Util.channel_id_resolvable(),
  message_id :: Crux.Rest.Util.message_id_resolvable()
) :: :ok | no_return()

The same as delete_message/2, but raises an exception if it fails.

Link to this callback

delete_messages(channel, messages) View Source (since 0.2.0)
delete_messages(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  messages :: [Crux.Rest.Util.message_id_resolvable()]
) :: :ok | {:error, term()}

Deletes 2-100 messages not older than 14 days.

For more informations see Discord Docs

Link to this callback

delete_messages!(channel, messages) View Source (optional) (since 0.2.0)
delete_messages!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  messages :: [Crux.Rest.Util.message_id_resolvable()]
) :: :ok | no_return()

The same as delete_messages/2, but raises an exception if it fails.

Link to this callback

delete_pinned_message(message) View Source (since 0.2.0)
delete_pinned_message(message :: Message.t()) :: :ok | {:error, term()}

Deletes a message from the pinned messages. This does not delete the message itself.

For more informations see Discord Docs.

Link to this callback

delete_pinned_message(channel, message) View Source (since 0.2.0)
delete_pinned_message(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  message :: Crux.Rest.Util.message_id_resolvable()
) :: :ok | {:error, term()}

Deletes a message from the pinned messages. This does not delete the message itself.

For more informations see Discord Docs.

Link to this callback

delete_pinned_message!(message) View Source (optional) (since 0.2.0)
delete_pinned_message!(message :: Message.t()) :: :ok | no_return()

The same as delete_pinned_message/1, but raises an exception if it fails.

Link to this callback

delete_pinned_message!(channel, message) View Source (optional) (since 0.2.0)
delete_pinned_message!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  message :: Crux.Rest.Util.message_id_resolvable()
) :: :ok | no_return()

The same as delete_pinned_message/2, but raises an exception if it fails.

Link to this callback

delete_reaction(channel, message, emoji, user) View Source (since 0.2.0)

Deletes a user from a reaction.

The first argument is optional if a Crux.Structs.Message is provided.

For more informations see Discord Docs 2.

Link to this callback

delete_reaction!(channel, message, emoji, user) View Source (optional) (since 0.2.0)

The same as delete_reaction/4, but raises an exception if it fails.

Link to this callback

delete_webhook(user, token) View Source (since 0.2.0)
delete_webhook(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t() | nil
) :: :ok | {:error, term()}

Deletes a webhook

For more information see Discord Docs

Link to this callback

delete_webhook!(user, token) View Source (optional) (since 0.2.0)
delete_webhook!(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t() | nil
) :: :ok | no_return()

The same as delete_webhook/2, but raises an exception if it fails.

Link to this callback

edit_channel_permissions(channel, target, data) View Source (since 0.2.0)
edit_channel_permissions(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  target :: Crux.Rest.Util.overwrite_target_resolvable(),
  data :: Crux.Rest.edit_channel_permissions_data()
) :: :ok | {:error, :missing_target} | {:error, term()}

Edits or creates an overwrite for a user, or member.

If an id is provided for :target, :type must be specified in Crux.Rest.edit_channel_permissions_data/0.

For more informations see Discord Docs.

Link to this callback

edit_channel_permissions!(channel, target, data) View Source (optional) (since 0.2.0)

The same as edit_channel_permissions/3, but raises an exception if it fails.

Link to this callback

edit_message(target, args) View Source (since 0.2.0)
edit_message(target :: Message.t(), args :: Crux.Rest.message_edit_data()) ::
  {:ok, Message.t()} | {:error, term()}

Edits a message.

For more informations see Discord Docs.

Link to this callback

edit_message(channel_id, message_id, args) View Source (since 0.2.0)
edit_message(
  channel_id :: Crux.Rest.Util.channel_id_resolvable(),
  message_id :: Crux.Rest.Util.message_id_resolvable(),
  args :: Crux.Rest.message_edit_data()
) :: {:ok, Message.t()} | {:error, term()}

Edits a message.

For more informations see Discord Docs.

Link to this callback

edit_message!(target, args) View Source (optional) (since 0.2.0)
edit_message!(target :: Message.t(), args :: Crux.Rest.message_edit_data()) ::
  Message.t() | no_return()

The same as edit_message/2, but raises an exception if it fails.

Link to this callback

edit_message!(channel_id, message_id, args) View Source (optional) (since 0.2.0)
edit_message!(
  channel_id :: Crux.Rest.Util.channel_id_resolvable(),
  message_id :: Crux.Rest.Util.message_id_resolvable(),
  args :: Crux.Rest.message_edit_data()
) :: Message.t() | no_return()

The same as edit_message/3, but raises an exception if it fails.

Link to this callback

execute_github_webhook(webhook, event, wait, data) View Source (since 0.2.0)
execute_github_webhook(
  webhook :: Webhook.t(),
  event :: String.t(),
  wait :: boolean() | nil,
  data :: term()
) :: :ok | {:error, term()}

Executes a github webhook

Returns :ok by default. If wait parameter is set to true, it will either return :ok or an error tuple. Discord does not return the message object unlike the regular webhook endpoint.

The event parameter is passed into the "x-github-event" header. If this is not set to a valid event (e.g, "push", "issue"), discord will not send the webhook but still return 204 OK

For more information see Github Docs

Link to this callback

execute_github_webhook(user, token, event, wait, data) View Source (since 0.2.0)
execute_github_webhook(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t(),
  event :: String.t(),
  wait :: boolean() | nil,
  data :: term()
) :: :ok | {:error, term()}

Link to this callback

execute_github_webhook!(webhook, event, wait, data) View Source (optional) (since 0.2.0)
execute_github_webhook!(
  webhook :: Webhook.t(),
  event :: String.t(),
  wait :: boolean() | nil,
  data :: term()
) :: :ok | no_return()

The same as execute_github_webhook/4, but raises an exception if it fails.

Link to this callback

execute_github_webhook!(user, token, event, wait, data) View Source (optional) (since 0.2.0)
execute_github_webhook!(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t(),
  event :: String.t(),
  wait :: boolean() | nil,
  data :: term()
) :: :ok | no_return()

The same as execute_github_webhook/5, but raises an exception if it fails.

Link to this callback

execute_slack_webhook(webhook, wait, data) View Source (since 0.2.0)
execute_slack_webhook(
  webhook :: Webhook.t(),
  wait :: boolean() | nil,
  data :: term()
) :: :ok | {:error, term()}

Executes a slack webhook

Returns :ok by default. If wait parameter is set to true, it will either return :ok or an error tuple. Discord does not return the message object unlike the regular webhook endpoint.

For more information see Slack Docs

Link to this callback

execute_slack_webhook(user, token, wait, data) View Source (since 0.2.0)
execute_slack_webhook(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t(),
  wait :: boolean() | nil,
  data :: term()
) :: :ok | {:error, term()}

Link to this callback

execute_slack_webhook!(webhook, wait, data) View Source (optional) (since 0.2.0)
execute_slack_webhook!(
  webhook :: Webhook.t(),
  wait :: boolean() | nil,
  data :: term()
) :: :ok | no_return()

The same as execute_slack_webhook/3, but raises an exception if it fails.

Link to this callback

execute_slack_webhook!(user, token, wait, data) View Source (optional) (since 0.2.0)
execute_slack_webhook!(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t(),
  wait :: boolean() | nil,
  data :: term()
) :: :ok | no_return()

The same as execute_slack_webhook/4, but raises an exception if it fails.

Link to this callback

execute_webhook(webhook, wait, data) View Source (since 0.2.0)
execute_webhook(
  webhook :: Webhook.t(),
  wait :: boolean() | nil,
  data :: Crux.Rest.execute_webhook_options()
) :: :ok | {:ok, Message.t()} | {:error, term()}

Executes a webhook

Returns :ok by default. If wait parameter is set to true, returns a tuple returning the message object or error

For more information see Discord Docs

Link to this callback

execute_webhook(user, token, wait, data) View Source (since 0.2.0)
execute_webhook(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t(),
  wait :: boolean() | nil,
  data :: Crux.Rest.execute_webhook_options()
) :: :ok | {:ok, Message.t()} | {:error, term()}

Link to this callback

execute_webhook!(webhook, wait, data) View Source (optional) (since 0.2.0)
execute_webhook!(
  webhook :: Webhook.t(),
  wait :: boolean() | nil,
  data :: Crux.Rest.execute_webhook_options()
) :: :ok | no_return()

The same as execute_webhook/3, but raises an exception if it fails.

Link to this callback

execute_webhook!(user, token, wait, data) View Source (optional) (since 0.2.0)
execute_webhook!(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t(),
  wait :: boolean() | nil,
  data :: Crux.Rest.execute_webhook_options()
) :: :ok | no_return()

The same as execute_webhook/4, but raises an exception if it fails.

Link to this callback

gateway() View Source (since 0.2.0)
gateway() :: {:ok, term()} | {:error, term()}

Gets the gateway url from the api.

For more informations see Discord Docs.

Link to this callback

gateway!() View Source (optional) (since 0.2.0)
gateway!() :: term() | no_return()

The same as gateway/0, but raises an exception if it fails.

Link to this callback

gateway_bot() View Source (since 0.2.0)
gateway_bot() :: {:ok, term()} | {:error, term()}

Gets the gateway url along a recommended shards count from the api.

For more informations see Discord Docs.

Link to this callback

gateway_bot!() View Source (optional) (since 0.2.0)
gateway_bot!() :: term() | no_return()

The same as gateway_bot/0, but raises an exception if it fails.

Link to this callback

get_audit_logs(guild, options) View Source (since 0.2.0)
get_audit_logs(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  options :: Crux.Rest.audit_log_options() | nil
) :: {:ok, AuditLog.t()} | {:error, term()}

Gets the audit logs for a guild

Link to this callback

get_audit_logs!(guild, options) View Source (optional) (since 0.2.0)
get_audit_logs!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  options :: Crux.Rest.audit_log_options() | nil
) :: AuditLog.t() | no_return()

The same as get_audit_logs/2, but raises an exception if it fails.

Link to this callback

get_channel(channel) View Source (since 0.2.0)
get_channel(channel :: Crux.Rest.Util.resolve_channel_id()) ::
  {:ok, Channel.t()} | {:error, term()}

Gets a channel from the api.
This should NOT be necessary.

For more informations see Discord Docs

Link to this callback

get_channel!(channel) View Source (optional) (since 0.2.0)
get_channel!(channel :: Crux.Rest.Util.resolve_channel_id()) ::
  Channel.t() | no_return()

The same as get_channel/1, but raises an exception if it fails.

Link to this callback

get_channel_invites(channel) View Source (since 0.2.0)
get_channel_invites(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  {:ok, %{required(String.t()) => Invite.t()}} | {:error, term()}

Gets invites for the specified channel from the api.

For more informations see Discord Docs

Link to this callback

get_channel_invites!(channel) View Source (optional) (since 0.2.0)
get_channel_invites!(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  %{required(String.t()) => Invite.t()} | no_return()

The same as get_channel_invites/1, but raises an exception if it fails.

Link to this callback

get_current_user_guilds(data) View Source (since 0.2.0)
get_current_user_guilds(data :: Crux.Rest.get_current_user_guild_data()) ::
  {:ok, %{required(Crux.Rest.snowflake()) => Guild.t()}} | {:error, term()}

Gets a list of partial Crux.Structs.Guilds the current user is a member of.

For more informations see Discord Docs.

Link to this callback

get_current_user_guilds!(data) View Source (optional) (since 0.2.0)
get_current_user_guilds!(data :: Crux.Rest.get_current_user_guild_data()) ::
  %{required(Crux.Rest.snowflake()) => Guild.t()} | no_return()

The same as get_current_user_guilds/1, but raises an exception if it fails.

Link to this callback

get_guild(guild) View Source (since 0.2.0)
get_guild(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, Guild.t()} | {:error, term()}

Gets a guild from the api.
This should usually, due to cache, NOT be necessary.

For more informations see Discord Docs

Link to this callback

get_guild!(guild) View Source (optional) (since 0.2.0)
get_guild!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  Guild.t() | no_return()

The same as get_guild/1, but raises an exception if it fails.

Link to this callback

get_guild_ban(guild, user) View Source (since 0.2.0)
get_guild_ban(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable()
) :: {:ok, %{user: User.t(), reason: String.t() | nil}} | {:error, term()}

Gets a single ban entry by id.

Returns {:error, %Crux.Rest.ApiError{status_code: 404, code: 10026, ...}} when the user is not banned.

For more informations see Discord Docs.

Link to this callback

get_guild_ban!(guild, user) View Source (optional) (since 0.2.0)
get_guild_ban!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable()
) :: %{user: User.t(), reason: String.t() | nil} | no_return()

The same as get_guild_ban/2, but raises an exception if it fails.

Link to this callback

get_guild_bans(guild) View Source (since 0.2.0)
get_guild_bans(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok,
   %{
     optional(Crux.Rest.snowflake()) => %{
       user: User.t(),
       reason: String.t() | nil
     }
   }}
  | {:error, term()}

Gets a map of banned users along their ban reasons.

For more informations see discord Docs.

Link to this callback

get_guild_bans!(guild) View Source (optional) (since 0.2.0)
get_guild_bans!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  %{
    optional(Crux.Rest.snowflake()) => %{
      user: User.t(),
      reason: String.t() | nil
    }
  }
  | no_return()

The same as get_guild_bans/1, but raises an exception if it fails.

Link to this callback

get_guild_channels(guild) View Source (since 0.2.0)
get_guild_channels(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, %{required(Crux.Rest.snowflake()) => Channel.t()}} | {:error, term()}

Gets all channels from a guild via the api.
This should usually, due to caching, NOT be necessary.

For more informations see Discord Docs-

Link to this callback

get_guild_channels!(guild) View Source (optional) (since 0.2.0)
get_guild_channels!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  %{required(Crux.Rest.snowflake()) => Channel.t()} | no_return()

The same as get_guild_channels/1, but raises an exception if it fails.

Link to this callback

get_guild_embed(guild) View Source (since 0.2.0)
get_guild_embed(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, term()} | {:error, term()}

Gets a guild's embed (server widget).

Returns a Guild Embed Object.

For more informations see Discord Docs.

Link to this callback

get_guild_embed!(guild) View Source (optional) (since 0.2.0)
get_guild_embed!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  term() | no_return()

The same as get_guild_embed/1, but raises an exception if it fails.

Link to this callback

get_guild_emoji(guild, emoji) View Source (since 0.2.0)
get_guild_emoji(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_id_resolvable()
) :: {:ok, Emoji} | {:error, term()}

Gets an emoji from a guild
This should usually, due to cache, NOT be necessary.

For more informations see Discord Docs.

Link to this callback

get_guild_emoji!(guild, emoji) View Source (optional) (since 0.2.0)
get_guild_emoji!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_id_resolvable()
) :: Emoji | no_return()

The same as get_guild_emoji/2, but raises an exception if it fails.

Link to this callback

get_guild_integrations(guild) View Source (since 0.2.0)
get_guild_integrations(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, list()} | {:error, term()}

Gets a list of guild integrations.

Returns a list of Integration Objects.

For more informations see Discord Docs.

Link to this callback

get_guild_integrations!(guild) View Source (optional) (since 0.2.0)
get_guild_integrations!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  list() | no_return()

The same as get_guild_integrations/1, but raises an exception if it fails.

Link to this callback

get_guild_invites(guild) View Source (since 0.2.0)
get_guild_invites(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, %{optional(String.t()) => Invite.t()}} | {:error, term()}

Gets all available invites in a guild.

For more informations see Discord Docs.

Link to this callback

get_guild_invites!(guild) View Source (optional) (since 0.2.0)
get_guild_invites!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  %{optional(String.t()) => Invite.t()} | no_return()

The same as get_guild_invites/1, but raises an exception if it fails.

Link to this callback

get_guild_member(guild, user) View Source (since 0.2.0)
get_guild_member(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable()
) :: {:ok, Member.t()} | {:error, term()}

Gets a member from the api.

This may be necessary for offline members in large guilds.

For more informations see Discord Docs.

Link to this callback

get_guild_member!(guild, user) View Source (optional) (since 0.2.0)
get_guild_member!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable()
) :: Member.t() | no_return()

The same as get_guild_member/2, but raises an exception if it fails.

Link to this callback

get_guild_prune_count(guild, days) View Source (since 0.2.0)
get_guild_prune_count(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  days :: pos_integer()
) :: {:ok, non_neg_integer()} | {:error, term()}

Gets the number of members in a guild that would be removed when pruned.

For more informations see Discord Docs.

Link to this callback

get_guild_prune_count!(guild, days) View Source (optional) (since 0.2.0)
get_guild_prune_count!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  days :: pos_integer()
) :: non_neg_integer() | no_return()

The same as get_guild_prune_count/2, but raises an exception if it fails.

Link to this callback

get_guild_roles(guild) View Source (since 0.2.0)
get_guild_roles(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, %{optional(Crux.Rest.snowflake()) => Role.t()}} | {:error, term()}

Gets a list of roles in a guild.
This should usually, due to caching, NOT be necessary.

For more informations see Discord Docs.

Link to this callback

get_guild_roles!(guild) View Source (optional) (since 0.2.0)
get_guild_roles!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  %{optional(Crux.Rest.snowflake()) => Role.t()} | no_return()

The same as get_guild_roles/1, but raises an exception if it fails.

Link to this callback

get_guild_vanity_url(guild) View Source (since 0.2.0)
get_guild_vanity_url(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, String.t()} | {:error, term()}

Gets the vanity url of a guild, if any

Link to this callback

get_guild_vanity_url!(guild) View Source (optional) (since 0.2.0)
get_guild_vanity_url!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  String.t() | no_return()

The same as get_guild_vanity_url/1, but raises an exception if it fails.

Link to this callback

get_guild_voice_regions(guild) View Source (since 0.2.0)
get_guild_voice_regions(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, term()} | {:error, term()}

Gets a list of voice regions for a guild. Returns VIP servers when the guild is VIP-enabled.

Returns a list of Voice Region Objects.

For more informations see Discord Docs.

Link to this callback

get_guild_voice_regions!(guild) View Source (optional) (since 0.2.0)
get_guild_voice_regions!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  term() | no_return()

The same as get_guild_voice_regions/1, but raises an exception if it fails.

Link to this callback

get_invite(code) View Source (since 0.2.0)
get_invite(code :: String.t()) :: {:ok, Invite.t()} | {:error, term()}

Gets an invite from the api.

For more informations see Discord Docs.

Link to this callback

get_invite!(code) View Source (optional) (since 0.2.0)
get_invite!(code :: String.t()) :: Invite.t() | no_return()

The same as get_invite/1, but raises an exception if it fails.

Link to this callback

get_message(channel, message_id) View Source (since 0.2.0)
get_message(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  message_id :: Crux.Rest.Util.message_id_resolvable()
) :: {:ok, Message} | {:error, term()}

Gets a message from the api.

For more informations see Discord Docs.

Link to this callback

get_message!(channel, message_id) View Source (optional) (since 0.2.0)
get_message!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  message_id :: Crux.Rest.Util.message_id_resolvable()
) :: Message | no_return()

The same as get_message/2, but raises an exception if it fails.

Link to this callback

get_messages(channel, args) View Source (since 0.2.0)
get_messages(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  args :: Crux.Rest.get_messages_data()
) :: {:ok, %{required(Crux.Rest.snowflake()) => Message.t()}} | {:error, term()}

Gets 1-100 messages from the api, this limit is enforced on discord's end.

For more informations see Discord Docs.

Link to this callback

get_messages!(channel, args) View Source (optional) (since 0.2.0)
get_messages!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  args :: Crux.Rest.get_messages_data()
) :: %{required(Crux.Rest.snowflake()) => Message.t()} | no_return()

The same as get_messages/2, but raises an exception if it fails.

Link to this callback

get_pinned_messages(channel) View Source (since 0.2.0)
get_pinned_messages(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  {:ok, %{required(Crux.Rest.snowflake()) => Message.t()}} | {:error, term()}

Gets a list of pinned messages from the api.

For more informations see Discord Docs.

Link to this callback

get_pinned_messages!(channel) View Source (optional) (since 0.2.0)
get_pinned_messages!(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  %{required(Crux.Rest.snowflake()) => Message.t()} | no_return()

The same as get_pinned_messages/1, but raises an exception if it fails.

Link to this callback

get_reactions(message, emoji, args) View Source (since 0.2.0)
get_reactions(
  message :: Message.t(),
  emoji :: Crux.Rest.Util.emoji_identifier_resolvable(),
  args :: Crux.Rest.get_reactions_data()
) :: {:ok, %{required(Crux.Rest.snowflake()) => User.t()}} | {:error, term()}

Link to this callback

get_reactions(channel, message, emoji, args) View Source (since 0.2.0)
get_reactions(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  message :: Crux.Rest.Util.message_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_identifier_resolvable(),
  args :: Crux.Rest.get_reactions_data()
) :: {:ok, %{required(Crux.Rest.snowflake()) => User.t()}} | {:error, term()}

Gets users who reacted to a message.

The first argument is optional if a Crux.Structs.Message is provided.

For more informations see Discord Docs.

Link to this callback

get_reactions!(message, emoji, args) View Source (optional) (since 0.2.0)
get_reactions!(
  message :: Message.t(),
  emoji :: Crux.Rest.Util.emoji_identifier_resolvable(),
  args :: Crux.Rest.get_reactions_data()
) :: %{required(Crux.Rest.snowflake()) => User.t()} | no_return()

The same as get_reactions/3, but raises an exception if it fails.

Link to this callback

get_reactions!(channel, message, emoji, args) View Source (optional) (since 0.2.0)

The same as get_reactions/4, but raises an exception if it fails.

Link to this callback

get_user(user) View Source (since 0.2.0)
get_user(user :: Crux.Rest.Util.user_id_resolvable() | String.t()) ::
  {:ok, User.t()} | {:error, term()}

Gets a user from the api.

For more informations see Discord Docs.

Link to this callback

get_user!(user) View Source (optional) (since 0.2.0)
get_user!(user :: Crux.Rest.Util.user_id_resolvable() | String.t()) ::
  User.t() | no_return()

The same as get_user/1, but raises an exception if it fails.

Link to this callback

get_webhook(user, token) View Source (since 0.2.0)
get_webhook(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t() | nil
) :: {:ok, Webhook.t()} | {:error, term()}

Gets a webhook

For more information see Discord Docs

Link to this callback

get_webhook!(user, token) View Source (optional) (since 0.2.0)
get_webhook!(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t() | nil
) :: Webhook.t() | no_return()

The same as get_webhook/2, but raises an exception if it fails.

Link to this callback

leave_guild(guild) View Source (since 0.2.0)
leave_guild(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  :ok | {:error, term()}

Leaves a guild.

For more informations see Discord Docs.

Link to this callback

leave_guild!(guild) View Source (optional) (since 0.2.0)
leave_guild!(guild :: Crux.Rest.Util.guild_id_resolvable()) :: :ok | no_return()

The same as leave_guild/1, but raises an exception if it fails.

Link to this callback

list_channel_webhooks(channel) View Source (since 0.2.0)
list_channel_webhooks(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  {:ok, %{required(Crux.Rest.snowflake()) => Webhook.t()}} | {:error, term()}

Gets a channel's webhook list

For more information see Discord Docs

Link to this callback

list_channel_webhooks!(channel) View Source (optional) (since 0.2.0)
list_channel_webhooks!(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  %{required(Crux.Rest.snowflake()) => Webhook.t()} | no_return()

The same as list_channel_webhooks/1, but raises an exception if it fails.

Link to this callback

list_guild_emojis(guild) View Source (since 0.2.0)
list_guild_emojis(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, %{required(Crux.Rest.snowflake()) => Emoji.t()}} | {:error, term()}

Gets a list of emojis in a guild.
This should usually, due to cache, NOT be necessary.

For more informations see Discord Docs.

Link to this callback

list_guild_emojis!(guild) View Source (optional) (since 0.2.0)
list_guild_emojis!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  %{required(Crux.Rest.snowflake()) => Emoji.t()} | no_return()

The same as list_guild_emojis/1, but raises an exception if it fails.

Link to this callback

list_guild_members(guild, options) View Source (since 0.2.0)
list_guild_members(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  options :: Crux.Rest.list_guild_members_options()
) :: {:ok, %{required(Crux.Rest.snowflake()) => Member.t()}} | {:error, term()}

Gets a list of members from the guild.

For more informations see Discord Docs.

Link to this callback

list_guild_members!(guild, options) View Source (optional) (since 0.2.0)
list_guild_members!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  options :: Crux.Rest.list_guild_members_options()
) :: %{required(Crux.Rest.snowflake()) => Member.t()} | no_return()

The same as list_guild_members/2, but raises an exception if it fails.

Link to this callback

list_guild_webhooks(guild) View Source (since 0.2.0)
list_guild_webhooks(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, %{required(Crux.Rest.snowflake()) => Webhook.t()}} | {:error, term()}

Gets a guild's webhook list

For more information see Discord Docs

Link to this callback

list_guild_webhooks!(guild) View Source (optional) (since 0.2.0)
list_guild_webhooks!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  %{required(Crux.Rest.snowflake()) => Webhook.t()} | no_return()

The same as list_guild_webhooks/1, but raises an exception if it fails.

Link to this callback

modify_channel(channel, data) View Source (since 0.2.0)
modify_channel(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  data :: Crux.Rest.modify_channel_data()
) :: {:ok, Channel.t()} | {:error, term()}

Modifies a channel, see Crux.Rest.modify_channel_data/0 for available options.

For more informations see Discord Docs.

Link to this callback

modify_channel!(channel, data) View Source (optional) (since 0.2.0)
modify_channel!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  data :: Crux.Rest.modify_channel_data()
) :: Channel.t() | no_return()

The same as modify_channel/2, but raises an exception if it fails.

Link to this callback

modify_current_user(data) View Source (since 0.2.0)
modify_current_user(data :: Crux.Rest.modify_current_user_data()) ::
  {:ok, User.t()} | {:error, term()}

Modifes the currently logged in user.

For more informations see Discord Docs.

Link to this callback

modify_current_user!(data) View Source (optional) (since 0.2.0)
modify_current_user!(data :: Crux.Rest.modify_current_user_data()) ::
  User.t() | no_return()

The same as modify_current_user/1, but raises an exception if it fails.

Link to this callback

modify_current_users_nick(guild, nick, reason) View Source (since 0.2.0)
modify_current_users_nick(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  nick :: String.t(),
  reason :: String.t()
) :: :ok | {:error, term()}

Modifies the nickname of the current user in a guild.

Yes, you read correctly, that has its own endpoint.
Great, isn't it?

For more informations, but not an answer to the question why, see Discord Docs.

Link to this callback

modify_current_users_nick!(guild, nick, reason) View Source (optional) (since 0.2.0)
modify_current_users_nick!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  nick :: String.t(),
  reason :: String.t()
) :: :ok | no_return()

The same as modify_current_users_nick/3, but raises an exception if it fails.

Link to this callback

modify_guild(guild, data) View Source (since 0.2.0)
modify_guild(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: Crux.Rest.modify_guild_data()
) :: {:ok, Guild.t()} | {:error, term()}

Updates a guild, see Crux.Rest.modify_guild_data/0 for available options.

For more informations see Discord Docs.

Link to this callback

modify_guild!(guild, data) View Source (optional) (since 0.2.0)
modify_guild!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: Crux.Rest.modify_guild_data()
) :: Guild.t() | no_return()

The same as modify_guild/2, but raises an exception if it fails.

Link to this callback

modify_guild_channel_positions(guild, channels) View Source (since 0.2.0)
modify_guild_channel_positions(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  channels :: [Crux.Rest.modify_guild_channel_positions_data_entry()]
) :: :ok | {:error, term()}

Modifyies the position of a list of channels in a guild.

For more informations see Discord Docs.

Link to this callback

modify_guild_channel_positions!(guild, channels) View Source (optional) (since 0.2.0)
modify_guild_channel_positions!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  channels :: [Crux.Rest.modify_guild_channel_positions_data_entry()]
) :: :ok | no_return()

The same as modify_guild_channel_positions/2, but raises an exception if it fails.

Link to this callback

modify_guild_embed(guild, data) View Source (since 0.2.0)
modify_guild_embed(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data ::
    %{
      optional(:enabled) => boolean(),
      optional(:channel_id) => Crux.Rest.snowflake()
    }
    | [enabled: boolean(), channel_id: Crux.Rest.snowflake()]
) :: {:ok, term()} | {:error, term()}

Modifies a guild's embed (server widget).

Returns the updated Guild Embed Object.

For more informations see Discord Docs.

Link to this callback

modify_guild_embed!(guild, data) View Source (optional) (since 0.2.0)
modify_guild_embed!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data ::
    %{
      optional(:enabled) => boolean(),
      optional(:channel_id) => Crux.Rest.snowflake()
    }
    | [enabled: boolean(), channel_id: Crux.Rest.snowflake()]
) :: term() | no_return()

The same as modify_guild_embed/2, but raises an exception if it fails.

Link to this callback

modify_guild_emoji(guild, emoji, data) View Source (since 0.2.0)
modify_guild_emoji(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_id_resolvable(),
  data :: Crux.Rest.modify_guild_emoji_data()
) :: {:ok, Emoji} | {:error, term()}

Modifies a guild emoji.

For more informations see Discord Docs.

Link to this callback

modify_guild_emoji!(guild, emoji, data) View Source (optional) (since 0.2.0)
modify_guild_emoji!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_id_resolvable(),
  data :: Crux.Rest.modify_guild_emoji_data()
) :: Emoji | no_return()

The same as modify_guild_emoji/3, but raises an exception if it fails.

Link to this callback

modify_guild_integration(guild, integration_id, data) View Source (since 0.2.0)
modify_guild_integration(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: Crux.Rest.snowflake(),
  data ::
    %{
      optional(:expire_behavior) => integer(),
      optional(:expire_grace_period) => integer(),
      optional(:enable_emoticons) => boolean()
    }
    | [
        expire_behavior: integer(),
        expire_grace_period: integer(),
        enable_emoticons: boolean()
      ]
) :: :ok | {:error, term()}

Modifies an integreation for a guild.

For more informations see Discord Docs.

Link to this callback

modify_guild_integration!(guild, integration_id, data) View Source (optional) (since 0.2.0)
modify_guild_integration!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: Crux.Rest.snowflake(),
  data ::
    %{
      optional(:expire_behavior) => integer(),
      optional(:expire_grace_period) => integer(),
      optional(:enable_emoticons) => boolean()
    }
    | [
        expire_behavior: integer(),
        expire_grace_period: integer(),
        enable_emoticons: boolean()
      ]
) :: :ok | no_return()

The same as modify_guild_integration/3, but raises an exception if it fails.

Link to this callback

modify_guild_member(guild, member, data) View Source (since 0.2.0)
modify_guild_member(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  member :: Crux.Rest.Util.user_id_resolvable(),
  data :: Crux.Rest.modify_guild_member_data()
) :: :ok | {:error, term()}

Modifies a member in a guild.

For more informations see Discord Docs.

Link to this callback

modify_guild_member!(guild, member, data) View Source (optional) (since 0.2.0)
modify_guild_member!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  member :: Crux.Rest.Util.user_id_resolvable(),
  data :: Crux.Rest.modify_guild_member_data()
) :: :ok | no_return()

The same as modify_guild_member/3, but raises an exception if it fails.

Link to this callback

modify_guild_role(guild, role, data) View Source (since 0.2.0)
modify_guild_role(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  role :: Crux.Rest.Util.role_id_resolvable(),
  data :: Crux.Rest.guild_role_data()
) :: {:ok, Role.t()} | {:error, term()}

Modifies a role in a guild.

For more informations see Discord Docs.

Link to this callback

modify_guild_role!(guild, role, data) View Source (optional) (since 0.2.0)
modify_guild_role!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  role :: Crux.Rest.Util.role_id_resolvable(),
  data :: Crux.Rest.guild_role_data()
) :: Role.t() | no_return()

The same as modify_guild_role/3, but raises an exception if it fails.

Link to this callback

modify_guild_role_positions(guild, data) View Source (since 0.2.0)
modify_guild_role_positions(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: Crux.Rest.Util.modify_guild_role_positions_data()
) :: {:ok, %{optional(Crux.Rest.snowflake()) => Role.t()}} | {:error, term()}

Modifies the positions of a list of role objects for a guild.

For more informations see Discord Docs.

Link to this callback

modify_guild_role_positions!(guild, data) View Source (optional) (since 0.2.0)
modify_guild_role_positions!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: Crux.Rest.Util.modify_guild_role_positions_data()
) :: %{optional(Crux.Rest.snowflake()) => Role.t()} | no_return()

The same as modify_guild_role_positions/2, but raises an exception if it fails.

Link to this callback

remove_guild_ban(guild, user, reason) View Source (since 0.2.0)
remove_guild_ban(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable(),
  reason :: String.t()
) :: :ok | {:error, term()}

Removes a ban for a user from a guild.

For more informations see Discord Docs.

Link to this callback

remove_guild_ban!(guild, user, reason) View Source (optional) (since 0.2.0)
remove_guild_ban!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable(),
  reason :: String.t()
) :: :ok | no_return()

The same as remove_guild_ban/3, but raises an exception if it fails.

Link to this callback

remove_guild_member_role(guild, member, role, reason) View Source (since 0.2.0)
remove_guild_member_role(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  member :: Crux.Rest.Util.user_id_resolvable(),
  role :: Crux.Rest.Util.role_id_resolvable(),
  reason :: String.t()
) :: :ok | {:error, term()}

Removes a role from a member.

For more informations see Discord Docs.

Link to this callback

remove_guild_member_role!(guild, member, role, reason) View Source (optional) (since 0.2.0)
remove_guild_member_role!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  member :: Crux.Rest.Util.user_id_resolvable(),
  role :: Crux.Rest.Util.role_id_resolvable(),
  reason :: String.t()
) :: :ok | no_return()

The same as remove_guild_member_role/4, but raises an exception if it fails.

Link to this callback

sync_guild_integration(guild, integration_id) View Source (since 0.2.0)
sync_guild_integration(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: Crux.Rest.snowflake()
) :: :ok | {:error, term()}

Syncs an integration for a guild.

For more informations see Discord Docs.

Link to this callback

sync_guild_integration!(guild, integration_id) View Source (optional) (since 0.2.0)
sync_guild_integration!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: Crux.Rest.snowflake()
) :: :ok | no_return()

The same as sync_guild_integration/2, but raises an exception if it fails.

Link to this callback

trigger_typing(channel) View Source (since 0.2.0)
trigger_typing(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  :ok | {:error, term()}

Lets the bot appear as typing for roughly ~9 seconds or until a message is sent.
Should generally be used sparingly for commands that may take a while as a form of acknowledging.

Consider sending a message and edit that later on instead.

For more informations see Discord Docs.

Link to this callback

trigger_typing!(channel) View Source (optional) (since 0.2.0)
trigger_typing!(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  :ok | no_return()

The same as trigger_typing/1, but raises an exception if it fails.

Link to this callback

update_webhook(user, token, data) View Source (since 0.2.0)
update_webhook(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t() | nil,
  data ::
    %{
      optional(:name) => String.t(),
      optional(:avatar) => Crux.Rest.Util.image(),
      optional(:channel_id) => Crux.Rest.snowflake()
    }
    | [
        name: String.t(),
        avatar: Crux.Rest.Util.image(),
        channel_id: Crux.Rest.snowflake()
      ]
) :: {:ok, Webhook.t()} | {:error, term()}

Updates a webhook

For more information see Discord Docs

Link to this callback

update_webhook!(user, token, data) View Source (optional) (since 0.2.0)
update_webhook!(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t() | nil,
  data ::
    %{
      optional(:name) => String.t(),
      optional(:avatar) => Crux.Rest.Util.image(),
      optional(:channel_id) => Crux.Rest.snowflake()
    }
    | [
        name: String.t(),
        avatar: Crux.Rest.Util.image(),
        channel_id: Crux.Rest.snowflake()
      ]
) :: Webhook.t() | no_return()

The same as update_webhook/3, but raises an exception if it fails.