Remedy.API (Remedy v0.6.8) View Source

Standard interface for the Discord API.

The majority of the functions within this module are pulled directly from the Discord API. Some custom implementations are included.

Ratelimits

Discord imposes rate limits in various capacities. The functions in this module will respect those rate limits where possible. If required, a request will be held until it is allowed to be completed.

Cache Interaction

This module does not automagically interract with the cache.

Return Values

Items returned from the API are parsed to ensure the values of in the correct format and types.

List vs Get?

Functions in the discord API that return lists are randomly called either Get or List for some arbitrary reason. This is rectified so that all functions returning lists will start with the verb list.

Edit vs Modify?

The functions have been normalized to :modify.

Note: This one is anyones guess, just saying if I can pick or the other with a $2 mcmuffin in my hand. Discord can figure it out with 400 mil in the bank. I made them all :modify because its cuter.

Permissions

Any permissions a bot requires on a server to send a request is shown under the function.

Intents

If a privileged intent is required for a request to be completed, it is also shown under the function.

Missing Functions

The following functions were not migrated from Nostrum

  • :get_user_dms

Link to this section Summary

Functions

Puts a user in a guild.

Begins a guild prune to prune members within days.

Deletes multiple messages from a channel.

Overwrite the existing global application commands.

Overwrite the existing guild application commands on the specified guild.

Creates an invite for a guild channel.

Create a new DM channel with a user.

Create a followup message for an interaction.

Create a new global application command.

Creates a new group DM channel.

Bans a user from a guild.

Creates a channel for a guild.

Creates a new emoji for the given guild.

Creates a guild role.

Create a response to an interaction received from the gateway.

Posts a message to a guild text or DM channel.

Creates a reaction for a message.

Creates a webhook.

Deletes all reactions from a message.

Deletes all reactions of a given emoji from a message.

Deletes a channel.

Delete a channel permission for a user or role.

Delete a followup message for an interaction.

Delete an existing global application command.

Deletes a guild.

Deletes the given emoji.

Deletes a role from a guild.

Deletes an invite by its invite_code.

Deletes a reaction the bot has made for the message.

Deletes another user's reaction from a message.

Deletes a webhook.

Get a channel.

Gets a list of invites for a channel.

Retrieves a message from a channel.

Gets the authorization information for the Bot.

Gets the bot's OAuth2 application info.

Gets info on the current user.

Gets a list of guilds the user is currently in.

Gets a gateway URL.

Gets a Gateway Bot Object.

Fetch all global commands.

Gets a guild.

Gets a ban object for the given user from a guild.

Gets a list of guild channels.

Gets an emoji for the given guild and emoji ids.

Gets a list of guild integerations.

Gets the number of members that would be removed in a prune given days.

Gets an invite by its invite_code.

Gets all users who reacted with an emoji.

Returns a sticker object.

Gets a user by its t:Remedy.Schema.User.id/0.

Gets a list of user connections.

Gets a webhook by id.

Gets a webhook by id and token.

add recipient to a group DM

Leaves a guild.

List active threads.

Gets a list of webook for a channel.

Gets a list of users banned from a guild.

Gets a list of emojis for a given guild.

Gets a list of invites for a guild.

Gets a list of a guild's members.

Gets a guild's roles.

Gets a list of voice regions for the guild.

Gets a list of webooks for a guild.

Retrieves a channel's messages.

List messages after a given message.

List messages around a given message.

List messages before a given message.

Retrieves all pinned messages from a channel.

Gets a list of voice regions.

Modifies a channel's settings.

Edit the permission overwrites for a user or role.

Changes the username or avatar of the current user.

Update an existing global application command.

Modifies a guild's settings.

Reorders a guild's channels.

Modify the given emoji.

Modifies a guild member's attributes.

Modifies a guild role.

Reorders a guild's roles.

Edits a previously sent message in a channel.

Modifies the nickname of the current user in a guild.

Modifies a webhook.

Pins a message in a channel.

Publish a message in a news channel.

Removes a ban for a user.

Removes a member from a guild.

Triggers the typing indicator.

Unpins a message in a channel.

Link to this section Types

Specs

error() :: any()

Specs

limit() :: integer()

Specs

locator() :: any()

Specs

opts() :: keyword()

Specs

reason() :: String.t() | nil

Specs

snowflake() :: Sunbake.Snowflake.t()

Link to this section Functions

Link to this function

add_guild_member(guild_id, user_id)

View Source

Puts a user in a guild.

Permissions

  • CREATE_INSTANT_INVITE
  • MANAGE_NICKNAMES*
  • MANAGE_ROLES*
  • MUTE_MEMBERS*
  • DEAFEN_MEMBERS*

Events

  • :GUILD_MEMBER_ADD

Options

  • :access_token (string) - the user's oauth2 access token
  • :nick (string) - value to set users nickname to
  • :roles (list of t:Remedy.Schema.Guild.Role.id/0) - array of role ids the member is assigned
  • :mute (boolean) - if the user is muted
  • :deaf (boolean) - if the user is deafened

:access_token is always required.

Examples

iex> Remedy.API.add_guild_member(
...> 41771983423143937,
...> 18374719829378473,
...> access_token: "6qrZcUqja7812RVdnEKjpzOL4CvHBFG",
...> nick: "remedy",
...> roles: [431849301, 913809431])
Link to this function

add_guild_member_role(guild_id, user_id, role_id)

View Source

Adds a role to a member.

Role to add is specified by role_id. User to add role to is specified by guild_id and user_id. An optional reason can be given for the audit log.

Link to this function

add_thread_member(channel_id, user_id)

View Source (since 0.6.0)
Link to this function

batch_modify_application_command_permissions(guild_id)

View Source (since 0.6.0)
Link to this function

begin_guild_prune(guild_id)

View Source

Begins a guild prune to prune members within days.

An optional reason can be provided for the guild audit log.

This endpoint requires the KICK_MEMBERS permission. It fires multiple Remedy.Consumer.guild_member_remove/0 events.

If successful, returns {:ok, %{pruned: pruned}}. Otherwise, returns a Remedy.API.error/0.

Examples

iex> Remedy.API.begin_guild_prune(81384788765712384, 1)
{:ok, %{pruned: 0}}
Link to this function

bulk_delete_messages(channel_id)

View Source

Deletes multiple messages from a channel.

messages is a list of Remedy.Schema.Message.id that you wish to delete. When given more than 100 messages, this function will chunk the given message list into blocks of 100 and send them off to the API. It will stop deleting on the first error that occurs. Keep in mind that deleting thousands of messages will take a pretty long time and it may be proper to just delete the channel you want to bulk delete in and recreate it.

