Module serenity::client::rest
[−]
[src]
The HTTP module which provides functions for performing requests to endpoints in Discord's API.
An important function of the REST API is ratelimiting. Requests to endpoints are ratelimited to prevent spam, and once ratelimited Discord will stop performing requests. The library implements protection to pre-emptively ratelimit, to ensure that no wasted requests are made.
The HTTP module comprises of two types of requests:
- REST API requests, which require an authorization token;
- Other requests, which do not require an authorization token.
The former require a Client
to have logged in, while the latter may be
made regardless of any other usage of the library.
If a request spuriously fails, it will be retried once.
Note that you may want to perform requests through a Context
or through
models' instance methods where possible, as they each offer different
levels of a high-level interface to the HTTP module.
Functions
accept_invite |
Accepts the |
ack_message |
Marks a |
add_group_recipient | |
add_member_role | |
ban_user |
Bans a |
broadcast_typing |
Broadcasts that the current user is typing in the given |
create_channel |
Creates a |
create_emoji |
Creates an emoji in the given |
create_guild |
Creates a guild with the data provided. |
create_guild_integration |
Creates an |
create_invite |
Creates a |
create_permission |
Creates a permission override for a member or a role in a channel. |
create_private_channel |
Creates a private channel with a user. |
create_reaction |
Reacts to a message. |
create_role |
Creates a role. |
create_webhook |
Creates a webhook for the given channel's Id, passing in the given data. |
delete_channel |
Deketes a private channel or a channel in a guild. |
delete_emoji |
Deletes an emoji from a server. |
delete_guild |
Deletes a guild, only if connected account owns it. |
delete_guild_integration |
Remvoes an integration from a guild. |
delete_invite |
Deletes an invite by code. |
delete_message |
Deletes a message if created by us or we have specific permissions. |
delete_message_reactions | |
delete_messages |
Deletes a bunch of messages, only works for bots. |
delete_permission |
Deletes a permission override from a role or a member in a channel. |
delete_reaction |
Deletes a reaction from a message if owned by us or we have specific permissions. |
delete_role |
Deletes a role from a server. Can't remove the default everyone role. |
delete_webhook |
Deletes a |
delete_webhook_with_token |
Deletes a |
edit_channel |
Changes channel information. |
edit_emoji |
Changes emoji information. |
edit_guild |
Changes guild information. |
edit_guild_embed |
Edits a |
edit_member |
Does specific actions to a member. |
edit_message |
Changes message content, only if owned by us. |
edit_nickname |
Edits the current user's nickname for the provided |
edit_note |
Changes a profile note. |
edit_profile |
Edits profile we're connected to. |
edit_role |
Changes a role in a guild. |
edit_webhook |
Edits a the webhook with the given data. |
edit_webhook_with_token |
Edits the webhook with the given data. |
execute_webhook |
Executes a webhook, posting a [ |
get_active_maintenances |
Gets the active maintenances from Discord's Status API. |
get_application_info |
Gets information about an oauth2 application we own. |
get_applications |
Gets all oauth2 applications we've made. |
get_bans |
Gets all the users that are banned in specific guild. |
get_bot_gateway |
Gets current bot gateway. |
get_channel |
Gets channel information. |
get_channel_invites |
Gets all invites for a channel. |
get_channel_webhooks |
Retrieves the webhooks for the given channel's Id. |
get_channels |
Gets all channels in a guild. |
get_current_user |
Gets information about the user we're connected with. |
get_emoji |
Gets information about an emoji. |
get_emojis |
Gets all emojis in a guild. |
get_gateway |
Gets current gateway. |
get_guild |
Gets guild information. |
get_guild_embed |
Gets a guild embed information. |
get_guild_integrations |
Gets integrations that a guild has. |
get_guild_invites |
Gets all invites to a guild. |
get_guild_members |
Gets the members of a guild. Optionally pass a |
get_guild_prune_count |
Gets the amount of users that can be pruned. |
get_guild_regions |
Gets regions that a guild can use. If a guild has |
get_guild_roles |
Retrieves a list of roles in a |
get_guild_webhooks |
Retrieves the webhooks for the given guild's Id. |
get_guilds |
Gets all guilds we're connected to. |
get_invite |
Gets information about a specific invite. |
get_member |
Gets member of a guild. |
get_message |
Gets a message by an Id, bots only. |
get_messages |
Gets X messages from a channel. |
get_pins |
Gets all pins of a channel. |
get_reaction_users |
Gets user Ids based on their reaction to a message. This endpoint is dumb. |
get_unresolved_incidents |
Gets the current unresolved incidents from Discord's Status API. |
get_upcoming_maintenances |
Gets the upcoming (planned) maintenances from Discord's Status API. |
get_user |
Gets a user by Id. |
get_user_connections |
Gets our connections. |
get_user_dm_channels |
Gets our DM channels. |
get_voice_regions |
Gets all voice regions. |
get_webhook |
Retrieves a webhook given its Id. |
get_webhook_with_token |
Retrieves a webhook given its Id and unique token. |
kick_member |
Kicks a member from a guild. |
leave_group |
Leaves a group DM. |
leave_guild |
Leaves a guild. |
logout |
Logs out. That's supposed to disable the token but doesn't. |
pin_message |
Pins a message in a channel. |
remove_ban |
Unbans a user from a guild. |
remove_group_recipient |
Deletes a user from group DM. |
remove_member_role | |
send_file |
Sends a file to a channel. |
send_message |
Sends a message to a channel. |
start_guild_prune |
Starts removing some members from a guild based on the last time they've been online. |
start_integration_sync |
Adds an integration to a guild. |
unpin_message |
Unpins a message from a channel. |