Discord::REST
Constants
Instance methods
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 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.
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.
Get a webhook, with a token.
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)
Nested types
- Discord::REST::ChannelParent
- Discord::REST::GatewayBotResponse
- Discord::REST::GatewayResponse
- Discord::REST::GuildVanityURLResponse
- Discord::REST::ModifyChannelPositionPayload
- Discord::REST::ModifyRolePositionPayload
- Discord::REST::PruneCountResponse
- Discord::REST::RateLimitKey
- Discord::REST::SessionStartLimit