This method can only delete messages sent within the last two weeks. Filter is an optional parameter that specifies whether messages sent over two weeks ago should be filtered out; defaults to true.

Link to this function

bulk_overwrite_global_application_commands()

View Source

Overwrite the existing global application commands.

This action will:

  • Create any command that was provided and did not already exist
  • Update any command that was provided and already existed if its configuration changed
  • Delete any command that was not provided but existed on Discord's end

Updates will be available in all guilds after 1 hour. Commands that do not already exist will count toward daily application command create limits.

Parameters

  • application_id: Application ID for which to overwrite the commands. If not given, this will be fetched from Me.
  • commands: List of command configurations, see the linked API documentation for reference.

Return value

Updated list of global application commands. See the official reference: https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands

Link to this function

bulk_overwrite_guild_application_commands(guild_id)

View Source

Overwrite the existing guild application commands on the specified guild.

This action will:

  • Create any command that was provided and did not already exist
  • Update any command that was provided and already existed if its configuration changed
  • Delete any command that was not provided but existed on Discord's end

Parameters

  • application_id: Application ID for which to overwrite the commands. If not given, this will be fetched from Me.
  • guild_id: Guild on which to overwrite the commands.
  • commands: List of command configurations, see the linked API documentation for reference.

Return value

Updated list of guild application commands. See the official reference: https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-guild-application-commands

Link to this function

create_channel_invite(channel_id)

View Source

Creates an invite for a guild channel.

An optional reason can be provided for the audit log.

This endpoint requires the CREATE_INSTANT_INVITE permission.

If successful, returns {:ok, invite}. Otherwise, returns a Remedy.API.error/0.

Options

  • :max_age (integer) - duration of invite in seconds before expiry, or 0 for never. (default: 86400)
  • :max_uses (integer) - max number of uses or 0 for unlimited. (default: 0)
  • :temporary (boolean) - Whether the invite should grant temporary membership. (default: false)
  • :unique (boolean) - used when creating unique one time use invites. (default: false)

Examples

iex> Remedy.API.create_channel_invite(41771983423143933)
{:ok, Remedy.Schema.Invite{}}

iex> Remedy.API.create_channel_invite(41771983423143933, max_uses: 20)
{:ok, %Remedy.Schema.Invite{}}

Create a new DM channel with a user.

If successful, returns {:ok, dm_channel}. Otherwise, returns a Remedy.API.error/0.

Examples

iex> Remedy.API.create_dm(150061853001777154)
{:ok, %Remedy.Schema.Channel{type: 1}}
Link to this function

create_followup_message(interaction_token)

View Source

Create a followup message for an interaction.

Delegates to execute_webhook/3, see the function for more details.

Link to this function

create_global_application_command()

View Source

Create a new global application command.

The new command will be available on all guilds in around an hour. If you want to test commands, use create_guild_application_command/2 instead, as commands will become available instantly there. If an existing command with the same name exists, it will be overwritten.

Parameters

  • application_id: Application ID for which to create the command. If not given, this will be fetched from Me.
  • command: Command configuration, see the linked API documentation for reference.

Return value

The created command. See the official reference: https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command

Example

iex>  Remedy.API.create_application_command(%{name: "edit", description: "ed, man! man, ed", options: []})
{:ok, %Remedy.Schema.Command{}}

Creates a new group DM channel.

If successful, returns {:ok, group_dm_channel}. Otherwise, returns a Remedy.API.error/0.

access_tokens are user oauth2 tokens. nicks is a map that maps a user id to a nickname.

Examples

iex> Remedy.API.create_group_dm(["6qrZcUqja7812RVdnEKjpzOL4CvHBFG"], %{41771983423143937 => "My Nickname"})
{:ok, %Remedy.Schema.Channel{type: 3}}
Link to this function

create_guild()

View Source (since 0.6.0)
Link to this function

create_guild_application_command(guild_id, command_id)

View Source (since 0.6.0)
Link to this function

create_guild_ban(guild_id, user_id)

View Source

Bans a user from a guild.

User to delete is specified by guild_id and user_id. An optional reason can be specified for the audit log.

Link to this function

create_guild_channel(guild_id)

View Source

Creates a channel for a guild.

Permissions

  • MANAGE_CHANNELS

Events

  • :CHANNEL_CREATE

Options

  • :name (string) - channel name (2-100 characters)
  • :type (integer) - the type of channel (See Remedy.Schema.Channel)
  • :topic (string) - channel topic (0-1024 characters)
  • :bitrate (integer) - the bitrate (in bits) of the voice channel (voice only)
  • :user_limit (integer) - the user limit of the voice channel (voice only)
  • :permission_overwrites (list of t:Remedy.Schema.Overwrite.t/0 or equivalent map) - the channel's permission overwrites
  • :parent_id - id of the parent category for a channel
  • :nsfw (boolean) - if the channel is nsfw

Examples

iex> Remedy.API.create_guild_channel(81384788765712384, name: "elixir-remedy", topic: "craig's domain")
{:ok, %Remedy.Schema.Channel{guild_id: 81384788765712384}}
Link to this function

create_guild_emoji(guild_id)

View Source

Creates a new emoji for the given guild.

This endpoint requires the MANAGE_EMOJIS permission. It fires a Remedy.Consumer.guild_emojis_update/0 event.

An optional reason can be provided for the audit log.

If successful, returns {:ok, emoji}. Otherwise, returns Remedy.API.error/0.

Options

  • :name (string) - name of the emoji
  • :image (base64 data URI) - the 128x128 emoji image. Maximum size of 256kb
  • :roles list of - roles for which this emoji will be whitelisted (default: [])

:name and :image are always required.

Examples

iex> image = "data:image/png;base64,YXl5IGJieSB1IGx1a2luIDQgc3VtIGZ1az8="
...> Remedy.API.create_guild_emoji(43189401384091, name: "remedy", image: image, roles: [])
Link to this function

create_guild_from_template(template_code)

View Source (since 0.6.0)
Link to this function

create_guild_roles(guild_id)

View Source

Creates a guild role.

An optional reason for the audit log can be provided via reason.

This endpoint requires the MANAGE_ROLES permission. It fires a Remedy.Consumer.guild_role_create/0 event.

If successful, returns {:ok, role}. Otherwise, returns a Remedy.API.error/0.

