crux_rest v0.1.7 Crux.Rest View Source

Collection of Rest functions.

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 create a group dm with create_group_dm/1

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 attach files via create_message/2

Used to list the current user’s guilds in 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 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

A Discord snowflake, fits in a 64bit integer

Functions

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

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

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

Adds a message to the pinned messages of a channel

Adds a message to the pinned messages of a channel

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

Prunes members in a guild

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

Creates an invite to a channel, see t:create_channel_invite_data for available options

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

Creates a new dm channel with a user

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

Creates a group dm with multiple users

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

The same as create_guild_ban/3, 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_channel/2, but raises an exception if it fails

Creates a channel in a guild, see t:create_guild_channel_data for available options

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

Creates an emoji in a guild, see t:create_guild_emoji_data for available options

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

Attaches an integration from the current user to a guild

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

Sends a message to a channel

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

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_role/2, but raises an exception if it fails

Creates a role in a guild

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

Deletes all reactions from a messaage

Deletes all reactions from a messaage

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

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

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

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

Deletes an emoji from a guild

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

Deletes an integration from a guild

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

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

Deletes an invite

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 a message

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

Deletes 2-100 messages not older than 14 days

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 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_webhook/2, but raises an exception if it fails

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

Edits or creates an overwrite for a user, or member

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

Edits a message

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

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

Executes a slack webhook

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

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

Executes a webhook

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

Fetches the gateway url from the api

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

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

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

Gets the audit logs for a guild

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

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

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

Gets invites for the specified channel from the api

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

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

The same as get_guild/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_ban/2, but raises an exception if it fails

Fetches a single ban entry by id

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

Fetches a map of banned users along their ban reasons

The same as get_guild_channels/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_embed/1, but raises an exception if it fails

Fetches a guild’s embed (server widget)

The same as get_guild_emoji/2, 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_integrations/1, but raises an exception if it fails

Fetches a list of guild integrations

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

Fetches all available invites in a guild

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

Fetches a member from the api

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

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

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

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

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

Fetches the vanity url of a guild, if any

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

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

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

Fetches an invite from the api

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

Gets a message from the api

The same as get_messages/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_pinned_messages/1, but raises an exception if it fails

Gets a list of pinned messages from the api

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

Fetches a user from the api

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

Fetches a list of Crux.Structs.Channel. (DMChannels in this case)

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

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

Leaves a guild

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

Fetches a channel’s webhook list

The same as list_guild_emojis/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_members/2, but raises an exception if it fails

Gets a list of members from the guild

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

Fetches a guild’s webhook list

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

Modifies a channel, see t:modify_channel_data for available options

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

Modifes the currently logged in user

Modifies the nickname of the current user in a guild

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

Updates a guild, see t:modify_guild_data for available options

Modifyies the position of a list of channels in a guild

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

Modifies a guild’s embed (server widget)

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

Modifies an integreation for a guild

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

Modifies a member in a guild

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

Modifies a role in a guild

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

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

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

Removes a ban for a user from a guild

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

Syncs an integration for a guild

The same as trigger_typing/1, 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 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) => [snowflake()],
    optional(:mute) => boolean(),
    optional(:deaf) => boolean(),
    optional(:reason) => String.t()
  }
  | [
      access_token: String.t(),
      nick: String.t() | nil,
      roles: [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) => snowflake(),
    optional(:action_type) => pos_integer(),
    optional(:before) => snowflake(),
    optional(:limit) => pos_integer()
  }
  | [
      user_id: snowflake(),
      action_type: pos_integer(),
      before: 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 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_group_dm_data() View Source (since 0.1.4)
create_group_dm_data() ::
  %{
    :access_tokens => [String.t()],
    optional(:nicks) => %{
      required(Crux.Rest.Util.user_id_resolvable()) => String.t()
    }
  }
  | [access_tokens: String.t(), nicks: %{}]

Used to create a group dm with create_group_dm/1.

  • :access_tokens are meant to be obtained on your own via oauth2, they have to have the gdm.join scope.
  • :nicks is a map of ids and their respective nicknames to give a user.
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 => snowflake(),
          :type => String.t(),
          optional(:allow) => non_neg_integer(),
          optional(:deny) => non_neg_integer()
        }
    ],
    optional(:parent_id) => 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 => snowflake(),
            :type => String.t(),
            optional(:allow) => non_neg_integer(),
            optional(:deny) => non_neg_integer()
          }
      ],
      parent_id: 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 => String.t() | binary(),
    optional(:roles) => [Crux.Structs.Role.t() | snowflake()],
    optional(:reason) => String.t()
  }
  | [
      name: String.t(),
      image: String.t() | binary(),
      roles: [Crux.Structs.Role.t() | 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) => [file_list_entry()]
  }
  | [
      content: String.t(),
      nonce: non_neg_integer(),
      tts: boolean(),
      embed: embed(),
      files: [file_list_entry()]
    ]

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(:file) => file_list_entry(),
  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 file_list_entry() View Source (since 0.1.0)
