module Discord::REST
Direct including types
Defined in:
discordcr/mappings/enums.crdiscordcr/mappings/rest.cr
discordcr/rest.cr
Constant Summary
-
API_BASE =
"https://discord.com/api/v6"
-
Log =
Discord::Log.for("rest")
-
SSL_CONTEXT =
OpenSSL::SSL::Context::Client.new
-
USER_AGENT =
"DiscordBot (https://github.com/discordcr/discordcr, #{Discord::VERSION})"
Instance Method Summary
-
#add_guild_member(guild_id : UInt64, user_id : UInt64, access_token : String, nick : String | Nil = nil, roles : Array(UInt64) | Nil = nil, mute : Bool | Nil = nil, deaf : Bool | Nil = nil)
Adds a user to the guild, provided you have a valid OAuth2 access token for the user with the
guilds.join
scope. -
#add_guild_member_role(guild_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake, role_id : UInt64 | Snowflake)
Adds a role to a member.
-
#add_pinned_channel_message(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake)
Pins a new message to this channel.
-
#begin_guild_prune(guild_id : UInt64 | Snowflake, days : UInt32, reason : String | Nil = nil)
Prunes all members from this guild which haven't been seen for more than days days.
-
#bulk_delete_messages(channel_id : UInt64 | Snowflake, message_ids : Array(UInt64 | Snowflake))
Deletes multiple messages at once from the channel.
-
#create_channel_invite(channel_id : UInt64 | Snowflake, max_age : UInt32 = 0_u32, max_uses : UInt32 = 0_u32, temporary : Bool = false)
Creates a new invite for the channel.
-
#create_channel_webhook(channel_id : UInt64 | Snowflake, name : String, avatar : String)
Create a channel webhook.
-
#create_dm(recipient_id : UInt64 | Snowflake)
Creates a new DM channel with a given recipient.
-
#create_guild_ban(guild_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake, delete_message_days : Int32 | Nil = nil, reason : String | Nil = nil)
Bans a member from the guild.
-
#create_guild_channel(guild_id : UInt64 | Snowflake, name : String, type : ChannelType, topic : String | Nil, bitrate : UInt32 | Nil, user_limit : UInt32 | Nil, rate_limit_per_user : Int32 | Nil, position : UInt32 | Nil, parent_id : UInt64 | Nil | Snowflake | Nil, nsfw : Bool | Nil, reason : String | Nil = nil)
Creates a new channel on this guild.
-
#create_guild_emoji(guild_id : UInt64 | Snowflake, name : String, image : String)
Creates a guild emoji.
-
#create_guild_integration(guild_id : UInt64 | Snowflake, type : String, id : UInt64 | Snowflake)
Creates a new integration for this guild.
-
#create_guild_role(guild_id : UInt64 | Snowflake, name : String | Nil = nil, permissions : Permissions | Nil = nil, colour : UInt32 = 0_u32, hoist : Bool = false, mentionable : Bool = false, reason : String | Nil = nil)
Creates a new role on the guild.
-
#create_message(channel_id : UInt64 | Snowflake, content : String, embed : Embed | Nil = nil, tts : Bool = false, nonce : Int64 | String | Nil = nil)
Sends a message to the channel.
-
#create_reaction(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake, emoji : String)
Adds a reaction to a message.
-
#create_stage_instance(channel_id : UInt64 | Snowflake, topic : String, privacy_level : StagePrivacyLevel = StagePrivacyLevel::GUILD_ONLY)
Creates a new Stage instance associated to a Stage channel.
-
#delete_all_reactions(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake)
Removes all reactions from a message.
-
#delete_channel(channel_id : UInt64 | Snowflake)
Deletes a channel by ID.
-
#delete_channel_permission(channel_id : UInt64 | Snowflake, overwrite_id : UInt64 | Snowflake)
Deletes a permission overwrite from a channel.
-
#delete_guild(guild_id : UInt64 | Snowflake)
Deletes a guild.
-
#delete_guild_emoji(guild_id : UInt64 | Snowflake, emoji_id : UInt64 | Snowflake)
Deletes a guild emoji.
-
#delete_guild_integration(guild_id : UInt64 | Snowflake, integration_id : UInt64 | Snowflake)
Deletes a guild integration.
-
#delete_guild_role(guild_id : UInt64 | Snowflake, role_id : UInt64 | Snowflake, reason : String | Nil = nil)
Deletes a role.
-
#delete_invite(code : String, reason : String | Nil = nil)
Deletes (revokes) an invite.
-
#delete_message(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake)
Deletes a message from the channel.
-
#delete_own_reaction(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake, emoji : String)
Removes the bot's own reaction from a message.
-
#delete_pinned_channel_message(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake)
Unpins a message from this channel.
-
#delete_reaction(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake, emoji : String)
Removes all reactions for a given emoji from a message.
-
#delete_stage_instance(channel_id : UInt64 | Snowflake)
Deletes the Stage instance associated with the passed Stage channel.
-
#delete_user_reaction(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake, emoji : String, user_id : UInt64 | Snowflake)
Removes another user's reaction from a message.
-
#delete_webhook(webhook_id : UInt64 | Snowflake, token : String)
Deletes a webhook with a token.
-
#delete_webhook(webhook_id : UInt64 | Snowflake)
Deletes a webhook.
-
#edit_channel_permissions(channel_id : UInt64 | Snowflake, overwrite_id : UInt64 | Snowflake, type : String, allow : Permissions, deny : Permissions)
Edits an existing permission overwrite on a channel with new permissions, or creates a new one.
-
#edit_message(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake, content : String, embed : Embed | Nil = nil)
Edits an existing message on the channel.
-
#execute_webhook(webhook_id : UInt64 | Snowflake, token : String, content : String | Nil = nil, file : String | Nil = nil, embeds : Array(Embed) | Nil = nil, tts : Bool | Nil = nil, avatar_url : String | Nil = nil, username : String | Nil = nil, wait : Bool | Nil = false)
Executes a webhook, with a token.
-
#get_channel(channel_id : UInt64 | Snowflake)
Gets a channel by ID.
-
#get_channel_invites(channel_id : UInt64 | Snowflake)
Gets a list of invites for this channel.
-
#get_channel_message(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake)
Gets a single message from the channel's history.
-
#get_channel_messages(channel_id : UInt64 | Snowflake, limit : Int32 = 50, before : UInt64 | Snowflake | Nil = nil, after : UInt64 | Snowflake | Nil = nil, around : UInt64 | Snowflake | Nil = nil)
Gets a list of messages from the channel's history.
-
#get_channel_webhooks(channel_id : UInt64 | Snowflake)
Get an array of channel webhooks.
-
#get_current_user
Gets the current bot user.
-
#get_current_user_guilds(limit : Int32 = 100, before : UInt64 | Snowflake = 0_u64, after : UInt64 | Snowflake = 0_u64)
Gets a list of user guilds the current user is on.
-
#get_gateway
Gets the gateway URL to connect to.
-
#get_gateway_bot
Gets the gateway Bot URL to connect to, and the recommended amount of shards to make.
-
#get_guild(guild_id : UInt64 | Snowflake)
Gets a guild by ID.
-
#get_guild_ban(guild_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake, reason : String | Nil = nil)
Returns information about a banned user in a guild.
-
#get_guild_bans(guild_id : UInt64 | Snowflake)
Gets a list of members banned from this server.
-
#get_guild_channels(guild_id : UInt64 | Snowflake)
Gets a list of channels in a guild.
-
#get_guild_embed(guild_id : UInt64 | Snowflake)
Gets embed data for a guild.
-
#get_guild_emoji(guild_id : UInt64 | Snowflake, emoji_id : UInt64 | Snowflake)
Gets a specific emoji by guild ID and emoji ID.
-
#get_guild_integrations(guild_id : UInt64 | Snowflake)
Gets a list of integrations (Twitch, YouTube, etc.) for this guild.
-
#get_guild_member(guild_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake)
Gets a specific member by both IDs.
-
#get_guild_prune_count(guild_id : UInt64 | Snowflake, days : UInt32)
Get a number of members that would be pruned with the given number of days.
-
#get_guild_roles(guild_id : UInt64 | Snowflake)
Get a list of roles on the guild.
-
#get_guild_vanity_url(guild_id : UInt64 | Snowflake)
Gets the vanity URL of a guild.
-
#get_guild_voice_regions(guild_id : UInt64 | Snowflake)
Gets a list of voice regions available for this guild.
-
#get_guild_webhooks(guild_id : UInt64 | Snowflake)
Get an array of guild webhooks.
-
#get_invite(code : String)
Gets a specific invite by its code.
-
#get_oauth2_application
Gets the OAuth2 application tied to a client.
-
#get_pinned_messages(channel_id : UInt64 | Snowflake)
Get a list of messages pinned to this channel.
-
#get_reactions(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake, emoji : String)
Returns all users that have reacted with a specific emoji.
-
#get_stage_instance(channel_id : UInt64 | Snowflake)
Gets the Stage instance associated with the passed Stage channel if it exists.
-
#get_user(user_id : UInt64 | Snowflake)
Gets a specific user by ID.
-
#get_user_connections
Gets a list of connections the user has set up (Twitch, YouTube, etc.)
-
#get_user_dms
Gets a list of DM channels the bot has access to.
-
#get_webhook(webhook_id : UInt64 | Snowflake, token : String)
Get a webhook, with a token.
-
#get_webhook(webhook_id : UInt64 | Snowflake)
Get a webhook.
-
#leave_guild(guild_id : UInt64 | Snowflake)
Makes the bot leave a guild.
-
#list_guild_emojis(guild_id : UInt64 | Snowflake)
Gets a list of emoji on the guild.
-
#list_guild_members(guild_id : UInt64 | Snowflake, limit : Int32 = 1000, after : UInt64 | Snowflake = 0_u64)
Gets multiple guild members at once.
-
#list_voice_regions
Gets a list of voice regions newly created servers have access to.
-
#modify_channel(channel_id : UInt64 | Snowflake, name : String | Nil = nil, position : UInt32 | Nil = nil, topic : String | Nil = nil, bitrate : UInt32 | Nil = nil, user_limit : UInt32 | Nil = nil, nsfw : Bool | Nil = nil, rate_limit_per_user : Int32 | Nil = nil)
Modifies a channel with new properties.
-
#modify_current_user(username : String | Nil = nil, avatar : String | Nil = nil)
Modifies the current bot user, changing the username and avatar.
-
#modify_current_user_nick(guild_id : UInt64, nick : String)
Modifies the nickname of the current user in a guild.
-
#modify_guild(guild_id : UInt64 | Snowflake, name : String | Nil = nil, region : String | Nil = nil, verification_level : UInt8 | Nil = nil, afk_channel_id : UInt64 | Snowflake | Nil = nil, afk_timeout : Int32 | Nil = nil, icon : String | Nil = nil, owner_id : UInt64 | Snowflake | Nil = nil, splash : String | Nil = nil, reason : String | Nil = nil)
Modifies an existing guild with new properties.
-
#modify_guild_channel_positions(guild_id : UInt64 | Snowflake, positions : Array(ModifyChannelPositionPayload))
Modifies the position of channels within a guild.
-
#modify_guild_embed(guild_id : UInt64 | Snowflake, enabled : Bool, channel_id : UInt64 | Snowflake)
Modifies embed data for a guild.
-
#modify_guild_emoji(guild_id : UInt64 | Snowflake, emoji_id : UInt64 | Snowflake, name : String)
Modifies a guild emoji.
-
#modify_guild_integration(guild_id : UInt64 | Snowflake, integration_id : UInt64 | Snowflake, expire_behaviour : UInt8, expire_grace_period : Int32, enable_emoticons : Bool)
Modifies an existing guild integration.
-
#modify_guild_member(guild_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake, nick : String | Nil = nil, roles : Array(UInt64 | Snowflake) | Nil = nil, mute : Bool | Nil = nil, deaf : Bool | Nil = nil, channel_id : UInt64 | Snowflake | Nil = nil, reason : String | Nil = nil)
Changes a specific member's properties.
-
#modify_guild_role(guild_id : UInt64 | Snowflake, role_id : UInt64 | Snowflake, name : String | Nil = nil, permissions : Permissions | Nil = nil, colour : UInt32 | Nil = nil, position : Int32 | Nil = nil, hoist : Bool | Nil = nil, reason : String | Nil = nil)
Changes a role's properties.
-
#modify_guild_role_positions(guild_id : UInt64 | Snowflake, positions : Array(ModifyRolePositionPayload))
Changes the position of roles.
-
#modify_guild_vanity_url(guild_id : UInt64 | Snowflake, code : String)
Sets the vanity URL on this guild.
-
#modify_voice_state(guild_id : UInt64 | Snowflake, channel_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake | Nil = nil, suppress : Bool | Nil = nil, request_to_speak_timestamp : Time | Nil = nil)
Updates the current user's, or passed user's voice state.
-
#modify_webhook(webhook_id : UInt64 | Snowflake, name : String | Nil = nil, avatar : String | Nil = nil, channel_id : UInt64 | Snowflake | Nil = nil)
Modify a webhook.
-
#modify_webhook_with_token(webhook_id : UInt64 | Snowflake, token : String, name : String | Nil = nil, avatar : String | Nil = nil)
Modify a webhook, with a token.
-
#page_channel_messages(channel_id : UInt64 | Snowflake, start_id : UInt64 | Snowflake = 0_u64, limit : Int32 | Nil = 100, direction : Paginator::Direction = Paginator::Direction::Down, page_size : Int32 = 100)
Returns a
Paginator
over a channel's message history. -
#page_current_user_guilds(start_id : UInt64 | Snowflake = 0_u64, limit : Int32 | Nil = 100, direction : Paginator::Direction = Paginator::Direction::Down, page_size : Int32 = 100)
Returns a
Paginator
over the current users guilds. -
#page_guild_members(guild_id : UInt64 | Snowflake, start_id : UInt64 | Snowflake = 0_u64, limit : Int32 | Nil = 1000, page_size : Int32 = 1000)
Returns a
Paginator
over the given guilds members. -
#raw_request(route_key : Symbol, major_parameter : Snowflake | UInt64 | Nil, method : String, path : String, headers : HTTP::Headers, body : String | Nil)
Like
#request
, but does not do error checking beyond 429. -
#remove_guild_ban(guild_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake, reason : String | Nil = nil)
Unbans a member from the guild.
-
#remove_guild_member(guild_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake, reason : String | Nil = nil)
Kicks a member from the server.
-
#remove_guild_member_role(guild_id : UInt64, user_id : UInt64, role_id : UInt64)
Removes a role from a member.
-
#request(route_key : Symbol, major_parameter : Snowflake | UInt64 | Nil, method : String, path : String, headers : HTTP::Headers, body : String | Nil)
Makes a REST request to Discord, with the given method to the given path, with the given headers set and with the given body being sent.
-
#sync_guild_integration(guild_id : UInt64 | Snowflake, integration_id : UInt64 | Snowflake)
Syncs an integration.
-
#trigger_typing_indicator(channel_id : UInt64 | Snowflake)
Causes the bot to appear as typing on the channel.
-
#update_stage_instance(channel_id : UInt64 | Snowflake, topic : String | Nil = nil, privacy_level : StagePrivacyLevel | Nil = nil)
Updates fields of an existing Stage instance.
-
#upload_file(channel_id : UInt64 | Snowflake, content : String | Nil, file : IO, filename : String | Nil = nil, embed : Embed | Nil = nil, spoiler : Bool = false)
Uploads a file to a channel.
Instance Method Detail
Adds a user to the guild, provided you have a valid OAuth2 access token
for the user with the guilds.join
scope.
NOTE The bot must be a member of the target guild, and have permissions to create instant invites.
Adds a role to a member. Requires the "Manage Roles" permission.
Pins a new message to this channel. Requires the "Manage Messages" permission.
Prunes all members from this guild which haven't been seen for more than days days. Requires the "Kick Members" permission.
Deletes multiple messages at once from the channel. The maximum amount is 100 messages, the minimum is 2. Requires the "Manage Messages" permission.
Creates a new invite for the channel. Requires the "Create Instant Invite" permission.
Create a channel webhook.
Creates a new DM channel with a given recipient. If there was already one before, it will be reopened.
Bans a member from the guild. Requires the "Ban Members" permission.
Creates a new channel on this guild. Requires the "Manage Channels" permission.
Creates a guild emoji. Requires the "Manage Emojis" permission.
Creates a new integration for this guild. Requires the "Manage Guild" permission.
Creates a new role on the guild. Requires the "Manage Roles" permission.
Sends a message to the channel. Requires the "Send Messages" permission.
The embed
parameter can be used to append a rich embed to the message
which allows for displaying certain kinds of data in a more structured
way. An example:
embed = Discord::Embed.new(
title: "Title of Embed",
description: "Description of embed. This can be a long text. Neque porro quisquam est, qui dolorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem.",
timestamp: Time.utc,
url: "https://example.com",
image: Discord::EmbedImage.new(
url: "https://example.com/image.png",
),
fields: [
Discord::EmbedField.new(
name: "Name of Field",
value: "Value of Field",
),
],
)
client.create_message(channel_id, "The content of the message. This will display separately above the embed. This string can be empty.", embed)
For more details on the format of the embed
object, look at the
relevant documentation.
Adds a reaction to a message. The emoji
property must be in the format
name:id
for custom emoji. For Unicode emoji it can simply be the UTF-8
encoded characters.
Requires the "Read Message History" permission and additionally
the "Add Reactions" permission if no one has reacted with this emoji yet.
Creates a new Stage instance associated to a Stage channel.
Removes all reactions from a message. Requires the "Manage Messages" permission.
Deletes a channel by ID. Requires the "Manage Channel" permission.
Deletes a permission overwrite from a channel. Requires the "Manage Permissions" permission.
Deletes a guild. Requires the bot to be the server owner.
Deletes a guild emoji. Requires the "Manage Emojis" permission.
Deletes a guild integration. Requires the "Manage Guild" permission.
Deletes a role. Requires the "Manage Roles" permission as well as the role to be lower than the bot's highest role.
Deletes (revokes) an invite. Requires the "Manage Channel" permission for the channel the invite is for, or the "Manage Server" permission for the server.
Deletes a message from the channel. Requires the message to either have been sent by the bot itself or the bot to have the "Manage Messages" permission.
Removes the bot's own reaction from a message. The emoji
property must
be in the format name:id
for custom emoji. For unicode emoji it can
simply be the UTF-8 encoded characters.
Unpins a message from this channel. Requires the "Manage Messages" permission.
Removes all reactions for a given emoji from a message. Requires the "Manage Messages" permission.
Deletes the Stage instance associated with the passed Stage channel.
Removes another user's reaction from a message. The emoji
property must
be in the format name:id
for custom emoji. For unicode emoji it can
simply be the UTF-8 encoded characters. Requires the "Manage Messages"
permission.
Deletes a webhook with a token. Does not require authentication.
Deletes a webhook. User must be owner.
Edits an existing permission overwrite on a channel with new permissions, or creates a new one. The overwrite_id should be either a user or a role ID. Requires the "Manage Roles" permission.
Edits an existing message on the channel. This only works for messages sent by the bot itself - you can't edit others' messages.
Executes a webhook, with a token.
Gets a channel by ID.
Gets a list of invites for this channel. Requires the "Manage Channel" permission.
Gets a single message from the channel's history. Requires the "Read Message History" permission.
Gets a list of messages from the channel's history. Requires the "Read Message History" permission.
Get an array of channel webhooks.
Gets a list of user guilds the current user is on.
Gets the gateway Bot URL to connect to, and the recommended amount of shards to make.
Gets a guild by ID.
Returns information about a banned user in a guild. Requires the "Ban Members" permission.
Gets a list of members banned from this server. Requires the "Ban Members" permission.
Gets a list of channels in a guild.
Gets embed data for a guild. Requires the "Manage Guild" permission.
Gets a specific emoji by guild ID and emoji ID.
Gets a list of integrations (Twitch, YouTube, etc.) for this guild. Requires the "Manage Guild" permission.
Gets a specific member by both IDs.
Get a number of members that would be pruned with the given number of days. Requires the "Kick Members" permission.
Get a list of roles on the guild.
Gets the vanity URL of a guild. Requires the guild to be partnered.
There are no API docs for this method.
Gets a list of voice regions available for this guild. This may include VIP regions for VIP servers.
Get an array of guild webhooks.
Get a list of messages pinned to this channel.
Returns all users that have reacted with a specific emoji.
Gets the Stage instance associated with the passed Stage channel if it exists.
Gets a specific user by ID.
Get a webhook, with a token.
Get a webhook.
Makes the bot leave a guild.
Gets a list of emoji on the guild.
Gets multiple guild members at once. The limit can be at most 1000. The resulting list will be sorted by user IDs, use the after parameter to specify what ID to start at.
Modifies a channel with new properties. Requires the "Manage Channel" permission.
Modifies the current bot user, changing the username and avatar.
NOTE To remove the current user's avatar, you can send an empty string for the avatar
argument.
Modifies the nickname of the current user in a guild.
NOTE To remove a nickname, you can send an empty string for the nick
argument.
Modifies an existing guild with new properties. Requires the "Manage Server" permission.
NOTE To remove a guild's icon, you can send an empty string for the icon
argument.
Modifies the position of channels within a guild. Requires the "Manage Channels" permission.
Modifies embed data for a guild. Requires the "Manage Guild" permission.
Modifies a guild emoji. Requires the "Manage Emojis" permission.
Modifies an existing guild integration. Requires the "Manage Guild" permission.
Changes a specific member's properties. Requires:
- the "Manage Roles" permission and the role to change to be lower than the bot's highest role if changing the roles,
- the "Manage Nicknames" permission when changing the nickname,
- the "Mute Members" permission when changing mute status,
- the "Deafen Members" permission when changing deaf status,
- and the "Move Members" permission as well as the "Connect" permission to the new channel when changing voice channel ID.
NOTE To remove a member's nickname, you can send an empty string for the nick
argument.
Changes a role's properties. Requires the "Manage Roles" permission as well as the role to be lower than the bot's highest role.
Changes the position of roles. Requires the "Manage Roles" permission and you cannot raise roles above the bot's highest role.
Sets the vanity URL on this guild. Requires the guild to be partnered.
There are no API docs for this method.
Updates the current user's, or passed user's voice state. For use with Stage Channels only. The user that is being updated must be inside of the stage channel. Requires "MUTE_MEMBERS" to (un)suppress other members, you can always suppress yourself. Requires "REQUEST_TO_SPEAK" to request to speak.
Modify a webhook. Accepts optional parameters name
, avatar
, and channel_id
.
Modify a webhook, with a token. Accepts optional parameters name
, avatar
, and channel_id
.
Returns a Paginator
over a channel's message history. Requires the
"Read Message History" permission. See #get_channel_messages
.
Will yield a channels message history in the given direction
starting at
start_id
until limit
number of messages are observed, or the channel has
no further history. Setting limit
to nil
will have the paginator continue
to make requests until all messages are fetched in the given direction
.
Returns a Paginator
over the current users guilds.
Will yield guilds in the given direction
starting at start_id
until
limit
number of guilds are observed, or the user has no further guilds.
Setting limit
to nil
will have the paginator continue to make requests
until all guilds are fetched in the given direction
.
Returns a Paginator
over the given guilds members.
Will yield members starting at start_id
until limit
number of members
guilds are observed, or the user has no further guilds. Setting limit
to nil
will have the paginator continue to make requests until all members
are fetched.
Like #request
, but does not do error checking beyond 429.
Unbans a member from the guild. Requires the "Ban Members" permission.
Kicks a member from the server. Requires the "Kick Members" permission.
Removes a role from a member. Requires the "Manage Roles" permission.
Makes a REST request to Discord, with the given method to the given path, with the given headers set and with the given body being sent. The route_key should uniquely identify the route used, for rate limiting purposes. The major_parameter should be set to the guild or channel ID, if either of those appears as the first parameter in the route.
This method also does rate limit handling, so if a rate limit is encountered, it may take longer than usual. (In case you're worried, this won't block events from being processed.) It also performs other kinds of error checking, so if a request fails (with a status code that is not 429) you will be notified of that.
Syncs an integration. Requires the "Manage Guild" permission.
Causes the bot to appear as typing on the channel. This generally lasts 10 seconds, but should be refreshed every five seconds. Requires the "Send Messages" permission.
Updates fields of an existing Stage instance.
Uploads a file to a channel. Requires the "Send Messages" and "Attach Files" permissions.
If the specified file
is a File
object and no filename is specified,
the file's filename will be used instead. If it is an IO
without
filename information, Discord will generate a placeholder filename.
API docs for this method
(same as #create_message
-- this method implements form data bodies
while #create_message
implements JSON bodies)