Options

  • :name (string) - name of the role (default: "new role")
  • :permissions (integer) - bitwise of the enabled/disabled permissions (default: @everyone perms)
  • :color (integer) - RGB color value (default: 0)
  • :hoist (boolean) - whether the role should be displayed separately in the sidebar (default: false)
  • :mentionable (boolean) - whether the role should be mentionable (default: false)

Examples

iex> Remedy.API.create_guild_role(41771983423143937, name: "remedy-club", hoist: true)
{:ok, %Remedy.Schema.Role{}}
Link to this function

create_guild_sticker(guild_id, sticker_id)

View Source (since 0.6.0)
Link to this function

create_guild_template(guild_id)

View Source (since 0.6.0)
Link to this function

create_interaction_response(interaction_id, interaction_token)

View Source

Create a response to an interaction received from the gateway.

Parameters

  • id: The interaction ID to which the response should be created.
  • token: The interaction token.
  • response: An InteractionResponse object. See the linked documentation.

Example

As an alternative to passing the interaction ID and token, the original Remedy.Schema.Interaction.t/0 can also be passed directly. See create_interaction_response/1.

Link to this function

create_message(channel_id, opts \\ [])

View Source

Posts a message to a guild text or DM channel.

Intents

  • :VIEW_CHANNEL
  • :SEND_MESSAGES
  • :SEND_MESSAGES_TTS (optional)

Events

  • t:Remedy.Gateway.Dispatch.message_create/0.

Options

  • :content (string) - the message contents (up to 2000 characters)
  • :tts (boolean) - true if this is a TTS message
  • :file (Path.t/0 | map) - the path of the file being sent, or a map with the following keys if sending a binary from memory
  • :name (string) - the name of the file
  • :body (string) - binary you wish to send
  • :embed (Remedy.Schema.Embed.t/0) - embedded rich content
  • :allowed_mentions - See "Allowed mentions" below
  • :message_reference (map) - See "Message references" below

Note: At least one of the following is required: :content, :file, :embed.

Allowed mentions

  • :all (default) - Ping everything as usual
  • :none - Nobody will be pinged
  • :everyone - Allows to ping @here and @everone
  • :users - Allows to ping users
  • :roles - Allows to ping roles
  • {:users, list} - Allows to ping list of users. Can contain up to 100 ids of users.
  • {:roles, list} - Allows to ping list of roles. Can contain up to 100 ids of roles.

Examples

iex> {:ok, message} = Remedy.API.create_message(872417560094732331, content: "**Doctest Message** ✅")
...> message.content
"**Doctest Message** ✅"
Link to this function

create_reaction(channel_id, message_id, emoji)

View Source

Creates a reaction for a message.

Permissions

  • VIEW_CHANNEL
  • READ_MESSAGE_HISTORY
  • ADD_REACTIONS ()

Examples

iex> Remedy.API.create_reaction(123123123123, 321321321321,
...> %Remedy.Schema.Emoji{id: 43819043108, name: "foxbot"}
...> )
:ok

iex> Remedy.API.create_reaction(123123123123, 321321321321, "😁")
Link to this function

create_stage()

View Source (since 0.6.0)
Link to this function

create_webhook(channel_id)

View Source

Creates a webhook.

Parameters

  • channel_id - Id of the channel to send the message to.
  • args - Map with the following required keys:
    • name - Name of the webhook.
    • avatar - Base64 128x128 jpeg image for the default avatar.
  • reason - An optional reason for the guild audit log.
Link to this function

delete_all_reactions(channel_id, message_id)

View Source

Deletes all reactions from a message.

Permissions

  • VIEW_CHANNEL,
  • READ_MESSAGE_HISTORY
  • MANAGE_MESSAGES

Events

  • :MESSAGE_REACTION_REMOVE_ALL.

Examples

Link to this function

delete_all_reactions_for_emoji(channel_id, message_id, emoji)

View Source

Deletes all reactions of a given emoji from a message.

Permissions

  • MANAGE_MESSAGES

Events

  • :MESSAGE_REACTION_REMOVE_EMOJI

If successful, returns {:ok}. Otherwise, returns Remedy.API.error/0.

See create_reaction/3 for similar examples.

Link to this function

delete_channel(channel_id)

View Source

Specs

delete_channel(snowflake()) :: {:error, any()} | {:ok, map()}

Deletes a channel.

An optional reason can be provided for the guild audit log.

Permissions

  • MANAGE_CHANNELS

Events

  • :CHANNEL_DELETE

Examples

iex> Remedy.API.delete_channel(421533712753360896) {:ok, %Remedy.Schema.Channel{id: 421533712753360896}}

iex> Remedy.API.delete_channel(123)

Link to this function

delete_channel_permission(channel_id, overwrite_id)

View Source

Delete a channel permission for a user or role.

Role or user overwrite to delete is specified by channel_id and overwrite_id. An optional reason can be given for the audit log.

Link to this function

delete_followup_message(interaction_token, message_id)

View Source

Delete a followup message for an interaction.

Parameters

  • application_id: Application ID for which to create the command. If not given, this will be fetched from Me.
  • token: Interaction token.
  • message_id: Followup message ID.
Link to this function

delete_global_application_command(command_id)

View Source

Delete an existing global application command.

Parameters

  • application_id: Application ID for which to create the command. If not given, this will be fetched from Me.
  • command_id: The current snowflake of the command.

Deletes a guild.

This endpoint requires that the current user is the owner of the guild.

Events

  • :GUILD_DELETE

Examples

iex> Remedy.API.delete_guild(618432108653707274)
{:error, {403, 50001, "Missing Access"}}

iex> Remedy.API.delete_guild(618432108653707274)
{:error, {403, 50001, "Missing Access"}}
Link to this function

delete_guild_application_command(guild_id, command_id)

View Source (since 0.6.0)
Link to this function

delete_guild_emoji(guild_id, emoji_id)

View Source

Deletes the given emoji.

An optional reason can be provided for the audit log.

This endpoint requires the MANAGE_EMOJIS permission. It fires a Remedy.Consumer.guild_emojis_update/0 event.

If successful, returns {:ok}. Otherwise, returns Remedy.API.error/0.

Link to this function

delete_guild_integration(guild_id, integration_id)

View Source

Deletes a guild integeration.

Integration to delete is specified by guild_id and integeration_id.

Link to this function

delete_guild_role(guild_id, role_id)

View Source

Deletes a role from a guild.

An optional reason can be specified for the audit log.

This endpoint requires the MANAGE_ROLES permission. It fires a Remedy.Consumer.guild_role_delete/0 event.

If successful, returns {:ok}. Otherwise, returns a Remedy.API.error/0.

Examples