file_list_entry() :: String.t() | {String.t(), String.t()}

Used to attach files via create_message/2.

This can be one of:

Example
path/home/user/image.png / https://example.com/image.png
{path, name}{one of the above, "other_name.png"}
{binary, name}{<<0, 0, 0, 0>>, "other_name.png"}
Link to this type get_current_user_guild_data() View Source (since 0.1.4)
get_current_user_guild_data() :: %{
  optional(:before) => snowflake(),
  optional(:after) => snowflake(),
  optional(:limit) => pos_integer()
}

Used to list the current user’s guilds in get_current_user_guild_/1.

Link to this type get_messages_data() View Source (since 0.1.0)
get_messages_data() ::
  %{
    optional(:around) => snowflake(),
    optional(:before) => snowflake(),
    optional(:after) => snowflake(),
    optional(:limit) => pos_integer()
  }
  | [
      around: snowflake(),
      before: snowflake(),
      after: 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) => snowflake(),
    optional(:after) => snowflake(),
    optional(:limit) => pos_integer()
  }
  | [before: snowflake(), after: 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) => snowflake()}
  | [limit: pos_integer(), after: snowflake()]

Used to list guild members via 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) => String.t() | binary() | nil,
    optional(:name) => String.t() | nil,
    optional(:nsfw) => boolean(),
    optional(:parent_id) => 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: String.t() | binary() | nil,
      name: String.t() | nil,
      nsfw: boolean(),
      parent_id: 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) => String.t() | binary() | nil
  }
  | [username: String.t(), avatar: String.t() | binary() | nil]

Used to modify the currently logged in modify_current_user/1.

  • :avatar is similarly to u:file_list_entry/0 except you obviously can’t “rename” the avatar.
Link to this type modify_guild_channel_positions_data_entry() View Source (since 0.1.0)
modify_guild_channel_positions_data_entry() ::
  {Crux.Structs.Channel.t(), integer()}
  | {snowflake(), integer()}
  | %{channel: Crux.Structs.Channel.t(), position: integer()}
  | %{id: 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) => snowflake() | nil,
    optional(:afk_timeout) => non_neg_integer(),
    optional(:icon) => String.t() | binary() | nil,
    optional(:splash) => String.t() | binary() | nil,
    optional(:owner_id) => snowflake(),
    optional(:system_channel_id) => 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: snowflake() | nil,
      afk_timeout: non_neg_integer(),
      icon: String.t() | binary() | nil,
      splash: String.t() | binary() | nil,
      owner_id: snowflake(),
      system_channel_id: 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) => [Crux.Structs.Role.t() | snowflake()],
    optional(:reason) => String.t()
  } :: [
    name: String.t(),
    roles: [Crux.Structs.Role.t() | snowflake()],
    reason: String.t()
  ]

Used to modify a guild emoji via modify_guild_emoji/3.

