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/v9"
-
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, roles : Array(UInt64)? = nil, mute : Bool? = nil, deaf : Bool? = 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.
-
#add_thread_member(channel_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake)
Add Thread Member Adds another member to a thread.
-
#begin_guild_prune(guild_id : UInt64 | Snowflake, days : UInt32, reason : String? = 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, reason : String? = 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? | Snowflake? = nil, nsfw : Bool? = nil, reason : String? = 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, permissions : Permissions? = nil, colour : UInt32 = 0_u32, hoist : Bool = false, mentionable : Bool = false, reason : String? = nil)
Creates a new role on the guild.
-
#create_message(channel_id : UInt64 | Snowflake, content : String, embed : Embed? = nil, tts : Bool = false, nonce : Int64 | String? = nil, allowed_mentions : AllowedMentions? = nil, message_reference : MessageReference? = nil, embeds : Array(Embed)? = 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)
Deletes a role.
-
#delete_invite(code : String, reason : String? = 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, allowed_mentions : AllowedMentions? = nil)
Edits an existing message on the channel.
-
#execute_webhook(webhook_id : UInt64 | Snowflake, token : String, content : String? = nil, file : IO? = nil, filename : String? = nil, embeds : Array(Embed)? = nil, tts : Bool? = nil, avatar_url : String? = nil, username : String? = nil, allowed_mentions : AllowedMentions? = nil, wait : Bool? = false, thread_id : UInt64 | Snowflake? = nil)
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)
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.
-
#join_thread(channel_id : UInt64 | Snowflake)
Join Thread Adds the current user to a thread.
-
#leave_guild(guild_id : UInt64 | Snowflake)
Makes the bot leave a guild.
-
#leave_thread(channel_id : UInt64 | Snowflake)
Leave Thread Removes the current user from a thread.
-
#list_active_threads(guild_id : UInt64 | Snowflake)
List Active Threads
-
#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_joined_private_threads(channel_id : UInt64 | Snowflake, before : Time? = nil, limit : Int32? = nil)
List Joined Private Archived Threads
-
#list_private_archived_threads(channel_id : UInt64 | Snowflake, before : Time? = nil, limit : Int32? = nil)
List Private Archived Threads Returns archived threads in the channel that are of type GUILD_PRIVATE_THREAD.
-
#list_public_archived_threads(channel_id : UInt64 | Snowflake, before : Time? = nil, limit : Int32? = nil)
List Public Archived Threads Returns archived threads in the channel that are public.
-
#list_thread_members(channel_id : UInt64 | Snowflake)
List Thread Members
-
#list_voice_regions
Gets a list of voice regions newly created servers have access to.
-
#modify_channel(channel_id : UInt64 | Snowflake, name : String? = nil, position : UInt32? = nil, topic : String? = nil, bitrate : UInt32? = nil, user_limit : UInt32? = nil, nsfw : Bool? = nil, rate_limit_per_user : Int32? = nil, default_auto_archive_duration : AutoArchiveDuration? = nil, archived : Bool? = nil, locked : Bool? = nil, invitable : Bool? = nil, video_quality_mode : VideoQualityMode? = nil, rtc_region : String? = nil)
Modifies a channel with new properties.
-
#modify_current_user(username : String? = nil, avatar : String? = 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, region : String? = nil, verification_level : UInt8? = nil, afk_channel_id : UInt64 | Snowflake | Nil = nil, afk_timeout : Int32? = nil, icon : String? = nil, owner_id : UInt64 | Snowflake | Nil = nil, splash : String? = nil, reason : String? = 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, roles : Array(UInt64 | Snowflake)? = nil, mute : Bool? = nil, deaf : Bool? = nil, channel_id : UInt64 | Snowflake | Nil = nil, communication_disabled_until : Time? = nil, reason : String? = nil)
Changes a specific member's properties.
-
#modify_guild_role(guild_id : UInt64 | Snowflake, role_id : UInt64 | Snowflake, name : String? = nil, permissions : Permissions? = nil, colour : UInt32? = nil, position : Int32? = nil, hoist : Bool? = nil, reason : String? = 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, request_to_speak_timestamp : Time? = nil)
Updates the current user's, or passed user's voice state.
-
#modify_webhook(webhook_id : UInt64 | Snowflake, name : String? = nil, avatar : String? = nil, channel_id : UInt64 | Snowflake | Nil = nil)
Modify a webhook.
-
#modify_webhook_with_token(webhook_id : UInt64 | Snowflake, token : String, name : String? = nil, avatar : String? = nil)
Modify a webhook, with a token.
-
#page_channel_messages(channel_id : UInt64 | Snowflake, start_id : UInt64 | Snowflake = 0_u64, limit : Int32? = 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? = 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? = 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?)
Like
#request
, but does not do error checking beyond 429. -
#remove_guild_ban(guild_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake, reason : String? = nil)
Unbans a member from the guild.
-
#remove_guild_member(guild_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake, reason : String? = 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.
-
#remove_thread_member(channel_id : UInt64 | Snowflake, user_id : UInt64 | Snowflake)
Remove Thread Member Removes another member from a thread.
-
#request(route_key : Symbol, major_parameter : Snowflake | UInt64 | Nil, method : String, path : String, headers : HTTP::Headers, body : String?)
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.
-
#start_thread(channel_id : UInt64 | Snowflake, message_id : UInt64 | Snowflake, name : String, auto_archive_duration : AutoArchiveDuration, reason : String? = nil)
Start Thread from existing message When called on a GUILD_TEXT channel, creates a GUILD_PUBLIC_THREAD.
-
#start_thread(channel_id : UInt64 | Snowflake, name : String, auto_archive_duration : AutoArchiveDuration, type : ChannelType? = ChannelType::GuildPublicThread, invitable : Bool? = nil, reason : String? = nil)
Start Thread without Message Creates a new thread that is not connected to an existing message.
-
#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, privacy_level : StagePrivacyLevel? = nil)
Updates fields of an existing Stage instance.
-
#upload_file(channel_id : UInt64 | Snowflake, content : String?, file : IO, filename : String? = nil, embed : Embed? = nil, allowed_mentions : AllowedMentions? = 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.
Add Thread Member Adds another member to a thread. Requires the ability to send messages in the thread. Also requires the thread is not archived.
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 embeds
parameter can be used to display up to 10 rich embeds to a message,
which allows for displaying certain kinds of data in a more structured way.
The embed
field can be used to display only one rich embed, but this is deprecated
and will be removed in a later version. Use embeds
instead.
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.", embeds: [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, or "Manage Threads" if the channel is a thread.
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.
Join Thread Adds the current user to a thread. Also requires the thread is not archived.
Makes the bot leave a guild.
Leave Thread Removes the current user from a thread. Also requires the thread is not archived.
List Active Threads
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.
List Joined Private Archived Threads
List Private Archived Threads Returns archived threads in the channel that are of type GUILD_PRIVATE_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires both the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.
List Public Archived Threads Returns archived threads in the channel that are public. When called on a GUILD_TEXT channel, returns threads of type GUILD_PUBLIC_THREAD. When called on a GUILD_NEWS channel returns threads of type GUILD_NEWS_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires the READ_MESSAGE_HISTORY permission.
List Thread Members
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.
To remove a member's nickname, you can send an empty string for the nick
argument.
To set or remove a timeout, you must have the MANAGE_MEMBERS
permission.
The communication_disabled_until
argument takes a time up to 28 days in the future, or nil to remove.
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.
Remove Thread Member Removes another member from a thread. Requires the MANAGE_THREADS permission, or the creator of the thread if it is a GUILD_PRIVATE_THREAD. Also requires the thread is not archived.
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.
Start Thread from existing message When called on a GUILD_TEXT channel, creates a GUILD_PUBLIC_THREAD. When called on a GUILD_NEWS channel, creates a GUILD_NEWS_THREAD. The id of the created thread will be the same as the id of the message, and as such a message can only have a single thread created from it.
Start Thread without Message Creates a new thread that is not connected to an existing message.
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)