iex> Remedy.API.delete_guild_role(41771983423143937, 392817238471936)
Link to this function

delete_guild_sticker(guild_id, sticker_id)

View Source (since 0.6.0)
Link to this function

delete_guild_template(guild_id, template_code)

View Source (since 0.6.0)
Link to this function

delete_invite(invite_code)

View Source

Deletes an invite by its invite_code.

This endpoint requires the MANAGE_CHANNELS permission.

If successful, returns {:ok, invite}. Otherwise, returns a Remedy.API.error/0.

Examples

iex> Remedy.API.delete_invite("zsjUsC")
{:ok, %Remedy.Schema.Invite{}}
Link to this function

delete_message(channel_id, message_id)

View Source

Deletes a message.

Permissions

  • 'VIEW_CHANNEL'
  • 'MANAGE_MESSAGES'

Events

  • MESSAGE_DELETE

Examples

iex> Remedy.API.delete_message(43189401384091, 43189401384091)
Link to this function

delete_original_interaction_response(interaction_token)

View Source (since 0.6.0)
Link to this function

delete_own_reaction(channel_id, message_id, emoji)

View Source

Deletes a reaction the bot has made for the message.

Permissions

  • VIEW_CHANNEL
  • READ_MESSAGE_HISTORY

Events

  • :MESSAGE_REACTION_REMOVE

Examples

iex> Remedy.API.delete_own_reaction(123, 123, 123)
{:ok}
Link to this function

delete_stage(channel_id)

View Source (since 0.6.0)
Link to this function

delete_user_reaction(channel_id, message_id, emoji, user_id)

View Source

Deletes another user's reaction from a message.

Permissions

  • VIEW_CHANNEL
  • READ_MESSAGE_HISTORY
  • MANAGE_MESSAGES

Examples

iex>
Link to this function

delete_webhook(webhook_id)

View Source

Deletes a webhook.

Parameters

  • webhook_id - Id of webhook to delete.
  • reason - An optional reason for the guild audit log.
Link to this function

delete_webhook_message(webhook_id, webhook_token, message_id)

View Source (since 0.6.0)
Link to this function

delete_webhooks_with_token(webhook_id, webhook_token)

View Source (since 0.6.0)
Link to this function

execute_github_webhook(webhook_id, webhook_token)

View Source

Executes a github webhook.

Parameters

  • webhook_id - Id of the webhook to execute.
  • webhook_token - Token of the webhook to execute.
Link to this function

execute_slack_webhook(webhook_id, webhook_token)

View Source

Executes a slack webhook.

Parameters

  • webhook_id - Id of the webhook to execute.
  • webhook_token - Token of the webhook to execute.
Link to this function

execute_webhook(webhook_id, webhook_token)

View Source

Executes a webhook.

## Parameters

  • webhook_id - Id of the webhook to execute.
  • webhook_token - Token of the webhook to execute.
  • args - Map with the following required keys:
    • content - Message content.
    • file - File to send.
    • embeds - List of embeds to send.
    • username - Overrides the default name of the webhook.
    • avatar_url - Overrides the default avatar of the webhook.
    • tts - Whether the message should be read over text to speech.
  • wait - Whether to return an error or not. Defaults to false.

Only one of content, file or embeds should be supplied in the args parameter.

Link to this function

follow_news_channel(channel_id)

View Source (since 0.6.0)
Link to this function

get_application_command_permissions(guild_id, command_id)

View Source (since 0.6.0)

Specs

get_channel(snowflake() | Remedy.Schema.Channel.t()) ::
  {:error, any()} | {:ok, Remedy.Schema.Channel.t()}

Get a channel.

Examples

iex> {:ok, channel} = Remedy.API.get_channel(872417560094732331)
...> channel.id
872417560094732331
Link to this function

get_channel_invites(channel_id)

View Source

Gets a list of invites for a channel.

This endpoint requires the 'VIEW_CHANNEL' and 'MANAGE_CHANNELS' permissions.

If successful, returns {:ok, invite}. Otherwise, returns a Remedy.API.error/0.

Examples

iex> Remedy.API.get_channel_invites(43189401384091)
{:ok, [%Remedy.Schema.Invite{}]}
Link to this function

get_channel_message(channel_id, message_id)

View Source

Specs

get_channel_message(snowflake(), snowflake()) ::
  {:error, any()} | {:ok, Remedy.Schema.Message.t()}

Retrieves a message from a channel.

Permissions

  • 'VIEW_CHANNEL'
  • 'READ_MESSAGE_HISTORY'

Examples

iex> Remedy.API.get_channel_message(872417560094732331, 884355195277025321) {:ok, %Remedy.Schema.Message{}}

Link to this function

get_current_authorization_information()

View Source

Specs

get_current_authorization_information() :: {:error, any()} | {:ok, any()}

Gets the authorization information for the Bot.

This is currently unused by any of the connections employed by Remedy and is included for completeness only.

Examples

iex> Remedy.API.get_current_authorization_information()
{:error, {401, 50001, "Missing Access"}}
Link to this function

get_current_bot_application_information()

View Source

Specs

get_current_bot_application_information() ::
  {:error, any()} | {:ok, Remedy.Schema.App.t()}

Gets the bot's OAuth2 application info.

Examples