See t:create_guild_emoji_data 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) => [snowflake()],
    optional(:mute) => boolean(),
    optional(:deaf) => boolean(),
    optional(:channel_id) => snowflake(),
    optional(:reason) => String.t()
  }
  | [
      nick: String.t() | nil,
      roles: [snowflake()],
      mute: boolean(),
      deaf: boolean(),
      channel_id: 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 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 add_guild_member!(guild, user, data) View Source (since 0.1.0)

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

Link to this function add_guild_member(guild, user, data) View Source (since 0.1.0)
add_guild_member(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable(),
  data :: add_guild_member_data()
) :: {:ok, Crux.Structs.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 function add_guild_member_role!(guild, member, role, reason \\ nil) View Source (since 0.1.1)
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 function add_guild_member_role(guild, member, role, reason \\ nil) View Source (since 0.1.1)
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 function add_pinned_message!(message) View Source (since 0.1.0)
add_pinned_message!(message :: Crux.Structs.Message.t()) :: :ok | no_return()

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

Link to this function add_pinned_message!(channel, message) View Source (since 0.1.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 function add_pinned_message(message) View Source (since 0.1.0)
add_pinned_message(message :: Crux.Structs.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 function add_pinned_message(channel, message) View Source (since 0.1.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 function begin_guild_prune!(guild, days) View Source (since 0.1.2)
begin_guild_prune!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  days :: pos_integer()
) :: non_neg_integer() | no_return()

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

Link to this function begin_guild_prune(guild, days) View Source (since 0.1.2)
begin_guild_prune(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  days :: pos_integer()
) :: {:ok, non_neg_integer()} | {:error, term()}

Prunes members in a guild.

For more informations see Discord Docs.

Link to this function create_channel_invite!(channel, args) View Source (since 0.1.0)
create_channel_invite!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  args :: create_channel_invite_data()
) :: Crux.Structs.Invite.t() | no_return()

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

Link to this function create_channel_invite(channel, args) View Source (since 0.1.0)
create_channel_invite(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  args :: create_channel_invite_data()
) :: {:ok, Crux.Structs.Invite.t()} | {:error, term()}

Creates an invite to a channel, see t:create_channel_invite_data for available options.

For more informations see Discord Docs.

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

Link to this function create_dm(user) View Source (since 0.1.4)
create_dm(user :: Crux.Rest.Util.user_id_resolvable()) ::
  {:ok, Crux.Structs.Channel.t()} | {:error, term()}

Creates a new dm channel with a user.

For more informations see Discord Docs.

Link to this function create_group_dm!(data) View Source (since 0.1.4)
create_group_dm!(data :: create_group_dm_data()) ::
  Crux.Structs.Channel.t() | no_return()

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

Link to this function create_group_dm(data) View Source (since 0.1.4)
create_group_dm(data :: create_group_dm_data()) ::
  {:ok, Crux.Structs.Channel.t()} | {:error, term()}

Creates a group dm with multiple users.

For more informations see Discord Docs.

Link to this function create_guild!(data) View Source (since 0.1.0)

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

Link to this function create_guild(data) View Source (since 0.1.0)
Link to this function create_guild_ban!(guild, user, reason \\ nil) View Source (since 0.1.2)
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 function create_guild_ban(guild, user, reason \\ nil) View Source (since 0.1.2)
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 function create_guild_channel!(guild, data) View Source (since 0.1.0)
create_guild_channel!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: create_guild_channel_data()
) :: Crux.Structs.Channel.t() | no_return()

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

Link to this function create_guild_channel(guild, data) View Source (since 0.1.0)
create_guild_channel(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: create_guild_channel_data()
) :: {:ok, Crux.Structs.Channel.t()} | {:error, term()}

Creates a channel in a guild, see t:create_guild_channel_data for available options.

For more informations see Discord Docs.

Link to this function create_guild_emoji!(guild, data) View Source (since 0.1.0)
create_guild_emoji!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: create_guild_emoji_data()
) :: Crux.Structs.Emoji | no_return()

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

Link to this function create_guild_emoji(guild, data) View Source (since 0.1.0)
create_guild_emoji(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: create_guild_emoji_data()
) :: {:ok, Crux.Structs.Emoji} | {:error, term()}

Creates an emoji in a guild, see t:create_guild_emoji_data for available options.

For more informations see Discord Docs.

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

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

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

Attaches an integration from the current user to a guild.

For more informations see Discord Docs.

Link to this function create_message!(channel_or_message, args) View Source (since 0.1.0)

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

Link to this function create_message(channel_or_message, args) View Source (since 0.1.0)
create_message(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  args :: create_message_data()
) :: {:ok, Crux.Structs.Message.t()} | {:error, term()}

Sends a message to a channel.

For more informations see Discord Docs

Link to this function create_reaction!(message, emoji) View Source (since 0.1.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 function create_reaction!(channel, message, emoji) View Source (since 0.1.0)

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

Link to this function create_reaction(message, emoji) View Source (since 0.1.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 function create_reaction(channel, message, emoji) View Source (since 0.1.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 function create_role!(guild, data) View Source (since 0.1.2)
create_role!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: guild_role_data()
) :: Crux.Structs.Role.t() | no_return()

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

Link to this function create_role(guild, data) View Source (since 0.1.2)
create_role(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: guild_role_data()
) :: {:ok, Crux.Structs.Role.t()} | {:error, term()}

Creates a role in a guild.

For more informations see Discord Docs.

Link to this function delete_all_reactions!(message, emoji) View Source (since 0.1.0)
delete_all_reactions!(
  message :: Crux.Structs.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 function delete_all_reactions!(channel, message, emoji) View Source (since 0.1.0)

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

Link to this function delete_all_reactions(message, emoji) View Source (since 0.1.0)
delete_all_reactions(
  message :: Crux.Structs.Message.t(),
  emoji :: Crux.Rest.Util.emoji_identifier_resolvable()
) :: :ok | {:error, term()}

Deletes all reactions from a messaage.

For more informations see Discord Docs.

Link to this function delete_all_reactions(channel, message, emoji) View Source (since 0.1.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 messaage.

For more informations see Discord Docs.

Link to this function delete_channel!(channel, reason \\ nil) View Source (since 0.1.0)
delete_channel!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  reason :: String.t()
) :: Crux.Structs.Channel.t() | no_return()

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

Link to this function delete_channel(channel, reason \\ nil) View Source (since 0.1.0)
delete_channel(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  reason :: String.t()
) :: {:ok, Crux.Structs.Channel.t()} | {:error, term()}

Deletes a channel.

For more informations see Discord Docs.

Link to this function delete_channel_permissions!(channel, target, reason \\ nil) View Source (since 0.1.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 function delete_channel_permissions(channel, target, reason \\ nil) View Source (since 0.1.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 function delete_guild!(guild) View Source (since 0.1.1)
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 function delete_guild(guild) View Source (since 0.1.1)
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 function delete_guild_emoji!(guild, emoji, reason \\ nil) View Source (since 0.1.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 function delete_guild_emoji(guild, emoji, reason \\ nil) View Source (since 0.1.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 function delete_guild_integration!(guild, integration_id) View Source (since 0.1.2)
delete_guild_integration!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: snowflake()
) :: :ok | no_return()

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

Link to this function delete_guild_integration(guild, integration_id) View Source (since 0.1.2)
delete_guild_integration(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: snowflake()
) :: :ok | {:error, term()}

Deletes an integration from a guild.

For more informations see Discord Docs.

Link to this function delete_guild_role!(guild, role, reason \\ nil) View Source (since 0.1.2)
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 function delete_guild_role(guild, role, reason \\ nil) View Source (since 0.1.2)
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 function delete_invite!(code) View Source (since 0.1.0)
delete_invite!(invite_or_code :: String.t() | Crux.Structs.Invite.t()) ::
  Crux.Structs.Invite.t() | no_return()

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

Link to this function delete_invite(code) View Source (since 0.1.0)
delete_invite(invite_or_code :: String.t() | Crux.Structs.Invite.t()) ::
  {:ok, Crux.Structs.Invite.t()} | {:error, term()}

Deletes an invite.

For more informations see Discord Docs.

Link to this function delete_message!(message) View Source (since 0.1.0)
delete_message!(message :: Crux.Structs.Message.t()) ::
  Crux.Structs.Message.t() | no_return()

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

Link to this function delete_message!(channel, message) View Source (since 0.1.0)
delete_message!(
  channel_id :: Crux.Rest.Util.channel_id_resolvable(),
  message_id :: Crux.Rest.Util.message_id_resolvable()
) :: Crux.Structs.Message | no_return()

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

Link to this function delete_message(message) View Source (since 0.1.0)
delete_message(message :: Crux.Structs.Message.t()) ::
  {:ok, Crux.Structs.Message.t()} | {:error, term()}

Deletes a message

For more informations see Discord Docs.

Link to this function delete_message(channel, message) View Source (since 0.1.0)
delete_message(
  channel_id :: Crux.Rest.Util.channel_id_resolvable(),
  message_id :: Crux.Rest.Util.message_id_resolvable()
) :: {:ok, Crux.Structs.Message} | {:error, term()}

Deletes a message

For more informations see Discord Docs.

Link to this function delete_messages!(channel, messages) View Source (since 0.1.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 function delete_messages(channel, messages) View Source (since 0.1.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 function delete_pinned_message!(message) View Source (since 0.1.0)
delete_pinned_message!(message :: Crux.Structs.Message.t()) :: :ok | no_return()

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

Link to this function delete_pinned_message!(channel, message) View Source (since 0.1.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 function delete_pinned_message(message) View Source (since 0.1.0)
delete_pinned_message(message :: Crux.Structs.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 function delete_pinned_message(channel, message) View Source (since 0.1.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 function delete_reaction!(message_or_channel, emoji_or_message_id, emoji_or_maybe_user \\ "@me", mayber_user \\ "@me") View Source (since 0.1.0)

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

Link to this function delete_reaction(message_or_channel, emoji_or_message_id, emoji_or_maybe_user \\ "@me", mayber_user \\ "@me") View Source (since 0.1.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 function delete_webhook!(user, token \\ nil) View Source (since 0.1.7)
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 function delete_webhook(user, token \\ nil) View Source (since 0.1.7)
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 function edit_channel_permissions!(channel, target, data) View Source (since 0.1.0)
edit_channel_permissions!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  target :: Crux.Rest.Util.overwrite_target_resolvable(),
  data :: edit_channel_permissions_data()
) :: :ok | no_return()

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

Link to this function edit_channel_permissions(channel, target, data) View Source (since 0.1.0)
edit_channel_permissions(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  target :: Crux.Rest.Util.overwrite_target_resolvable(),
  data :: 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 t:edit_channel_permissions_data.

For more informations see Discord Docs.

Link to this function edit_message!(message, args) View Source (since 0.1.0)
edit_message!(target :: Crux.Structs.Message.t(), args :: message_edit_data()) ::
  Crux.Structs.Message.t() | no_return()

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

Link to this function edit_message!(channel, message_id, args) View Source (since 0.1.0)

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

Link to this function edit_message(message, args) View Source (since 0.1.0)
edit_message(target :: Crux.Structs.Message.t(), args :: message_edit_data()) ::
  {:ok, Crux.Structs.Message.t()} | {:error, term()}

Edits a message.

For more informations see Discord Docs.

Link to this function edit_message(channel, message_id, args) View Source (since 0.1.0)
edit_message(
  channel_id :: Crux.Rest.Util.channel_id_resolvable(),
  message_id :: Crux.Rest.Util.message_id_resolvable(),
  args :: message_edit_data()
) :: {:ok, Crux.Structs.Message.t()} | {:error, term()}

Edits a message.

For more informations see Discord Docs.

Link to this function execute_github_webhook!(webhook, event, data) View Source (since 0.1.7)

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

Link to this function execute_github_webhook!(user, token, event, wait \\ false, data) View Source (since 0.1.7)
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 function execute_github_webhook(webhook, event, data) View Source (since 0.1.7)

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 function execute_github_webhook(user, token, event, wait \\ false, data) View Source (since 0.1.7)
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 function execute_slack_webhook!(webhook, data) View Source (since 0.1.7)

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

Link to this function execute_slack_webhook!(user, token, wait \\ false, data) View Source (since 0.1.7)
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 function execute_slack_webhook(webhook, data) View Source (since 0.1.7)

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 function execute_slack_webhook(user, token, wait \\ false, data) View Source (since 0.1.7)
execute_slack_webhook(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t(),
  wait :: boolean() | nil,
  data :: term()
) :: :ok | {:error, term()}
Link to this function execute_webhook!(webhook, data) View Source (since 0.1.7)

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

Link to this function execute_webhook!(user, token, wait \\ false, data) View Source (since 0.1.7)
execute_webhook!(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t(),
  wait :: boolean() | nil,
  data :: execute_webhook_options()
) :: :ok | no_return()

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

Link to this function execute_webhook(webhook, data) View Source (since 0.1.7)

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 function execute_webhook(user, token, wait \\ false, data) View Source (since 0.1.7)
execute_webhook(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t(),
  wait :: boolean() | nil,
  data :: execute_webhook_options()
) :: :ok | {:ok, Crux.Structs.Message.t()} | {:error, term()}
Link to this function gateway!() View Source (since 0.1.0)
gateway!() :: term() | no_return()

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

Link to this function gateway() View Source (since 0.1.0)
gateway() :: {:ok, term()} | {:error, term()}

Fetches the gateway url from the api.

For more informations see Discord Docs.

Link to this function gateway_bot!() View Source (since 0.1.0)
gateway_bot!() :: term() | no_return()

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

Link to this function gateway_bot() View Source (since 0.1.0)
gateway_bot() :: {:ok, term()} | {:error, term()}

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

For more informations see Discord Docs.

Link to this function get_audit_logs!(guild, options \\ []) View Source (since 0.1.7)
get_audit_logs!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  options :: audit_log_options() | nil
) :: Crux.Structs.AuditLog.t() | no_return()

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

Link to this function get_audit_logs(guild, options \\ []) View Source (since 0.1.7)
get_audit_logs(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  options :: audit_log_options() | nil
) :: {:ok, Crux.Structs.AuditLog.t()} | {:error, term()}

Gets the audit logs for a guild

Link to this function get_channel!(channel) View Source (since 0.1.1)

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

Link to this function get_channel(channel) View Source (since 0.1.1)
get_channel(channel :: Crux.Rest.Util.resolve_channel_id()) ::
  {:ok, Crux.Structs.Channel.t()} | {:error, term()}

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

For more informations see Discord Docs

Link to this function get_channel_invites!(channel) View Source (since 0.1.1)
get_channel_invites!(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  [Crux.Structs.Invite.t()] | no_return()

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

Link to this function get_channel_invites(channel) View Source (since 0.1.1)
get_channel_invites(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  {:ok, [Crux.Structs.Invite.t()]} | {:error, term()}

Gets invites for the specified channel from the api.

For more informations see Discord Docs

Link to this function get_current_user_guilds!(data) View Source (since 0.1.4)
get_current_user_guilds!(data :: get_current_user_guild_data()) ::
  [Crux.Structs.Guild.t()] | no_return()

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

Link to this function get_current_user_guilds(data) View Source (since 0.1.4)
get_current_user_guilds(data :: get_current_user_guild_data()) ::
  {:ok, [Crux.Structs.Guild.t()]} | {:error, term()}

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

For more informations see Discord Docs.

Link to this function get_guild!(guild) View Source (since 0.1.1)

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

Link to this function get_guild(guild) View Source (since 0.1.1)
get_guild(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, Crux.Structs.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 function get_guild_ban!(guild, user) View Source (since 0.1.2)
get_guild_ban!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable()
) :: %{user: Crux.Structs.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 function get_guild_ban(guild, user) View Source (since 0.1.2)
get_guild_ban(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable()
) ::
  {:ok, %{user: Crux.Structs.User.t(), reason: String.t() | nil}}
  | {:error, term()}

Fetches 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 function get_guild_bans!(guild) View Source (since 0.1.2)
get_guild_bans!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  %{
    optional(snowflake()) => %{
      user: Crux.Structs.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 function get_guild_bans(guild) View Source (since 0.1.2)
get_guild_bans(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok,
   %{
     optional(snowflake()) => %{
       user: Crux.Structs.User.t(),
       reason: String.t() | nil
     }
   }}
  | {:error, term()}

Fetches a map of banned users along their ban reasons.

For more informations see discord Docs.

Link to this function get_guild_channels!(guild) View Source (since 0.1.1)
get_guild_channels!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  [Crux.Structs.Channel.t()] | no_return()

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

Link to this function get_guild_channels(guild) View Source (since 0.1.1)
get_guild_channels(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, [Crux.Structs.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 function get_guild_embed!(guild) View Source (since 0.1.2)
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 function get_guild_embed(guild) View Source (since 0.1.2)
get_guild_embed(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, term()} | {:error, term()}

Fetches a guild’s embed (server widget).

Returns a Guild Embed Object.

For more informations see Discord Docs.

Link to this function get_guild_emoji!(guild, emoji) View Source (since 0.1.1)
get_guild_emoji!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_id_resolvable()
) :: Crux.Structs.Emoji | no_return()

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

Link to this function get_guild_emoji(guild, emoji) View Source (since 0.1.1)
get_guild_emoji(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_id_resolvable()
) :: {:ok, Crux.Structs.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 function get_guild_integrations!(guild) View Source (since 0.1.2)
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 function get_guild_integrations(guild) View Source (since 0.1.2)
get_guild_integrations(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, list()} | {:error, term()}

Fetches a list of guild integrations.

Returns a list of Integration Objects.

For more informations see Discord Docs.

Link to this function get_guild_invites!(guild) View Source (since 0.1.2)
get_guild_invites!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  %{optional(String.t()) => Crux.Structs.Invite.t()} | no_return()

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

Link to this function get_guild_invites(guild) View Source (since 0.1.2)
get_guild_invites(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, %{optional(String.t()) => Crux.Structs.Invite.t()}} | {:error, term()}

Fetches all available invites in a guild.

For more informations see Discord Docs.

Link to this function get_guild_member!(guild, user) View Source (since 0.1.0)

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

Link to this function get_guild_member(guild, user) View Source (since 0.1.0)
get_guild_member(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  user :: Crux.Rest.Util.user_id_resolvable()
) :: {:ok, Crux.Structs.Member.t()} | {:error, term()}

Fetches a member from the api.

This may be necessary for offline members in large guilds.

For more informations see Discord Docs.

Link to this function get_guild_prune_count!(guild, days) View Source (since 0.1.2)
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 function get_guild_prune_count(guild, days) View Source (since 0.1.2)
get_guild_prune_count(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  days :: pos_integer()
) :: {:ok, non_neg_integer()} | {:error, term()}

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

For more informations see Discord Docs.

Link to this function get_guild_roles!(guild) View Source (since 0.1.2)
get_guild_roles!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  %{optional(snowflake()) => Crux.Structs.Role.t()} | no_return()

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

Link to this function get_guild_roles(guild) View Source (since 0.1.2)
get_guild_roles(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, %{optional(snowflake()) => Crux.Structs.Role.t()}} | {:error, term()}

Fetches 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 function get_guild_vanity_url!(guild) View Source (since 0.1.2)
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 function get_guild_vanity_url(guild) View Source (since 0.1.2)
get_guild_vanity_url(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, String.t()} | {:error, term()}

Fetches the vanity url of a guild, if any

Link to this function get_guild_voice_regions!(guild) View Source (since 0.1.2)
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 function get_guild_voice_regions(guild) View Source (since 0.1.2)
get_guild_voice_regions(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, term()} | {:error, term()}

Fetches 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 function get_invite!(code) View Source (since 0.1.0)
get_invite!(code :: String.t()) :: Crux.Structs.Invite.t() | no_return()

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

Link to this function get_invite(code) View Source (since 0.1.0)
get_invite(code :: String.t()) ::
  {:ok, Crux.Structs.Invite.t()} | {:error, term()}

Fetches an invite from the api.

For more informations see Discord Docs.

Link to this function get_message!(channel, message) View Source (since 0.1.0)
get_message!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  message_id :: Crux.Rest.Util.message_id_resolvable()
) :: Crux.Structs.Message | no_return()

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

Link to this function get_message(channel, message) View Source (since 0.1.0)
get_message(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  message_id :: Crux.Rest.Util.message_id_resolvable()
) :: {:ok, Crux.Structs.Message} | {:error, term()}

Gets a message from the api.

For more informations see Discord Docs.

Link to this function get_messages!(channel, args \\ []) View Source (since 0.1.0)
get_messages!(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  args :: get_messages_data()
) :: [Crux.Structs.Message.t()] | no_return()

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

Link to this function get_messages(channel, args \\ []) View Source (since 0.1.0)
get_messages(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  args :: get_messages_data()
) :: {:ok, [Crux.Structs.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 function get_pinned_messages!(channel) View Source (since 0.1.1)
get_pinned_messages!(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  [Crux.Structs.Message.t()] | no_return()

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

Link to this function get_pinned_messages(channel) View Source (since 0.1.1)
get_pinned_messages(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  {:ok, [Crux.Structs.Message.t()]} | {:error, term()}

Gets a list of pinned messages from the api.

For more informations see Discord Docs.

Link to this function get_reactions!(channel_or_message, emoji_or_message_id, emoji_or_maybe_data \\ [], maybe_data \\ []) View Source (since 0.1.0)

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

Link to this function get_reactions(channel_or_message, emoji_or_message_id, emoji_or_maybe_data \\ [], maybe_data \\ []) View Source (since 0.1.0)

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.

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

Link to this function get_user(user) View Source (since 0.1.4)
get_user(user :: Crux.Rest.Util.user_id_resolvable() | String.t()) ::
  {:ok, Crux.Structs.User.t()} | {:error, term()}

Fetches a user from the api.

For more informations see Discord Docs.

Link to this function get_user_dms!() View Source (since 0.1.4)
get_user_dms!() :: [Crux.Structs.Channel.t()] | no_return()

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

Link to this function get_user_dms() View Source (since 0.1.4)
get_user_dms() :: {:ok, [Crux.Structs.Channel.t()]} | {:error, term()}

Fetches a list of Crux.Structs.Channel. (DMChannels in this case)

For more informations see Discord Docs.

Link to this function get_webhook!(user, token \\ nil) View Source (since 0.1.7)
get_webhook!(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t() | nil
) :: [Crux.Structs.Webhook.t()] | no_return()

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

Link to this function get_webhook(user, token \\ nil) View Source (since 0.1.7)
get_webhook(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t() | nil
) :: {:ok, [Crux.Structs.Webhook.t()]} | {:error, term()}

Fetches a webhook

For more information see Discord Docs

Link to this function leave_guild!(guild) View Source (since 0.1.4)
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 function leave_guild(guild) View Source (since 0.1.4)
leave_guild(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  :ok | {:error, term()}

Leaves a guild.

For more informations see Discord Docs.

Link to this function list_channel_webhooks!(channel) View Source (since 0.1.7)
list_channel_webhooks!(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  [Crux.Structs.Webhook.t()] | no_return()

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

Link to this function list_channel_webhooks(channel) View Source (since 0.1.7)
list_channel_webhooks(channel :: Crux.Rest.Util.channel_id_resolvable()) ::
  {:ok, [Crux.Structs.Webhook.t()]} | {:error, term()}

Fetches a channel’s webhook list

For more information see Discord Docs

Link to this function list_guild_emojis!(guild) View Source (since 0.1.1)
list_guild_emojis!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  [Crux.Structs.Emoji.t()] | no_return()

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

Link to this function list_guild_emojis(guild) View Source (since 0.1.1)
list_guild_emojis(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, [Crux.Structs.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 function list_guild_members!(guild, options \\ []) View Source (since 0.1.0)
list_guild_members!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  options :: list_guild_members_options()
) :: [Crux.Structs.Member.t()] | no_return()

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

Link to this function list_guild_members(guild, options \\ []) View Source (since 0.1.0)
list_guild_members(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  options :: list_guild_members_options()
) :: {:ok, [Crux.Structs.Member.t()]} | {:error, term()}

Gets a list of members from the guild.

For more informations see Discord Docs.

Link to this function list_guild_webhooks!(guild) View Source (since 0.1.7)
list_guild_webhooks!(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  [Crux.Structs.Webhook.t()] | no_return()

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

Link to this function list_guild_webhooks(guild) View Source (since 0.1.7)
list_guild_webhooks(guild :: Crux.Rest.Util.guild_id_resolvable()) ::
  {:ok, [Crux.Structs.Webhook.t()]} | {:error, term()}

Fetches a guild’s webhook list

For more information see Discord Docs

Link to this function modify_channel!(channel, data) View Source (since 0.1.0)

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

Link to this function modify_channel(channel, data) View Source (since 0.1.0)
modify_channel(
  channel :: Crux.Rest.Util.channel_id_resolvable(),
  data :: modify_channel_data()
) :: {:ok, Crux.Structs.Channel.t()} | {:error, term()}

Modifies a channel, see t:modify_channel_data for available options.

For more informations see Discord Docs.

Link to this function modify_current_user!(data) View Source (since 0.1.4)
modify_current_user!(data :: modify_current_user_data()) ::
  Crux.Structs.User.t() | no_return()

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

Link to this function modify_current_user(data) View Source (since 0.1.4)
modify_current_user(data :: modify_current_user_data()) ::
  {:ok, Crux.Structs.User.t()} | {:error, term()}

Modifes the currently logged in user.

For more informations see Discord Docs.

Link to this function modify_current_users_nick!(guild, nick, reason \\ nil) View Source (since 0.1.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 function modify_current_users_nick(guild, nick, reason \\ nil) View Source (since 0.1.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 function modify_guild!(guild, data) View Source (since 0.1.0)

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

Link to this function modify_guild(guild, data) View Source (since 0.1.0)
modify_guild(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: modify_guild_data()
) :: {:ok, Crux.Structs.Guild.t()} | {:error, term()}

Updates a guild, see t:modify_guild_data for available options.

For more informations see Discord Docs.

Link to this function modify_guild_channel_positions!(guild, channels) View Source (since 0.1.0)
modify_guild_channel_positions!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  channels :: [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 function modify_guild_channel_positions(guild, channels) View Source (since 0.1.0)
modify_guild_channel_positions(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  channels :: [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 function modify_guild_embed!(guild, data) View Source (since 0.1.2)
modify_guild_embed!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data ::
    %{optional(:enabled) => boolean(), optional(:channel_id) => snowflake()}
    | [enabled: boolean(), channel_id: snowflake()]
) :: term() | no_return()

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

Link to this function modify_guild_embed(guild, data) View Source (since 0.1.2)
modify_guild_embed(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data ::
    %{optional(:enabled) => boolean(), optional(:channel_id) => snowflake()}
    | [enabled: boolean(), channel_id: 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 function modify_guild_emoji!(guild, emoji, data) View Source (since 0.1.0)
modify_guild_emoji!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_id_resolvable(),
  data :: modify_guild_emoji_data()
) :: Crux.Structs.Emoji | no_return()

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

Link to this function modify_guild_emoji(guild, emoji, data) View Source (since 0.1.0)
modify_guild_emoji(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  emoji :: Crux.Rest.Util.emoji_id_resolvable(),
  data :: modify_guild_emoji_data()
) :: {:ok, Crux.Structs.Emoji} | {:error, term()}

Modifies a guild emoji.

For more informations see Discord Docs.

Link to this function modify_guild_integration!(guild, integration_id, data) View Source (since 0.1.2)
modify_guild_integration!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: 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 function modify_guild_integration(guild, integration_id, data) View Source (since 0.1.2)
modify_guild_integration(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: 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 function modify_guild_member!(guild, member, data) View Source (since 0.1.0)
modify_guild_member!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  member :: Crux.Rest.Util.user_id_resolvable(),
  data :: modify_guild_member_data()
) :: :ok | no_return()

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

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

Modifies a member in a guild.

For more informations see Discord Docs.

Link to this function modify_guild_role!(guild, role, data) View Source (since 0.1.2)

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

Link to this function modify_guild_role(guild, role, data) View Source (since 0.1.2)
modify_guild_role(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  role :: Crux.Rest.Util.role_id_resolvable(),
  data :: guild_role_data()
) :: {:ok, Crux.Structs.Role.t()} | {:error, term()}

Modifies a role in a guild.

For more informations see Discord Docs.

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

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

Link to this function modify_guild_role_positions(guild, data) View Source (since 0.1.2)
modify_guild_role_positions(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  data :: Crux.Rest.Util.modify_guild_role_positions_data()
) :: {:ok, %{optional(snowflake()) => Crux.Structs.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 function remove_guild_ban!(guild, user, reason \\ nil) View Source (since 0.1.2)
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 function remove_guild_ban(guild, user, reason \\ nil) View Source (since 0.1.2)
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 function remove_guild_member_role!(guild, member, role, reason \\ nil) View Source (since 0.1.1)
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 function remove_guild_member_role(guild, member, role, reason \\ nil) View Source (since 0.1.1)
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 function sync_guild_integration!(guild, integration_id) View Source (since 0.1.2)
sync_guild_integration!(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: snowflake()
) :: :ok | no_return()

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

Link to this function sync_guild_integration(guild, integration_id) View Source (since 0.1.2)
sync_guild_integration(
  guild :: Crux.Rest.Util.guild_id_resolvable(),
  integration_id :: snowflake()
) :: :ok | {:error, term()}

Syncs an integration for a guild.

For more informations see Discord Docs.

Link to this function trigger_typing!(channel) View Source (since 0.1.1)
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 function trigger_typing(channel) View Source (since 0.1.1)
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 function update_webhook!(user, token \\ nil, data) View Source (since 0.1.7)
update_webhook!(
  user :: Crux.Rest.Util.user_id_resolvable(),
  token :: String.t() | nil,
  data ::
    %{
      optional(:name) => String.t(),
      optional(:avatar) => String.t(),
      optional(:channel_id) => snowflake()
    }
    | [name: String.t(), avatar: String.t(), channel_id: snowflake()]
) :: Crux.Structs.Webhook.t() | no_return()

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

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

Updates a webhook

For more information see Discord Docs