iex> Remedy.API.get_application_information()
{:ok, %Remedy.Schema.App{}

Gets info on the current user.

If remedy's caching is enabled, it is recommended to use Bot.get/0 instead of this function. This is because sending out an API request is much slower than pulling from our cache.

If the request is successful, this function returns {:ok, user}, where user is remedy's Remedy.Schema.User. Otherwise, returns {:error, reason}.

Link to this function

get_current_user_guilds()

View Source

Gets a list of guilds the user is currently in.

This endpoint requires the guilds OAuth2 scope.

If successful, returns {:ok, guilds}. Otherwise, returns a Remedy.API.error/0.

Options

  • :before - get guilds before this guild ID
  • :after - get guilds after this guild ID
  • :limit (integer) - max number of guilds to return (1-100)

Examples

iex> Remedy.API.get_current_user_guilds(limit: 1)
{:ok, [%Remedy.Schema.Guild{}]}
Link to this function

get_followup_message(interaction_token, message_id)

View Source (since 0.6.0)
Link to this function

get_gateway()

View Source (since 0.6.0)

Specs

get_gateway() :: {:error, any()} | {:ok, any()}

Gets a gateway URL.

Examples

  iex> Remedy.API.get_gateway()
  {:ok, "wss://gateway.discord.gg"}
Link to this function

get_gateway_bot()

View Source (since 0.6.0)

Gets a Gateway Bot Object.

Link to this function

get_global_application_command(command_id)

View Source (since 0.6.0)
Link to this function

get_global_application_commands()

View Source

Fetch all global commands.

Parameters

  • application_id: Application ID for which to search commands. If not given, this will be fetched from Me.

Return value

A list of ApplicationCommands on success. See the official reference: https://discord.com/developers/docs/interactions/slash-commands#applicationcommand

Example

iex> Remedy.API.get_global_application_commands
{:ok, [%{application_id: "455589479713865749"}]}

Gets a guild.

Examples

iex> Remedy.API.get_guild(81384788765712384)
{:ok, %Remedy.Schema.Guild{id: 81384788765712384}}
Link to this function

get_guild_application_command(guild_id, command_id)

View Source (since 0.6.0)
Link to this function

get_guild_application_command_permissions(guild_id)

View Source (since 0.6.0)
Link to this function

get_guild_application_commands(guild_id)

View Source (since 0.6.0)
Link to this function

get_guild_audit_log(guild_id, opts \\ [])

View Source

Specs

get_guild_audit_log(snowflake() | Remedy.Schema.Guild.t(), opts()) ::
  {:error, any()} | {:ok, Remedy.Schema.AuditLog.t()}

Get an audit log.

Query Options

  • :user_id - filter the log for actions made by a user.
  • :action_type - the type of audit log event
  • :before - filter the log before a certain entry id
  • :limit - how many entries are returned (default 50, minimum 1, maximum 100)

Examples

iex> Remedy.API.get_guild_audit_log(872417560094732328)
{:ok, %Remedy.Schema.AuditLog{}}

iex> Remedy.API.get_guild_audit_log(123)
{:error, {403, 10004, "Unknown Guild"}}
Link to this function

get_guild_ban(guild_id, user_id)

View Source

Gets a ban object for the given user from a guild.

Link to this function

get_guild_channels(guild_id)

View Source

Gets a list of guild channels.

Examples

iex> Remedy.API.get_guild_channels(81384788765712384)
{:ok, [%Remedy.Schema.Channel{guild_id: 81384788765712384}]}
Link to this function

get_guild_emoji(guild_id, emoji_id)

View Source

Gets an emoji for the given guild and emoji ids.

This endpoint requires the MANAGE_EMOJIS permission.

If successful, returns {:ok, emoji}. Otherwise, returns Remedy.API.error/0.

Link to this function

get_guild_integrations(guild_id)

View Source

Gets a list of guild integerations.

Guild to get integrations for is specified by guild_id.

Link to this function

get_guild_member(guild_id, user_id)

View Source

Gets a guild member.

Examples

iex> Remedy.API.get_guild_member(4019283754613, 184937267485)
Link to this function

get_guild_prune_count(guild_id)

View Source

Gets the number of members that would be removed in a prune given days.

This endpoint requires the KICK_MEMBERS permission.

If successful, returns {:ok, %{pruned: pruned}}. Otherwise, returns a Remedy.API.error/0.

Examples

iex> Remedy.API.get_guild_prune_count(81384788765712384, 1)
{:ok, %{pruned: 0}}
Link to this function

get_guild_sticker(guild_id, sticker_id)

View Source (since 0.6.0)
Link to this function

get_guild_template(template_code)

View Source (since 0.6.0)
Link to this function

get_guild_vanity_url(guild_id)

View Source (since 0.6.0)
Link to this function

get_guild_welcome_screen(guild_id)

View Source (since 0.6.0)
Link to this function

get_guild_widget(guild_id)

View Source (since 0.6.0)
Link to this function

get_guild_widget_image(guild_id)

View Source (since 0.6.0)
Link to this function

get_guild_widget_settings(guild_id)

View Source (since 0.6.0)

Gets an invite by its invite_code.

If successful, returns {:ok, invite}. Otherwise, returns a Remedy.API.error/0.

Options

  • :with_counts (boolean) - whether to include member count fields

Examples

iex> Remedy.API.get_invite("zsjUsC")
{:ok, %Remedy.Schema.Invite{}}

iex> Remedy.API.get_invite("zsjUsC", with_counts: true)
{:ok, %Remedy.Schema.Invite{}}
Link to this function

get_original_interaction_response(interaction_token)

View Source (since 0.6.0)
Link to this function

get_reactions(channel_id, message_id, emoji)

View Source

Gets all users who reacted with an emoji.

This endpoint requires the VIEW_CHANNEL and READ_MESSAGE_HISTORY permissions.

If successful, returns {:ok, users}. Otherwise, returns Remedy.API.error/0.

See create_reaction/3 for similar examples.

Link to this function

get_stage(channel_id)

View Source (since 0.6.0)
Link to this function

get_sticker(sticker_id)

View Source (since 0.6.0)

Specs

get_sticker(snowflake()) ::
  {:error, any()}
  | {:ok,
     %Remedy.Schema.Sticker{
       __meta__: term(),
       asset: term(),
       available: term(),
       description: term(),
       format_type: term(),
       guild: term(),
       guild_id: term(),
       id: term(),
       name: term(),
       sort_value: term(),
       sticker_pack: term(),
       sticker_pack_id: term(),
       tags: term(),
       type: term(),
       user: term(),
       user_id: term()
     }}

Returns a sticker object.

Examples

iex> Remedy.API.get_sticker(818599312882794506)
{:ok, %Remedy.Schema.Sticker{}}

iex> Remedy.API.get_sticker(123)
{:error, {404, 10060, "Unknown sticker"}}

Gets a user by its t:Remedy.Schema.User.id/0.

If the request is successful, this function returns {:ok, user}, where user is a Remedy.Schema.User. Otherwise, returns {:error, reason}.

Gets a list of user connections.

Gets a webhook by id.

Parameters

  • webhook_id - Id of the webhook to get.
Link to this function

get_webhook_message(webhook_id, webhook_token, message_id)

View Source (since 0.6.0)
Link to this function

get_webhooks_with_token(webhook_id, webhook_token)

View Source

Gets a webhook by id and token.

This method is exactly like get_webhook/1 but does not require authentication.

Parameters

  • webhook_id - Id of the webhook to get.
  • webhook_token - Token of the webhook to get.
Link to this function

group_dm_add_recipient(channel_id, user_id)

View Source (since 0.6.0)

add recipient to a group DM

Link to this function

group_dm_remove_recipient(channel_id, user_id)

View Source (since 0.6.0)
Link to this function

join_thread(channel_id)

View Source (since 0.6.0)

Leaves a guild.

Guild to leave is specified by guild_id.

Link to this function

leave_thread(channel_id)

View Source (since 0.6.0)
Link to this function

list_active_threads(arg1)

View Source (since 0.6.0)

Specs

list_active_threads(Remedy.Schema.Channel.t() | Remedy.Schema.Guild.t()) ::
  {:error, any()} | {:ok, any()}

List active threads.

Note: This can be requested on both the /channels/ and the /guilds/ routes. To specify which route is used, you should pass a full %Guild{} or %Channel{} object.

Link to this function

list_channel_webhooks(channel_id)

View Source

Gets a list of webook for a channel.

Parameters

  • channel_id - Channel to get webhooks for.
Link to this function

list_guild_bans(guild_id)

View Source (since 0.6)

Gets a list of users banned from a guild.

Guild to get bans for is specified by guild_id.

Link to this function

list_guild_emojis(guild_id)

View Source

Gets a list of emojis for a given guild.

This endpoint requires the MANAGE_EMOJIS permission.

If successful, returns {:ok, emojis}. Otherwise, returns Remedy.API.error/0.

Link to this function

list_guild_invites(guild_id)

View Source (since 0.6)

Gets a list of invites for a guild.

This endpoint requires the MANAGE_GUILD permission.

If successful, returns {:ok, invites}. Otherwise, returns a Remedy.API.error/0.

Examples

iex> Remedy.API.get_guild_invites(81384788765712384)
{:ok, [%Remedy.Schema.Invite{}]}
Link to this function

list_guild_members(guild_id)

View Source

Gets a list of a guild's members.

Options

  • :limit (integer) - max number of members to return (1-1000) (default: 1)
  • :after (t:Remedy.Schema.User.id/0) - the highest user id in the previous page (default: 0)

Examples

iex>  Remedy.API.list_guild_members(41771983423143937, limit: 1)
Link to this function

list_guild_roles(guild_id)

View Source (since 0.6)

Gets a guild's roles.

If successful, returns {:ok, roles}. Otherwise, returns a Remedy.API.error/0.

Examples

iex>  Remedy.API.get_guild_roles(147362948571673)
{:ok, [%Remedy.Schema.Role{}]}
Link to this function

list_guild_stickers(guild_id)

View Source (since 0.6.0)
Link to this function

list_guild_voice_regions(guild_id)

View Source

Gets a list of voice regions for the guild.

Guild to get voice regions for is specified by guild_id.

Link to this function

list_guild_webhooks(guild_id)

View Source

Gets a list of webooks for a guild.

Parameters

  • guild_id - Guild to get webhooks for.
Link to this function

list_joined_private_archived_threads(channel_id)

View Source (since 0.6.0)
Link to this function

list_messages(channel_id, opts \\ [])

View Source (since 0.6)

Specs

list_messages(snowflake(), keyword()) :: {:error, any()} | {:ok, list()}

Retrieves a channel's messages.

Permissions

  • VIEW_CHANNEL
  • READ_MESSAGE_HISTORY

Options

  • :before*
  • :after*
  • :around*
  • :limit
  • Only one may be provided.

Helpers

Examples

iex> Remedy.API.list_messages(872417560094732331, [{:before, 882781809908256789}, {:limit, 1}])
{:ok, [%Message{id: 882681855315423292}]}
Link to this function

list_messages_after(channel_id, message_id, limit \\ 50)

View Source

Specs

list_messages_after(snowflake(), snowflake(), limit()) ::
  {:error, any()} | {:ok, list()}

List messages after a given message.

Link to this function

list_messages_around(channel_id, message_id, limit \\ 50)

View Source

Specs

list_messages_around(snowflake(), snowflake(), limit()) ::
  {:error, any()} | {:ok, list()}

List messages around a given message.

Link to this function

list_messages_before(channel_id, message_id, limit \\ 50)

View Source

Specs

list_messages_before(snowflake(), snowflake(), limit()) ::
  {:error, any()} | {:ok, list()}

List messages before a given message.

Link to this function

list_nitro_sticker_packs()

View Source (since 0.6.0)
Link to this function

list_pinned_messages(channel_id)

View Source (since 0.6.0)

Retrieves all pinned messages from a channel.

Permissions

  • 'VIEW_CHANNEL'
  • 'READ_MESSAGE_HISTORY'

Examples

iex> Remedy.API.get_pinned_messages(43189401384091)
Link to this function

list_private_archived_threads(channel_id)

View Source (since 0.6.0)
Link to this function

list_public_archived_threads(channel_id)

View Source (since 0.6.0)
Link to this function

list_thread_members(channel_id)

View Source (since 0.6.0)

Gets a list of voice regions.

Link to this function

list_webhooks(guild_id)

View Source (since 0.6.0)
Link to this function

modify_application_command_permissions(guild_id, command_id)

View Source (since 0.6.0)
Link to this function

modify_channel(channel_id, opts, reason \\ nil)

View Source (since 0.6.0)

Specs

modify_channel(snowflake(), map(), reason()) ::
  {:error, any()} | {:ok, Remedy.Schema.Channel.t()}

Modifies a channel's settings.

Permissions

  • MANAGE_CHANNEL

Events

  • :CHANNEL_UPDATE.

Options

  • :name (string) - 2-100 character channel name
  • :position (integer) - the position of the channel in the left-hand listing
  • :topic (string) - 0-1024 character channel topic
  • :nsfw (boolean) - if the channel is nsfw
  • :bitrate (integer) - the bitrate (in bits) of the voice channel; 8000 to 96000 (128000 for VIP servers)
  • :user_limit (integer) - the user limit of the voice channel; 0 refers to no limit, 1 to 99 refers to a user limit
  • :permission_overwrites (list of t:Remedy.Schema.Overwrite.t/0 or equivalent map) - channel or category-specific permissions
  • :parent_id - id of the new parent category for a channel

Examples

iex> Remedy.API.modify_channel(41771983423143933, name: "elixir-remedy", topic: "remedy discussion") {:ok, %Remedy.Schema.Channel{id: 41771983423143933, name: "elixir-remedy", topic: "remedy discussion"}}

Link to this function

modify_channel_permissions(channel_id, overwrite_id)

View Source

Edit the permission overwrites for a user or role.

Role or user to overwrite is specified by overwrite_id.

permission_info is a map with the following keys:

  • type - Required; member if editing a user, role if editing a role.
  • allow - Bitwise value of allowed permissions.
  • deny - Bitwise value of denied permissions.
  • type - member if editing a user, role if editing a role.

An optional reason can be provided for the audit log.

allow and deny are defaulted to 0, meaning that even if you don't specify them, they will override their respective former values in an existing overwrite.

Changes the username or avatar of the current user.

Options

  • :username (string) - new username
  • :avatar (string) - the user's avatar as avatar data

Examples

iex> Remedy.API.modify_current_user(avatar: "data:image/jpeg;base64,YXl5IGJieSB1IGx1a2luIDQgc3VtIGZ1az8=")
{:ok, %Remedy.Schema.User{}}
Link to this function

modify_current_user_voice_state(guild_id)

View Source (since 0.6.0)
Link to this function

modify_followup_message(interaction_token, message_id)

View Source (since 0.6.0)
Link to this function

modify_global_application_command(command_id)

View Source

Update an existing global application command.

The updated command will be available on all guilds in around an hour.

Parameters

  • application_id: Application ID for which to edit the command. If not given, this will be fetched from Me.
  • command_id: The current snowflake of the command.
  • command: Command configuration, see the linked API documentation for reference.

Return value

The updated command. See the official reference: https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command

Link to this function

modify_group_dm(channel_id, opts, reason \\ nil)

View Source

Specs

modify_group_dm(
  Remedy.Schema.Channel.t() | snowflake(),
  keyword(),
  nil | binary()
) :: {:error, any()} | {:ok, Remedy.Schema.Channel.t()}

Modify a group DM.

This function validates the options before passing them to Remedy.API.modify_channel/3

Events:

  • :CHANNEL_UPDATE

Examples

iex> Remedy.API.modify_group_dm(872417560094732331, [{:name, "hello"}], "felt like it")
{:ok, %Channel{}}

Modifies a guild's settings.

Permissions

  • MANAGE_GUILD

Events

  • :GUILD_UPDATE

Options

  • :name (string) - guild name
  • :region (string) - guild voice region id
  • :verification_level (integer) - verification level
  • :default_message_notifications (integer) - default message notification level
  • :explicit_content_filter (integer) - explicit content filter level
  • :afk_channel_id - id for afk channel
  • :afk_timeout (integer) - afk timeout in seconds
  • :icon (base64 data URI) - 128x128 jpeg image for the guild icon
  • :owner_id - user id to transfer guild ownership to (must be owner)
  • :splash (base64 data URI) - 128x128 jpeg image for the guild splash (VIP only)
  • :system_channel_id - the id of the channel to which system messages are sent
  • :rules_channel_id - the id of the channel that is used for rules in public guilds
  • :public_updates_channel_id - the id of the channel where admins and moderators receive notices from Discord in public guilds

Examples

iex> Remedy.API.modify_guild(451824027976073216, name: "Nose Drum")
{:ok, %Remedy.Schema.Guild{id: 451824027976073216, name: "Nose Drum", ...}}
Link to this function

modify_guild_application_command(guild_id, command_id)

View Source (since 0.6.0)
Link to this function

modify_guild_channel_positions(guild_id)

View Source

Reorders a guild's channels.

Permissions

  • MANAGE_CHANNELS

Events

  • :CHANNEL_UPDATE

Options

  • positions

Examples

iex> Remedy.API.modify_guild_channel_positions(279093381723062272, [%{id: 351500354581692420, position: 2}])
{:ok}

iex> Remedy.API.modify_guild_channel_positions(279093381723062272, [%{id: 351500354581692420, position: 2}])
{:ok}
Link to this function

modify_guild_emoji(guild_id, emoji_id)

View Source

Modify the given emoji.

This endpoint requires the MANAGE_EMOJIS permission. It fires a Remedy.Consumer.guild_emojis_update/0 event.

An optional reason can be provided for the audit log.

If successful, returns {:ok, emoji}. Otherwise, returns Remedy.API.error/0.

Options

  • :name (string) - name of the emoji
  • :roles - roles to which this emoji will be whitelisted

Examples

iex> Remedy.API.modify_guild_emoji(43189401384091, 4314301984301, name: "elixir", roles: [])
{:ok, %Remedy.Schema.Emoji{}}
Link to this function

modify_guild_member(guild_id, user_id)

View Source

Modifies a guild member's attributes.

Permissions

  • MANAGE_NICKNAMES
  • MANAGE_ROLES
  • MUTE_MEMBERS
  • DEAFEN_MEMBERS
  • MOVE_MEMBERS

Events

  • :GUILD_MEMBER_UPDATE

Options

  • :nick (string) - value to set users nickname to
  • :roles - array of role ids the member is assigned
  • :mute (boolean) - if the user is muted
  • :deaf (boolean) - if the user is deafened
  • :channel_id - id of channel to move user to (if they are connected to voice)

Examples

iex> Remedy.API.modify_guild_member(41771983423143937, 637162356451, nick: "Remedy")
{:ok}
Link to this function

modify_guild_role(guild_id, role_id)

View Source

Modifies a guild role.

This endpoint requires the MANAGE_ROLES permission. It fires a Remedy.Consumer.guild_role_update/0 event.

An optional reason can be specified for the audit log.

If successful, returns {:ok, role}. Otherwise, returns a Remedy.API.error/0.

Options

  • :name (string) - name of the role
  • :permissions (integer) - bitwise of the enabled/disabled permissions
  • :color (integer) - RGB color value (default: 0)
  • :hoist (boolean) - whether the role should be displayed separately in the sidebar
  • :mentionable (boolean) - whether the role should be mentionable

Examples

iex> Remedy.API.modify_guild_role(41771983423143937, 392817238471936, hoist: false, name: "foo-bar")
Link to this function

modify_guild_role_positions(guild_id)

View Source

Reorders a guild's roles.

This endpoint requires the MANAGE_ROLES permission. It fires multiple Remedy.Consumer.guild_role_update/0 events.

If successful, returns {:ok, roles}. Otherwise, returns a Remedy.API.error/0.

positions is a list of maps that each map a role id with a position.

Examples

iex> Remedy.API.modify_guild_role_positions(41771983423143937, [%{id: 41771983423143936, position: 2}])
Link to this function

modify_guild_sticker(guild_id, sticker_id)

View Source (since 0.6.0)
Link to this function

modify_guild_template(guild_id, template_code)

View Source (since 0.6.0)
Link to this function

modify_guild_welcome_screen(guild_id)

View Source (since 0.6.0)
Link to this function

modify_message(channel_id, message_id)

View Source (since 0.6.0)

Edits a previously sent message in a channel.

Permissions

  • VIEW_CHANNEL

Events

  • :MESSAGE_UPDATE.

Options

  • :content (string) - the message contents (up to 2000 characters)
  • :embed (Remedy.Schema.Embed.t/0) - embedded rich content

Examples

iex> Remedy.API.modify_message(889614079830925352, 1894013840914098, content: "hello world!")
{:ok}

iex> Remedy.API.modify_message(889614079830925352, 1894013840914098, "hello world!")
{:ok}
Link to this function

modify_news_channel(channel_id, opts, reason \\ nil)

View Source

Modify a News Channel.

This function validates the options before passing them to Remedy.API.modify_channel/3

Permissions

  • MANAGE_CHANNELS
  • MANAGE_ROLES (If modifying permission overwrites)

Events:

  • :CHANNEL_UPDATE

Examples

iex> Remedy.API.modify_news_channel(872417560094732331, [{:name, "hello"}], "felt like it")
{:ok, %Channel{}}
Link to this function

modify_nickname(guild_id, nickname)

View Source

Modifies the nickname of the current user in a guild.

Options

  • :nick (string) - value to set users nickname to

Examples

iex> Remedy.API.modify_nickname(41771983423143937, nick: "Remedy")
{:ok, %{nick: "Remedy"}}

iex>
Link to this function

modify_original_interaction_response(interaction_token)

View Source (since 0.6.0)
Link to this function

modify_stage(channel_id)

View Source (since 0.6.0)
Link to this function

modify_text_channel(channel_id, opts, reason \\ nil)

View Source

Specs

modify_text_channel(Remedy.Schema.Channel.t() | snowflake(), opts(), reason()) ::
  {:error, any()} | {:ok, Remedy.Schema.Channel.t()}

Modify a Text Channel.

This function validates the options before passing them to Remedy.API.modify_channel/3

Permissions

  • MANAGE_CHANNELS
  • MANAGE_ROLES (If modifying permission overwrites)

Events:

  • :CHANNEL_UPDATE

Examples

iex> Remedy.API.modify_group_dm(872417560094732331, [{:name, "hello"}], "felt like it") {:ok, %Channel{}}

Link to this function

modify_thread(channel_id, opts, reason \\ nil)

View Source

Modify thread.

This function validates the options before passing them to Remedy.API.modify_channel/3

Permissions

  • MANAGE_THREADS
  • SEND_MESSAGES (If modifying permission overwrites)

Events:

  • :THREAD_UPDATE

Examples

iex> Remedy.API.modify_group_dm(872417560094732331, [{:name, "hello"}], "felt like it")
{:ok, %Channel{}}
Link to this function

modify_thread_test(opts)

View Source
Link to this function

modify_user_voice_state(guild_id, user_id)

View Source (since 0.6.0)
Link to this function

modify_voice_channel(channel_id, opts, reason \\ nil)

View Source

Modify a Voice Channel.

This function validates the options before passing them to Remedy.API.modify_channel/3

Permissions

  • MANAGE_CHANNELS
  • MANAGE_ROLES (If modifying permission overwrites)

Events:

  • :CHANNEL_UPDATE

Examples

iex> Remedy.API.voice_channel(872417560094732331, [{:name, "hello"}], "felt like it")
{:ok, %Channel{}}
Link to this function

modify_webhook(webhook_id)

View Source

Modifies a webhook.

Parameters

  • webhook_id - Id of the webhook to modify.
  • args - Map with the following optional keys:
    • name - Name of the webhook.
    • avatar - Base64 128x128 jpeg image for the default avatar.
  • reason - An optional reason for the guild audit log.
Link to this function

modify_webhook_message(webhook_id, webhook_token, message_id)

View Source (since 0.6.0)
Link to this function

modify_webhooks_with_token(webhook_id, webhook_token)

View Source

Modifies a webhook with a token.

This method is exactly like modify_webhook/1 but does not require authentication.

Parameters

  • webhook_id - Id of the webhook to modify.
  • webhook_token - Token of the webhook to get.
  • args - Map with the following optional keys:
    • name - Name of the webhook.
    • avatar - Base64 128x128 jpeg image for the default avatar.
  • reason - An optional reason for the guild audit log.
Link to this function

pin_message(channel_id, message_id)

View Source

Pins a message in a channel.

Permissions

  • 'VIEW_CHANNEL'

  • 'READ_MESSAGE_HISTORY'

  • 'MANAGE_MESSAGES'

  • :MESSAGE_UPDATE

  • :CHANNEL_PINS_UPDATE

Examples

iex> Remedy.API.add_pinned_channel_message(43189401384091, 18743893102394)
Link to this function

publish_message(message)

View Source (since 0.6.0)

Specs

publish_message(Remedy.Schema.Message.t()) :: {:error, any()} | {:ok, any()}

Publish a message in a news channel.

This will propagate a message out to all followers of the channel.

This is known as "Crosspost Message" in the Discord API.

Link to this function

publish_message(channel_id, message_id)

View Source
Link to this function

remove_guild_ban(guild_id, user_id)

View Source

Removes a ban for a user.

User to unban is specified by guild_id and user_id. An optional reason can be specified for the audit log.

Link to this function

remove_guild_member(guild_id, user_id)

View Source

Removes a member from a guild.

This event requires the KICK_MEMBERS permission. It fires a Remedy.Consumer.guild_member_remove/0 event.

An optional reason can be provided for the audit log with reason.

If successful, returns {:ok}. Otherwise, returns a Remedy.API.error/0.

Examples

iex> Remedy.API.remove_guild_member(1453827904102291, 18739485766253)
{:ok}
Link to this function

remove_guild_member_role(guild_id, user_id, role_id)

View Source

Removes a role from a member.

Role to remove is specified by role_id. User to remove role from is specified by guild_id and user_id. An optional reason can be given for the audit log.

Link to this function

remove_thread_member(channel_id, user_id)

View Source (since 0.6.0)
Link to this function

search_guild_members(guild_id)

View Source (since 0.6.0)
Link to this function

start_thread_with_message(channel_id, message_id)

View Source (since 0.6.0)

Starts a thread.

Link to this function

start_thread_without_message(channel_id)

View Source (since 0.6.0)
Link to this function

start_typing(channel_id)

View Source

Triggers the typing indicator.

Link to this function

sync_guild_from_template(guild_id, template_code)

View Source (since 0.6.0)
Link to this function

unpin_message(channel_id, message_id)

View Source

Unpins a message in a channel.

Permissions

  • 'VIEW_CHANNEL'
  • 'READ_MESSAGE_HISTORY'
  • 'MANAGE_MESSAGES'

Events

  • :MESSAGE_UPDATE
  • :CHANNEL_PINS_UPDATE

Examples

iex>