gaato/discord/http does not have a README file

HttpMiddleware

type HttpMiddleware = async (HttpRequest, async (HttpRequest) -> HttpResponse) -> HttpResponse

Middleware around each HTTP request: receives the outgoing request and a next continuation. Call next (with the request, possibly modified) to proceed, and return the response, possibly modified. First installed is outermost.

RequestMethod

HTTP methods accepted by Discord REST routes.

CustomRouteError

pub(all) suberror CustomRouteError {
InvalidPath(path~ : String)
EmptyBucket
} derive(
Debug
)

Invalid metadata supplied while constructing a custom REST route.

DiscordHttpError

pub(all) suberror DiscordHttpError {
Api(status~ : Int, error~ : ApiError)
RateLimited(retry_after_ms~ : Int64, global~ : Bool)
Deserialize(message~ : String)
Transport(message~ : String)
Timeout(timeout_ms~ : Int)
Validation(message~ : String)
} derive(
Debug
)

Everything a REST call can raise, from client-side validation to decoded Discord API errors.

ApiError

pub(all) struct ApiError {
code : Int
message : String
errors : Json?
} derive(ToJson,
Debug
,
FromJson
)

Discord's JSON error body ({"code": 50008, "message": "...", "errors": {...}}).

ApplicationEmojiRef

pub struct ApplicationEmojiRef {
// private fields
}

An application emoji id and its application id bound to the REST client.

ApplicationEmojiRef::delete

async fn ApplicationEmojiRef::delete(self : ApplicationEmojiRef) -> Unit raise DiscordHttpError

Delete this application emoji.

ApplicationEmojiRef::edit

Rename this application emoji.

ApplicationEmojiRef::fetch

Fetch this application emoji.

ApplicationRef

pub struct ApplicationRef {
// private fields
}

An application id bound to the REST client that operates on it.

ApplicationRef::activity_instance

async fn ApplicationRef::activity_instance(self : ApplicationRef, instance_id : String) ->
ActivityInstance
raise DiscordHttpError

Fetch a live activity instance for this application.

ApplicationRef::bulk_overwrite_global_commands

async fn ApplicationRef::bulk_overwrite_global_commands(self : ApplicationRef, commands : Json) -> Array[
ApplicationCommand
] raise DiscordHttpError

Replace all global commands. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

ApplicationRef::bulk_overwrite_guild_commands

Replace all commands in a guild. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

ApplicationRef::create_emoji

async fn ApplicationRef::create_emoji(self : ApplicationRef, name : String, image : String) ->
Emoji
raise DiscordHttpError

Create a custom emoji owned by this application.

ApplicationRef::create_global_command

async fn ApplicationRef::create_global_command(self : ApplicationRef, name : String, description? : String, options? : Array[
CommandOption
], typ? :
ApplicationCommandType
, default_member_permissions? :
Permissions
, clear_default_member_permissions? : Bool, nsfw? : Bool, name_localizations? : Map[String, String], description_localizations? : Map[String, String], integration_types? : Array[
ApplicationIntegrationType
], contexts? : Array[
InteractionContextType
], handler? :
EntryPointCommandHandlerType
) ->
ApplicationCommand
raise DiscordHttpError

Create a global command. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

ApplicationRef::create_guild_command

async fn ApplicationRef::create_guild_command(self : ApplicationRef, guild_id :
Id
[
GuildMarker
], name : String, description? : String, options? : Array[
CommandOption
], typ? :
ApplicationCommandType
, default_member_permissions? :
Permissions
, clear_default_member_permissions? : Bool, nsfw? : Bool, name_localizations? : Map[String, String], description_localizations? : Map[String, String]) ->
ApplicationCommand
raise DiscordHttpError

Create a guild command. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

ApplicationRef::emoji_ref

Bind an emoji id in this application to the client.

ApplicationRef::emojis

List custom emojis owned by this application.

ApplicationRef::entitlement_ref

Bind an entitlement id in this application to the client.

ApplicationRef::global_command_ref

Bind a global command id in this application to the client.

ApplicationRef::global_commands

async fn ApplicationRef::global_commands(self : ApplicationRef, with_localizations? : Bool) -> Array[
ApplicationCommand
] raise DiscordHttpError

List global commands for this application. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

ApplicationRef::guild_command_permissions

Fetch permission overrides for every command in a guild.

ApplicationRef::guild_command_ref

Bind a guild command in this application to the client.

ApplicationRef::guild_commands

List commands in a guild. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

ApplicationRef::role_connection_metadata

Fetch role connection metadata records for this application.

ApplicationRef::sku_ref

Bind a SKU id to the client. This convenience constructor does not use the bound application id.

ApplicationRef::skus

List SKUs available for this application.

ApplicationRef::update_role_connection_metadata

Replace role connection metadata records for this application.

AutoModerationRuleRef

pub struct AutoModerationRuleRef {
// private fields
}

An auto-moderation rule id and its guild id bound to the REST client.

AutoModerationRuleRef::delete

async fn AutoModerationRuleRef::delete(self : AutoModerationRuleRef, reason? : String) -> Unit raise DiscordHttpError

Delete this auto-moderation rule.

AutoModerationRuleRef::fetch

Fetch this auto-moderation rule.

ChannelRef

pub struct ChannelRef {
// private fields
}

A channel id bound to the REST client that operates on it.

ChannelRef::add_thread_member

Add a user to this channel. This channel must be a thread.

ChannelRef::bulk_delete

async fn ChannelRef::bulk_delete(self : ChannelRef, messages : Array[
Id
[
MessageMarker
]], reason? : String) -> Unit raise DiscordHttpError

Delete between 2 and 100 messages from this channel.

ChannelRef::create_invite

async fn ChannelRef::create_invite(self : ChannelRef, max_age? : Int, max_uses? : Int, temporary? : Bool, unique? : Bool, target_type? :
InviteTargetType
, target_user_id? :
Id
[
UserMarker
], target_application_id? :
Id
[
ApplicationMarker
], role_ids? : Array[
Id
[
RoleMarker
]], target_users_file? : FileUpload, reason? : String) ->
Invite
raise DiscordHttpError

Create an invite for this channel.

ChannelRef::create_stage_instance

async fn ChannelRef::create_stage_instance(self : ChannelRef, topic : String, privacy_level? :
StagePrivacyLevel
, send_start_notification? : Bool, guild_scheduled_event_id? :
Id
[
ScheduledEventMarker
], reason? : String) ->
StageInstance
raise DiscordHttpError

Create a stage instance. This channel must be a stage channel.

ChannelRef::create_webhook

async fn ChannelRef::create_webhook(self : ChannelRef, name : String, avatar? : String, reason? : String) ->
Webhook
raise DiscordHttpError

Create an incoming webhook for this channel.

ChannelRef::delete

async fn ChannelRef::delete(self : ChannelRef, reason? : String) ->
Channel
raise DiscordHttpError

Delete or close this channel.

ChannelRef::delete_permission

async fn ChannelRef::delete_permission(self : ChannelRef, overwrite_id :
Id
[
GenericMarker
], reason? : String) -> Unit raise DiscordHttpError

Delete a permission overwrite from this channel.

ChannelRef::delete_stage_instance

async fn ChannelRef::delete_stage_instance(self : ChannelRef, reason? : String) -> Unit raise DiscordHttpError

Delete the stage instance. This channel must be a stage channel.

ChannelRef::edit

async fn ChannelRef::edit(self : ChannelRef, name? : String, typ? :
ChannelType
, topic? : String, clear_topic? : Bool, nsfw? : Bool, parent_id? :
Id
[
ChannelMarker
], clear_parent_id? : Bool, rate_limit_per_user? : Int, position? : Int, bitrate? : Int, user_limit? : Int, permission_overwrites? : Array[
Overwrite
], rtc_region? : String, clear_rtc_region? : Bool, video_quality_mode? :
VideoQualityMode
, clear_video_quality_mode? : Bool, default_auto_archive_duration? :
ThreadAutoArchiveDuration
, available_tags? : Array[
ForumTagRequest
], default_reaction_emoji? :
DefaultReaction
, clear_default_reaction_emoji? : Bool, default_thread_rate_limit_per_user? : Int, default_sort_order? :
SortOrderType
, clear_default_sort_order? : Bool, default_forum_layout? :
ForumLayoutType
, icon? : String, flags? :
ChannelFlags
, archived? : Bool, auto_archive_duration? :
ThreadAutoArchiveDuration
, locked? : Bool, invitable? : Bool, applied_tags? : Array[
Id
[
GenericMarker
]], reason? : String) ->
Channel
raise DiscordHttpError

Edit this channel. The archived/auto_archive_duration/locked/ invitable/applied_tags knobs only apply when this channel is a thread.

ChannelRef::edit_permissions

Create or replace a permission overwrite for this channel.

ChannelRef::edit_stage_instance

async fn ChannelRef::edit_stage_instance(self : ChannelRef, topic? : String, privacy_level? :
StagePrivacyLevel
, reason? : String) ->
StageInstance
raise DiscordHttpError

Edit the stage instance. This channel must be a stage channel.

ChannelRef::fetch

Fetch this channel.

ChannelRef::follow

Follow this announcement channel. webhook_channel_id is the target channel that receives messages and requires MANAGE_WEBHOOKS there.

ChannelRef::group_dm_add_recipient

async fn ChannelRef::group_dm_add_recipient(self : ChannelRef, user_id :
Id
[
UserMarker
], access_token : String, nick? : String) -> Unit raise DiscordHttpError

Add a user to this group DM.

ChannelRef::group_dm_remove_recipient

async fn ChannelRef::group_dm_remove_recipient(self : ChannelRef, user_id :
Id
[
UserMarker
]) -> Unit raise DiscordHttpError

Remove a user from this group DM.

ChannelRef::invites

List invites created for this channel.

ChannelRef::join_thread

async fn ChannelRef::join_thread(self : ChannelRef) -> Unit raise DiscordHttpError

Join the current user to this channel. This channel must be a thread.

ChannelRef::joined_private_archived_threads

List private archived threads in this channel joined by the current user.

ChannelRef::leave_thread

async fn ChannelRef::leave_thread(self : ChannelRef) -> Unit raise DiscordHttpError

Remove the current user from this channel. This channel must be a thread.

ChannelRef::message_ref

Bind a message id in this channel to the client.

ChannelRef::pins

List every pinned message in this channel.

ChannelRef::pins_page

Fetch one page from Discord's current paginated channel-pins endpoint.

ChannelRef::private_archived_threads

List private archived threads in this channel.

ChannelRef::public_archived_threads

List public archived threads in this channel.

ChannelRef::remove_thread_member

async fn ChannelRef::remove_thread_member(self : ChannelRef, user_id :
Id
[
UserMarker
]) -> Unit raise DiscordHttpError

Remove a user from this channel. This channel must be a thread.

ChannelRef::send_soundboard_sound

Play a soundboard sound in this voice channel.

ChannelRef::set_voice_status

async fn ChannelRef::set_voice_status(self : ChannelRef, status? : String, reason? : String) -> Unit raise DiscordHttpError

Set this voice channel's status, or clear it by omitting status.

ChannelRef::stage_instance

Fetch the stage instance. This channel must be a stage channel.

ChannelRef::start_forum_thread

Start a thread with a starter message in this forum or media channel.

ChannelRef::start_thread

async fn ChannelRef::start_thread(self : ChannelRef, name : String, typ? :
ChannelType
, auto_archive_duration? :
ThreadAutoArchiveDuration
, invitable? : Bool, rate_limit_per_user? : Int, reason? : String) ->
Channel
raise DiscordHttpError

Start a thread in this channel without attaching it to a message.

ChannelRef::thread_member

Fetch a user's membership record. This channel must be a thread.

ChannelRef::thread_members

List this channel's members. This channel must be a thread.

ChannelRef::typing

async fn ChannelRef::typing(self : ChannelRef) -> Unit raise DiscordHttpError

Trigger the typing indicator in this channel.

ChannelRef::webhooks

List webhooks created for this channel.

ChannelRef::with_typing

async fn[T] ChannelRef::with_typing(self : ChannelRef, body : async () -> T) -> T

Run an asynchronous operation while keeping this channel's typing indicator active.

A typing request is sent immediately, then refreshed every 8 seconds while body runs because Discord's indicator expires after 10 seconds. Failure of the initial request is raised and prevents body from running. Failure of a later keepalive request only stops further refreshes. When body returns or raises, the keepalive task is cancelled and its result or error is propagated unchanged.

let answer = channel.with_typing(() => call_llm(prompt))
channel.send(content=answer)

Client

pub struct Client {
// private fields
}

Discord REST client: token + connection pool + rate limiter.
impl Show for Client

Client::Client

fn Client::Client(token : String, base_url? : String, api_version? : Int, limiter? : &
RateLimiter
, max_connections? : Int, request_timeout_ms? : Int, max_retries? : Int, default_allowed_mentions? :
AllowedMentions
) -> Client

Create a client. token is the raw bot token (without the Bot prefix).

Client::add_guild_member

Add a user to a guild with an OAuth2 access token carrying the guilds.join scope. A null response means the user was already a member.

Client::add_member_role

Add a role to a guild member.

Client::add_thread_member

Add a user to a thread channel.

Client::application_emoji_ref

Bind an application/emoji id pair to this client.

Client::application_ref

Bind an application id to this client.

Client::auto_moderation_rule_ref

Bind a guild/auto-moderation rule id pair to this client.

Client::begin_guild_prune

async fn Client::begin_guild_prune(self : Client, guild_id :
Id
[
GuildMarker
], days? : Int, compute_prune_count? : Bool, include_roles? : Array[
Id
[
RoleMarker
]], audit_reason? : String) ->
GuildPruneResult
raise DiscordHttpError

Begin pruning inactive members from a guild.

Client::bulk_delete_messages

Delete between 2 and 100 messages in one request.

Client::bulk_guild_ban

Ban up to 200 users from a guild in one request.

Client::bulk_overwrite_global_commands

Replace all global commands using a pre-built JSON array.

Client::bulk_overwrite_guild_commands

Replace all guild commands using a pre-built JSON array.

Client::channel_ref

Bind a channel id to this client.

Client::close

fn Client::close(self : Client) -> Unit

Close all pooled connections.

Client::consume_entitlement

Mark an entitlement as consumed.

https://discord.com/developers/docs/resources/entitlement#consume-an-entitlement

Client::create_application_emoji

async fn Client::create_application_emoji(self : Client, application_id :
Id
[
ApplicationMarker
], name : String, image : String) ->
Emoji
raise DiscordHttpError

Create a custom application emoji. image is a data URI.

Client::create_auto_moderation_rule

Create an auto-moderation rule. trigger_metadata is only meaningful for some trigger types (e.g. Keyword); triggers like Spam need none.

Client::create_channel_invite

Create an invite for a channel. target_type makes a voice-channel invite open a stream (Stream, requires target_user_id) or an embedded application (EmbeddedApplication, requires target_application_id). role_ids grants roles to accepting users (requires MANAGE_ROLES); target_users_file restricts who may accept it (a CSV of user ids, sent as multipart form data).

Client::create_dm

Create or reuse a direct-message channel with one recipient.

create_dm is idempotent for an existing one-to-one DM. Sending a message can still fail when the recipient does not accept DMs from the bot.

Example

Send a direct message by creating the DM channel first, then sending through its channel ID:

test "dm helper compiles" {
async fn dm_user(
client : @http.Client,
user_id : @model.UserId,
content : String,
) -> @model.Message {
let channel = client.create_dm(user_id)
client.create_message(
channel.id,
content~,
allowed_mentions=@model.AllowedMentions::none(),
)
}

ignore(dm_user)
}

Client::create_global_command

Create a global application command. description is required for CHAT_INPUT commands (the default typ) and must be omitted for the UI-based types. handler only applies to PRIMARY_ENTRY_POINT commands.

Client::create_guild_ban

async fn Client::create_guild_ban(self : Client, guild_id :
Id
[
GuildMarker
], user_id :
Id
[
UserMarker
], delete_message_seconds? : Int, audit_reason? : String) -> Unit raise DiscordHttpError

Ban a user from a guild.

Client::create_guild_channel

async fn Client::create_guild_channel(self : Client, guild_id :
Id
[
GuildMarker
], name : String, typ? :
ChannelType
, topic? : String, parent_id? :
Id
[
ChannelMarker
], position? : Int, permission_overwrites? : Array[
Overwrite
], nsfw? : Bool, bitrate? : Int, user_limit? : Int, rate_limit_per_user? : Int, rtc_region? : String, video_quality_mode? :
VideoQualityMode
, default_auto_archive_duration? :
ThreadAutoArchiveDuration
, available_tags? : Array[
ForumTagRequest
], default_reaction_emoji? :
DefaultReaction
, default_thread_rate_limit_per_user? : Int, default_sort_order? :
SortOrderType
, default_forum_layout? :
ForumLayoutType
, audit_reason? : String) ->
Channel
raise DiscordHttpError

Create a channel in a guild. rtc_region and video_quality_mode apply to voice and stage channels; the available_tags/default_* family applies to forum and media channels.

Client::create_guild_command

async fn Client::create_guild_command(self : Client, application_id :
Id
[
ApplicationMarker
], guild_id :
Id
[
GuildMarker
], name : String, description? : String, options? : Array[
CommandOption
], typ? :
ApplicationCommandType
, default_member_permissions? :
Permissions
, clear_default_member_permissions? : Bool, nsfw? : Bool, name_localizations? : Map[String, String], description_localizations? : Map[String, String]) ->
ApplicationCommand
raise DiscordHttpError

Create an application command in a guild. description is required for CHAT_INPUT commands (the default typ) and must be omitted for the UI-based types.

Client::create_guild_emoji

async fn Client::create_guild_emoji(self : Client, guild_id :
Id
[
GuildMarker
], name : String, image : String, roles? : Array[
Id
[
RoleMarker
]], audit_reason? : String) ->
Emoji
raise DiscordHttpError

Create a custom guild emoji. image is a data URI.

Client::create_guild_from_template

async fn Client::create_guild_from_template(self : Client, template_code : String, name : String, icon? : String) ->
Guild
raise DiscordHttpError

Create a guild from a template. This endpoint is only usable by bots in fewer than 10 guilds.

https://discord.com/developers/docs/resources/guild-template#create-guild-from-guild-template

Client::create_guild_role

async fn Client::create_guild_role(self : Client, guild_id :
Id
[
GuildMarker
], name? : String, permissions? :
Permissions
, color? : Int, colors? :
RoleColors
, hoist? : Bool, icon? : String, unicode_emoji? : String, mentionable? : Bool, audit_reason? : String) ->
Role
raise DiscordHttpError

Create a guild role. colors supersedes the legacy color field and can express gradient and holographic styles; icon (base64 image data) and unicode_emoji need the ROLE_ICONS guild feature.

Client::create_guild_scheduled_event

Create a scheduled event. Use clear_channel_id=true for an external event.

Client::create_guild_soundboard_sound

async fn Client::create_guild_soundboard_sound(self : Client, guild_id :
Id
[
GuildMarker
], name : String, sound : String, volume? : Double, emoji_id? :
Id
[
EmojiMarker
], emoji_name? : String, audit_reason? : String) ->
SoundboardSound
raise DiscordHttpError

Create a guild soundboard sound. sound is Discord's base64 data URI.

Client::create_guild_sticker

async fn Client::create_guild_sticker(self : Client, guild_id :
Id
[
GuildMarker
], file : FileUpload, name : String, description : String, tags : String, audit_reason? : String) ->
Sticker
raise DiscordHttpError

Create a guild sticker using Discord's dedicated multipart form shape.

Client::create_guild_template

async fn Client::create_guild_template(self : Client, guild_id :
Id
[
GuildMarker
], name : String, description? : String) ->
GuildTemplate
raise DiscordHttpError

Create a template for a guild.

https://discord.com/developers/docs/resources/guild-template#create-guild-template

Client::create_interaction_response

async fn Client::create_interaction_response(self : Client, interaction_id :
Id
[
InteractionMarker
], token : String, response :
InteractionResponse
, files? : Array[FileUpload]) -> Unit raise DiscordHttpError

Send the initial response to an interaction. When uploading files, include a matching attachments array in response.data yourself if you need descriptions or ordering (the framework layer does this).

Client::create_interaction_response_with_callback

Send the initial response to an interaction and get back what it created (with_response=true): the created message, or the launched Activity instance. Use create_interaction_response when the result is not needed.

Client::create_message

Post a message to a channel. Labeled optional arguments replace the builder pattern; at least one of content, embeds, components, sticker_ids, files, poll, or shared_client_theme must be provided — unless message_reference forwards another message, which needs nothing else.

reply_to is shorthand for a same-channel reply; pass a full message_reference instead for forwards, cross-channel references, or fail_if_not_exists. The two are mutually exclusive.

Message-shaped endpoints switch to multipart automatically when files is present (see FileUpload and attachments_json for the wire format). The same files argument is available on interaction responses, followups, and edit methods. On edit, the supplied files replace the attachment list sent in that request unless keep_attachments lists the ones to retain.

test "upload a file alongside message content" {
async fn send_report(
client : @http.Client,
channel_id : @model.ChannelId,
report : Bytes,
) -> @model.Message {
let file = @http.FileUpload(
"report.csv",
report,
content_type="text/csv",
description="Daily report",
)
client.create_message(channel_id, content="Report attached", files=[file])
}

ignore(send_report)
}

Client::create_reaction

Add a reaction. Pass the emoji in raw form: a unicode emoji such as "\u{1F525}", or name:id for custom emoji. It is percent-encoded here.

Client::create_stage_instance

async fn Client::create_stage_instance(self : Client, channel_id :
Id
[
ChannelMarker
], topic : String, privacy_level? :
StagePrivacyLevel
, send_start_notification? : Bool, guild_scheduled_event_id? :
Id
[
ScheduledEventMarker
], audit_reason? : String) ->
StageInstance
raise DiscordHttpError

Create a stage instance for a stage channel.

Client::create_test_entitlement

Create a test entitlement. The returned entitlement has no subscription information.

https://discord.com/developers/docs/resources/entitlement#create-test-entitlement

Client::create_webhook

async fn Client::create_webhook(self : Client, channel_id :
Id
[
ChannelMarker
], name : String, avatar? : String, audit_reason? : String) ->
Webhook
raise DiscordHttpError

Create an incoming webhook for a channel.

Client::crosspost_message

Publish a message from an announcement channel to its followers.

Client::delete_all_reactions

Delete every reaction from a message.

Client::delete_all_reactions_for_emoji

async fn Client::delete_all_reactions_for_emoji(self : Client, channel_id :
Id
[
ChannelMarker
], message_id :
Id
[
MessageMarker
], emoji : String) -> Unit raise DiscordHttpError

Delete every reaction matching an emoji. The emoji is passed raw (unicode or name:id) and percent-encoded here.

Client::delete_application_emoji

Delete a custom application emoji.

Client::delete_auto_moderation_rule

Delete an auto-moderation rule.

Client::delete_channel

Delete or close a channel.

Client::delete_channel_permission

async fn Client::delete_channel_permission(self : Client, channel_id :
Id
[
ChannelMarker
], overwrite_id :
Id
[
GenericMarker
], audit_reason? : String) -> Unit raise DiscordHttpError

Delete a channel permission overwrite.

Client::delete_current_user_application_role_connection

async fn Client::delete_current_user_application_role_connection(self : Client, application_id :
Id
[
ApplicationMarker
], bearer_token~ : String) -> Unit raise DiscordHttpError

Delete the current user's role connection for an application.

Requires an OAuth2 bearer token with the role_connections.write scope.

https://docs.discord.com/developers/resources/user#delete-current-user-application-role-connection

Client::delete_followup

Delete a followup message for an interaction.

Client::delete_global_command

Delete a global application command.

Client::delete_guild_command

Delete an application command registered in a guild.

Client::delete_guild_emoji

Delete a custom guild emoji.

Client::delete_guild_integration

async fn Client::delete_guild_integration(self : Client, guild_id :
Id
[
GuildMarker
], integration_id :
Id
[
IntegrationMarker
], audit_reason? : String) -> Unit raise DiscordHttpError

Delete an integration from a guild.

Client::delete_guild_role

Delete a guild role.

Client::delete_guild_scheduled_event

Delete a scheduled event.

Client::delete_guild_soundboard_sound

Delete a guild soundboard sound.

Client::delete_guild_sticker

Delete a guild sticker.

Client::delete_guild_template

Delete a guild template and return the deleted template object.

https://discord.com/developers/docs/resources/guild-template#delete-guild-template

Client::delete_invite

async fn Client::delete_invite(self : Client, code : String, audit_reason? : String) ->
Invite
raise DiscordHttpError

Delete an invite by code.

Client::delete_message

Delete a message.

Client::delete_original_response

async fn Client::delete_original_response(self : Client, application_id :
Id
[
ApplicationMarker
], token : String) -> Unit raise DiscordHttpError

Delete the original response for an interaction.

Client::delete_own_reaction

Delete the bot user's reaction. The emoji is passed raw (unicode or name:id) and percent-encoded here.

Client::delete_stage_instance

async fn Client::delete_stage_instance(self : Client, channel_id :
Id
[
ChannelMarker
], audit_reason? : String) -> Unit raise DiscordHttpError

Delete a stage instance.

Client::delete_test_entitlement

Delete a test entitlement.

https://discord.com/developers/docs/resources/entitlement#delete-test-entitlement

Client::delete_user_reaction

Delete another user's reaction. The emoji is passed raw (unicode or name:id) and percent-encoded here.

Client::delete_webhook

async fn Client::delete_webhook(self : Client, webhook_id :
Id
[
WebhookMarker
], audit_reason? : String) -> Unit raise DiscordHttpError

Delete a webhook using bot authentication.

Client::delete_webhook_message

Delete a message previously created by a webhook. Pass thread_id when the message lives in a thread of the webhook's channel.

Client::delete_webhook_with_token

async fn Client::delete_webhook_with_token(self : Client, webhook_id :
Id
[
WebhookMarker
], token : String) -> Unit raise DiscordHttpError

Delete a webhook using its token.

Client::edit_application_command_permissions

Replace permission overrides for one application command in a guild.

Requires an OAuth2 bearer token with the applications.commands.permissions.update scope.

https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions

Client::edit_channel_permissions

Create or replace a channel permission overwrite. Omitted allow/deny default to no permissions on the Discord side.

Client::edit_current_application

async fn Client::edit_current_application(self : Client, custom_install_url? : String, clear_custom_install_url? : Bool, description? : String, clear_description? : Bool, role_connections_verification_url? : String, clear_role_connections_verification_url? : Bool, install_params? :
InstallParams
, clear_install_params? : Bool, integration_types_config? : Map[String,
ApplicationIntegrationTypeConfiguration
], flags? :
ApplicationFlags
, icon? : String, clear_icon? : Bool, cover_image? : String, clear_cover_image? : Bool, interactions_endpoint_url? : String, clear_interactions_endpoint_url? : Bool, tags? : Array[String], clear_tags? : Bool, event_webhooks_url? : String, clear_event_webhooks_url? : Bool, event_webhooks_status? :
ApplicationEventWebhookStatus
, event_webhooks_types? : Array[String]) ->
Application
raise DiscordHttpError

Edit the current bot application. Nullable fields use a matching clear_* flag so omission remains distinct from sending JSON null.

Only the limited-intent flags (GATEWAY_PRESENCE_LIMITED, GATEWAY_GUILD_MEMBERS_LIMITED, and GATEWAY_MESSAGE_CONTENT_LIMITED) can be changed through this API. Discord sends a PING when setting interactions_endpoint_url and returns HTTP 400 if the URL does not respond. While an interactions endpoint is configured, interactions are not delivered over the Gateway.

Client::edit_followup

Edit a followup message for an interaction. keep_attachments lists the existing attachments to retain; without it, supplying files replaces the whole attachment list.

Client::edit_global_command

async fn Client::edit_global_command(self : Client, application_id :
Id
[
ApplicationMarker
], command_id :
Id
[
CommandMarker
], name? : String, description? : String, options? : Array[
CommandOption
], default_member_permissions? :
Permissions
, clear_default_member_permissions? : Bool, nsfw? : Bool, name_localizations? : Map[String, String], clear_name_localizations? : Bool, description_localizations? : Map[String, String], clear_description_localizations? : Bool, integration_types? : Array[
ApplicationIntegrationType
], contexts? : Array[
InteractionContextType
], handler? :
EntryPointCommandHandlerType
) ->
ApplicationCommand
raise DiscordHttpError

Edit a global application command.

Client::edit_guild_command

async fn Client::edit_guild_command(self : Client, application_id :
Id
[
ApplicationMarker
], guild_id :
Id
[
GuildMarker
], command_id :
Id
[
CommandMarker
], name? : String, description? : String, options? : Array[
CommandOption
], default_member_permissions? :
Permissions
, clear_default_member_permissions? : Bool, nsfw? : Bool, name_localizations? : Map[String, String], clear_name_localizations? : Bool, description_localizations? : Map[String, String], clear_description_localizations? : Bool) ->
ApplicationCommand
raise DiscordHttpError

Edit an application command registered in a guild.

Client::edit_message

Edit a previously sent message. keep_attachments lists the existing attachments to retain (optionally updating their description or spoiler state); keep_attachments=[] with no files removes them all. Without it, supplying files replaces the whole attachment list (Discord keeps only the attachments named in the request).

Client::edit_original_response

Edit the original response for an interaction. keep_attachments lists the existing attachments to retain; without it, supplying files replaces the whole attachment list. poll can only be added when the response was deferred.

Client::edit_webhook_message

Edit a message previously created by a webhook. keep_attachments lists the existing attachments to retain; without it, uploaded files replace the whole attachment list. with_components=true lets the edit change components on a webhook without an application.

Client::emoji_ref

Bind a guild/emoji id pair to this client.

Client::entitlement_ref

Bind an application/entitlement id pair to this client.

Client::execute_github_compatible_webhook

async fn Client::execute_github_compatible_webhook(self : Client, webhook_id :
Id
[
WebhookMarker
], token : String, payload : Json, github_event~ : String, thread_id? :
Id
[
ChannelMarker
], wait? : Bool) -> Unit raise DiscordHttpError

Execute a GitHub-compatible webhook payload. Supported github_event values are commit_comment, create, delete, fork, issue_comment, issues, member, public, pull_request, pull_request_review, pull_request_review_comment, push, release, watch, check_run, check_suite, discussion, and discussion_comment.

Client::execute_slack_compatible_webhook

async fn Client::execute_slack_compatible_webhook(self : Client, webhook_id :
Id
[
WebhookMarker
], token : String, payload : Json, thread_id? :
Id
[
ChannelMarker
], wait? : Bool) -> Unit raise DiscordHttpError

Execute a Slack-compatible webhook payload. thread_id targets a thread, and wait asks Discord to wait for server confirmation.

Client::execute_webhook

Execute a webhook and wait for the created message (wait=true is fixed because the typed return is the message; fire-and-forget would have no body to decode). At least one of content, embeds, components, files, or poll must be provided. When the webhook channel is a forum or media channel, pass exactly one of thread_id (post to an existing thread) or thread_name (create a thread); applied_tags only applies with thread_name. with_components lets non-application-owned webhooks send non-interactive components.

Client::expire_poll

Immediately expire a poll and return the updated message.

Client::follow_announcement_channel

Follow an announcement channel, forwarding its messages to another channel through the returned webhook.

Client::get_application_activity_instance

Fetch a live application activity instance. Requires a Bot token.

Returns HTTP 404 when no live instance exists for instance_id.

https://discord.com/developers/docs/resources/application#get-application-activity-instance

Client::get_application_command_permissions

Fetch permission overrides for one application command in a guild.

https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions

Client::get_application_emoji

Fetch one custom application emoji.

Client::get_application_role_connection_metadata_records

Fetch the application role connection metadata records for an application.

https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records

Client::get_channel

Fetch a channel by snowflake.

Client::get_channel_invites

List invites created for a channel.

Client::get_channel_pins

Fetch one page of channel pins, newest first. Use the final entry's pinned_at as before while has_more is true.

Client::get_channel_webhooks

List the webhooks created for a channel.

Client::get_current_application

async fn Client::get_current_application(self : Client) ->
Application
raise DiscordHttpError

Fetch the current bot application.

Client::get_current_authorization_information

async fn Client::get_current_authorization_information(self : Client, bearer_token~ : String) ->
AuthorizationInformation
raise DiscordHttpError

Fetch information about the authorization represented by a bearer token.

Requires a valid OAuth2 bearer token; this endpoint has no additional scope requirement. The token's granted scopes are returned in the response, and the user field is present only when the token has the identify scope.

https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information

Client::get_current_bot_application_information

async fn Client::get_current_bot_application_information(self : Client) ->
Application
raise DiscordHttpError

Fetch the current bot application's information.

https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information

Client::get_current_user

async fn Client::get_current_user(self : Client) ->
User
raise DiscordHttpError

Fetch the bot user's account.

Client::get_current_user_application_role_connection

async fn Client::get_current_user_application_role_connection(self : Client, application_id :
Id
[
ApplicationMarker
], bearer_token~ : String) ->
ApplicationRoleConnection
raise DiscordHttpError

Fetch the current user's role connection for an application.

Requires an OAuth2 bearer token with the role_connections.write scope.

https://discord.com/developers/docs/resources/user#get-current-user-application-role-connection

Client::get_current_user_connections

async fn Client::get_current_user_connections(self : Client, bearer_token~ : String) -> Array[
Connection
] raise DiscordHttpError

List the external service accounts linked to the current user.

Requires an OAuth2 bearer token with the connections scope.

https://discord.com/developers/docs/resources/user#get-current-user-connections

Client::get_current_user_guild_member

async fn Client::get_current_user_guild_member(self : Client, guild_id :
Id
[
GuildMarker
], bearer_token~ : String) ->
GuildMember
raise DiscordHttpError

Fetch the current user's member record in a guild.

Requires an OAuth2 bearer token with the guilds.members.read scope.

https://discord.com/developers/docs/resources/user#get-current-user-guild-member

Client::get_current_user_guilds

List guilds available to the current user.

Client::get_current_user_voice_state

Fetch the current user's voice state in a guild.

https://discord.com/developers/docs/resources/voice#get-current-user-voice-state

Client::get_entitlement

Fetch an entitlement for an application.

https://discord.com/developers/docs/resources/entitlement#get-entitlement

Client::get_followup

Fetch a followup message for an interaction.

Client::get_gateway

async fn Client::get_gateway(self : Client) -> String raise DiscordHttpError

Get the gateway WebSocket URL (unauthenticated).

Client::get_gateway_bot

Get the gateway URL plus recommended shard count and identify limits.

Client::get_global_commands

List global application commands. with_localizations includes the full localization dictionaries in the returned objects.

Client::get_guild

Fetch a guild, optionally including approximate member counts.

Client::get_guild_application_command_permissions

Fetch permission overrides for every application command in a guild.

https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions

Client::get_guild_bans

List bans in a guild using before/after snowflake pagination.

Client::get_guild_channels

List the channels in a guild.

Client::get_guild_commands

List application commands registered in a guild. with_localizations includes the full localization dictionaries in the returned objects.

Client::get_guild_integrations

List the integrations configured for a guild.

Client::get_guild_invites

List the invites for a guild.

Client::get_guild_onboarding

Fetch a guild's onboarding configuration.

Client::get_guild_preview

Fetch the public preview for a discoverable guild.

Client::get_guild_prune_count

Return the number of members that would be removed by a guild prune.

Client::get_guild_roles

List the roles in a guild.

Client::get_guild_scheduled_event

Fetch one scheduled event.

Client::get_guild_template

async fn Client::get_guild_template(self : Client, template_code : String) ->
GuildTemplate
raise DiscordHttpError

Fetch a guild template by its code.

https://discord.com/developers/docs/resources/guild-template#get-guild-template

Client::get_guild_templates

List the templates for a guild.

https://discord.com/developers/docs/resources/guild-template#get-guild-templates

Client::get_guild_vanity_url

Fetch a guild's vanity invite code and use count.

Client::get_guild_voice_regions

List the voice regions available to a guild.

Client::get_guild_webhooks

List the webhooks belonging to a guild.

Client::get_guild_welcome_screen

Fetch a guild's welcome screen.

Client::get_guild_widget

Fetch the public JSON representation of a guild widget.

Client::get_guild_widget_settings

Fetch a guild's widget settings.

Client::get_invite

async fn Client::get_invite(self : Client, code : String, with_counts? : Bool, guild_scheduled_event_id? :
Id
[
ScheduledEventMarker
]) ->
Invite
raise DiscordHttpError

Fetch an invite by code, optionally requesting approximate counts or a scheduled-event association. (with_expiration no longer exists in the API; expires_at is always part of the invite object.)

Client::get_invite_target_users_job_status

async fn Client::get_invite_target_users_job_status(self : Client, code : String) ->
TargetUsersJobStatus
raise DiscordHttpError

Fetch the status of the latest target-user update for an invite. The caller must be the inviter or have the MANAGE_GUILD or VIEW_AUDIT_LOG permission.

Client::get_original_response

Fetch the original response for an interaction.

Client::get_pinned_messages

List every pinned message in a channel.

Client::get_poll_answer_voters

List users who voted for one poll answer.

Client::get_reactions

List users who reacted with an emoji. The emoji is passed raw (unicode or name:id) and percent-encoded here. typ selects normal or burst (super) reactions.

Client::get_sku_subscription

Fetch a subscription for a SKU.

https://discord.com/developers/docs/resources/subscription#get-sku-subscription

Client::get_stage_instance

Fetch the stage instance associated with a channel.

Client::get_sticker

Fetch a sticker by id.

Client::get_sticker_pack

Fetch one standard sticker pack.

Client::get_thread_member

Fetch a user's membership record for a thread channel.

Client::get_user

Fetch a user by snowflake.

Client::get_user_voice_state

Fetch a user's voice state in a guild.

https://discord.com/developers/docs/resources/voice#get-user-voice-state

Client::get_webhook

Fetch a webhook using bot authentication.

Client::get_webhook_message

Fetch a message previously created by a webhook. Pass thread_id when the message lives in a thread of the webhook's channel.

Client::get_webhook_with_token

Fetch a webhook using the webhook token embedded in the route.

Client::global_command_ref

Bind an application/global command id pair to this client.

Client::group_dm_add_recipient

async fn Client::group_dm_add_recipient(self : Client, channel_id :
Id
[
ChannelMarker
], user_id :
Id
[
UserMarker
], access_token : String, nick? : String) -> Unit raise DiscordHttpError

Add a user to a group DM. access_token is the recipient's OAuth2 token with the gdm.join scope and is sent as a JSON body field.

Client::group_dm_remove_recipient

Remove a user from a group DM.

Client::guild_command_ref

Bind application, guild, and command ids to this client.

Client::guild_ref

Bind a guild id to this client.

Client::guild_template_ref

fn Client::guild_template_ref(self : Client, guild_id :
Id
[
GuildMarker
], code : String) -> TemplateRef

Bind a guild/template code pair to this client.

Client::guild_widget_image_url

fn Client::guild_widget_image_url(self : Client, guild_id :
Id
[
GuildMarker
], style? : String) -> String

Build the guild widget PNG URL using this client's configured API base. Discord documents the styles shield, banner1, banner2, banner3, and banner4; the style is passed through without validation.

Client::invite_ref

fn Client::invite_ref(self : Client, code : String) -> InviteRef

Bind an invite code to this client.

Client::join_thread

Join the current user to a thread channel.

Client::leave_guild

Leave a guild as the current user.

https://discord.com/developers/docs/resources/user#leave-guild

Client::leave_thread

Remove the current user from a thread channel.

Client::list_active_guild_threads

List every active thread in a guild.

Client::list_application_emojis

List every custom emoji owned by an application.

Client::list_auto_moderation_rules

List every auto-moderation rule configured for a guild.

Client::list_default_soundboard_sounds

async fn Client::list_default_soundboard_sounds(self : Client) -> Array[
SoundboardSound
] raise DiscordHttpError

List Discord's built-in soundboard sounds.

Client::list_guild_emojis

List every custom emoji in a guild.

Client::list_guild_members

List guild members after an optional user snowflake.

Client::list_guild_scheduled_events

List scheduled events in a guild.

Client::list_guild_soundboard_sounds

List the custom soundboard sounds in a guild. Unlike the default-sound listing, this endpoint wraps the array in an items envelope.

Client::list_guild_stickers

List a guild's custom stickers.

Client::list_joined_private_archived_threads

List private archived threads joined by the current user.

Client::list_private_archived_threads

List private archived threads in a channel.

Client::list_public_archived_threads

List public archived threads in a channel.

Client::list_sku_subscriptions

List subscriptions for a SKU. Discord requires user_id except for OAuth queries.

https://discord.com/developers/docs/resources/subscription#list-sku-subscriptions

Client::list_skus

List the SKUs available for an application.

https://discord.com/developers/docs/resources/sku#list-skus

Client::list_sticker_packs

List Discord's standard sticker packs.

Client::list_thread_members

List members of a thread channel.

Client::list_voice_regions

async fn Client::list_voice_regions(self : Client) -> Array[
VoiceRegion
] raise DiscordHttpError

List the voice regions available to Discord.

https://discord.com/developers/docs/resources/voice#list-voice-regions

Client::member_ref

Bind a guild/user id pair to this client.

Client::message_ref

Bind a channel/message id pair to this client.

Client::middleware

fn Client::middleware(self : Client, middleware : async (HttpRequest, async (HttpRequest) -> HttpResponse) -> HttpResponse) -> Unit

Install middleware around each logical REST call. The first installed middleware is outermost. next performs rate limiting, the wire exchange, and bounded 429 retries.

Client::modify_application_emoji

Rename a custom application emoji.

Client::modify_channel

async fn Client::modify_channel(self : Client, channel_id :
Id
[
ChannelMarker
], name? : String, typ? :
ChannelType
, topic? : String, clear_topic? : Bool, nsfw? : Bool, parent_id? :
Id
[
ChannelMarker
], clear_parent_id? : Bool, rate_limit_per_user? : Int, position? : Int, bitrate? : Int, user_limit? : Int, permission_overwrites? : Array[
Overwrite
], rtc_region? : String, clear_rtc_region? : Bool, video_quality_mode? :
VideoQualityMode
, clear_video_quality_mode? : Bool, default_auto_archive_duration? :
ThreadAutoArchiveDuration
, available_tags? : Array[
ForumTagRequest
], default_reaction_emoji? :
DefaultReaction
, clear_default_reaction_emoji? : Bool, default_thread_rate_limit_per_user? : Int, default_sort_order? :
SortOrderType
, clear_default_sort_order? : Bool, default_forum_layout? :
ForumLayoutType
, icon? : String, flags? :
ChannelFlags
, archived? : Bool, auto_archive_duration? :
ThreadAutoArchiveDuration
, locked? : Bool, invitable? : Bool, applied_tags? : Array[
Id
[
GenericMarker
]], audit_reason? : String) ->
Channel
raise DiscordHttpError

Modify common channel settings. archived, auto_archive_duration, locked, invitable, and applied_tags only apply when the channel is a thread; flags covers both threads (PINNED) and forum/media channels (REQUIRE_TAG). typ converts between text and announcement channels; bitrate, user_limit, rtc_region (null means automatic), and video_quality_mode apply to voice and stage channels; the available_tags/default_* family applies to forum and media channels; icon (base64 image data) renames a group DM.

Client::modify_current_member

async fn Client::modify_current_member(self : Client, guild_id :
Id
[
GuildMarker
], nick? : String, clear_nick? : Bool, avatar? : String, clear_avatar? : Bool, banner? : String, clear_banner? : Bool, bio? : String, clear_bio? : Bool, audit_reason? : String) ->
GuildMember
raise DiscordHttpError

Modify the bot's own member in a guild.

Client::modify_current_user

async fn Client::modify_current_user(self : Client, username? : String, avatar? : String, clear_avatar? : Bool, banner? : String, clear_banner? : Bool) ->
User
raise DiscordHttpError

Modify the bot user's username, avatar, or banner (both images as base64 data URIs).

Client::modify_current_user_voice_state

async fn Client::modify_current_user_voice_state(self : Client, guild_id :
Id
[
GuildMarker
], channel_id? :
Id
[
ChannelMarker
], suppress? : Bool, request_to_speak_timestamp? :
Timestamp
, clear_request_to_speak_timestamp? : Bool) -> Unit raise DiscordHttpError

Modify the current user's voice state in a guild. Use clear_request_to_speak_timestamp=true to send JSON null rather than omit the timestamp.

https://discord.com/developers/docs/resources/voice#modify-current-user-voice-state

Client::modify_guild

async fn Client::modify_guild(self : Client, guild_id :
Id
[
GuildMarker
], name? : String, verification_level? :
VerificationLevel
, default_message_notifications? :
DefaultMessageNotifications
, explicit_content_filter? :
ExplicitContentFilter
, afk_channel_id? :
Id
[
ChannelMarker
], clear_afk_channel_id? : Bool, afk_timeout? : Int, icon? : String, clear_icon? : Bool, owner_id? :
Id
[
UserMarker
], splash? : String, clear_splash? : Bool, discovery_splash? : String, clear_discovery_splash? : Bool, banner? : String, clear_banner? : Bool, system_channel_id? :
Id
[
ChannelMarker
], clear_system_channel_id? : Bool, system_channel_flags? :
SystemChannelFlags
, rules_channel_id? :
Id
[
ChannelMarker
], clear_rules_channel_id? : Bool, public_updates_channel_id? :
Id
[
ChannelMarker
], clear_public_updates_channel_id? : Bool, preferred_locale? : String, features? : Array[
GuildFeature
], description? : String, clear_description? : Bool, premium_progress_bar_enabled? : Bool, safety_alerts_channel_id? :
Id
[
ChannelMarker
], clear_safety_alerts_channel_id? : Bool, audit_reason? : String) ->
Guild
raise DiscordHttpError

Modify guild settings. Nullable fields use a matching clear_* flag so omission remains distinct from sending JSON null.

Client::modify_guild_channel_positions

async fn Client::modify_guild_channel_positions(self : Client, guild_id :
Id
[
GuildMarker
], positions : Array[GuildChannelPosition], audit_reason? : String) -> Unit raise DiscordHttpError

Bulk-modify channel sorting positions using Discord's raw JSON array body. Include only the channels to move.

Client::modify_guild_emoji

Modify a custom guild emoji.

Client::modify_guild_incident_actions

async fn Client::modify_guild_incident_actions(self : Client, guild_id :
Id
[
GuildMarker
], invites_disabled_until? :
Timestamp
, clear_invites_disabled_until? : Bool, dms_disabled_until? :
Timestamp
, clear_dms_disabled_until? : Bool) ->
IncidentsData
raise DiscordHttpError

Modify temporary guild incident restrictions. Discord permits each timestamp to be at most 24 hours in the future.

Client::modify_guild_member

async fn Client::modify_guild_member(self : Client, guild_id :
Id
[
GuildMarker
], user_id :
Id
[
UserMarker
], nick? : String, clear_nick? : Bool, roles? : Array[
Id
[
RoleMarker
]], mute? : Bool, deaf? : Bool, channel_id? :
Id
[
ChannelMarker
], clear_channel_id? : Bool, communication_disabled_until? :
Timestamp
, clear_communication_disabled_until? : Bool, flags? :
GuildMemberFlags
, audit_reason? : String) ->
GuildMember
raise DiscordHttpError

Modify a guild member.

Client::modify_guild_onboarding

Replace a guild's onboarding configuration.

Client::modify_guild_role

async fn Client::modify_guild_role(self : Client, guild_id :
Id
[
GuildMarker
], role_id :
Id
[
RoleMarker
], name? : String, permissions? :
Permissions
, color? : Int, colors? :
RoleColors
, hoist? : Bool, icon? : String, clear_icon? : Bool, unicode_emoji? : String, clear_unicode_emoji? : Bool, mentionable? : Bool, audit_reason? : String) ->
Role
raise DiscordHttpError

Modify a guild role. colors supersedes the legacy color field; icon (base64 image data) and unicode_emoji need the ROLE_ICONS guild feature, and the clear_* companions remove them.

Client::modify_guild_role_positions

Modify guild role positions using Discord's raw JSON array body.

Client::modify_guild_scheduled_event

Modify a scheduled event.

Client::modify_guild_soundboard_sound

async fn Client::modify_guild_soundboard_sound(self : Client, guild_id :
Id
[
GuildMarker
], sound_id :
Id
[
SoundboardSoundMarker
], name? : String, volume? : Double, emoji_id? :
Id
[
EmojiMarker
], clear_emoji_id? : Bool, emoji_name? : String, clear_emoji_name? : Bool, audit_reason? : String) ->
SoundboardSound
raise DiscordHttpError

Modify a guild soundboard sound.

Client::modify_guild_sticker

async fn Client::modify_guild_sticker(self : Client, guild_id :
Id
[
GuildMarker
], sticker_id :
Id
[
StickerMarker
], name? : String, description? : String, clear_description? : Bool, tags? : String, audit_reason? : String) ->
Sticker
raise DiscordHttpError

Modify a guild sticker.

Client::modify_guild_template

async fn Client::modify_guild_template(self : Client, guild_id :
Id
[
GuildMarker
], template_code : String, name? : String, description? : String, clear_description? : Bool) ->
GuildTemplate
raise DiscordHttpError

Modify a guild template. Use clear_description=true to send JSON null rather than omit the description.

https://discord.com/developers/docs/resources/guild-template#modify-guild-template

Client::modify_guild_welcome_screen

async fn Client::modify_guild_welcome_screen(self : Client, guild_id :
Id
[
GuildMarker
], enabled? : Bool, clear_enabled? : Bool, welcome_channels? : Array[
WelcomeScreenChannel
], clear_welcome_channels? : Bool, description? : String, clear_description? : Bool, audit_reason? : String) ->
WelcomeScreen
raise DiscordHttpError

Modify a guild's welcome screen. Each nullable field has a matching clear flag so omission remains distinct from JSON null.

Client::modify_guild_widget

Modify a guild's widget settings.

Client::modify_stage_instance

Modify a stage instance.

Client::modify_user_voice_state

Modify a user's voice state in a guild.

https://discord.com/developers/docs/resources/voice#modify-user-voice-state

Client::modify_webhook

async fn Client::modify_webhook(self : Client, webhook_id :
Id
[
WebhookMarker
], name? : String, avatar? : String, clear_avatar? : Bool, channel_id? :
Id
[
ChannelMarker
], audit_reason? : String) ->
Webhook
raise DiscordHttpError

Modify a webhook using bot authentication.

Client::modify_webhook_with_token

async fn Client::modify_webhook_with_token(self : Client, webhook_id :
Id
[
WebhookMarker
], token : String, name? : String, avatar? : String, clear_avatar? : Bool) ->
Webhook
raise DiscordHttpError

Modify a webhook using its token. This token-authenticated variant cannot move the webhook to another channel.

Client::on_telemetry

fn Client::on_telemetry(self : Client, hook : (
TelemetryEvent
) -> Unit raise) -> Unit

Observe structured HTTP telemetry. Hooks run synchronously and should return promptly. A hook failure is reported through on_warn.

Client::on_warn

fn Client::on_warn(self : Client, hook : (String) -> Unit) -> Unit

Set the warning sink used for telemetry-hook failures.

Client::paginate_current_user_guilds

Page through the current user's partial guild objects.

Client::paginate_guild_audit_log

Page backward through audit-log entries. Referenced sidecar objects from each audit-log response are intentionally not included in the item stream.

Client::paginate_guild_bans

Page through guild bans using either a before or after cursor.

Client::paginate_guild_members

Page through guild members in ascending user-id order.

Use each when the item callback is synchronous. Available paginator constructors cover messages, guild members, bans, audit-log entries, scheduled-event users, poll-answer voters, and current-user guilds; cursor direction and endpoint maximums are encoded by each constructor.

test "visit every guild member" {
async fn print_members(
client : @http.Client,
guild_id : @model.GuildId,
) -> Unit {
client
.paginate_guild_members(guild_id)
.each(guild_member => println("\{Repr(guild_member.user)}"))
}

ignore(print_members)
}

Client::paginate_messages

Page through channel messages. Without a cursor, pagination starts at the newest messages and continues backward. around produces one page only.

Start before or after a known message by supplying one cursor. before, after, and around are mutually exclusive. All paginator methods (next_page, collect, each) consume the same mutable cursor state; do not call them concurrently. Empty pages and pages shorter than the configured page size mark the end.

test "walk message history newest-first" {
async fn print_history(
client : @http.Client,
channel_id : @model.ChannelId,
newest_known : @model.MessageId,
) -> Unit {
let pages = client.paginate_messages(channel_id, page_size=100)
for ;; {
match pages.next_page() {
Some(messages) =>
for message in messages {
println("\{message.id}: \{message.content}")
}
None => break
}
}
// `collect` bounds the walk instead of draining the full history.
let recent = client
.paginate_messages(channel_id, before=newest_known, page_size=100)
.collect(max=250)
ignore(recent)
}

ignore(print_history)
}

Client::paginate_poll_answer_voters

Page forward through users who selected one poll answer.

Client::pin_message

Pin a message in a channel.

Client::ref_of_message

fn Client::ref_of_message(self : Client, message :
Message
) -> MessageRef

Derive a client-bound message handle from a message model.

Client::remove_guild_ban

Remove a guild ban.

Client::remove_guild_member

Remove a member from a guild.

Client::remove_member_role

Remove a role from a guild member.

Client::remove_thread_member

Remove a user from a thread channel.

Client::request

async fn Client::request(self : Client, route : Route, body? : Json, audit_reason? : String, files? : Array[FileUpload], headers? : Map[String, String]) -> Json raise DiscordHttpError

Send a request through the rate limiter, retrying on 429 (bounded).

This is also the raw escape hatch: typed endpoint wrappers build a Route plus JSON body and decode the returned JSON, while unwrapped endpoints use Route::custom. Optional headers are merged after the client's base headers, so caller-supplied values such as authorization take precedence.

Client::role_ref

Bind a guild/role id pair to this client.

Client::scheduled_event_ref

Bind a guild/scheduled event id pair to this client.

Client::search_guild_members

async fn Client::search_guild_members(self : Client, guild_id :
Id
[
GuildMarker
], query : String, limit? : Int) -> Array[
GuildMember
] raise DiscordHttpError

Search guild members. The query string must already be URL-encoded.

Client::search_guild_messages

async fn Client::search_guild_messages(self : Client, guild_id :
Id
[
GuildMarker
], limit? : Int, offset? : Int, slop? : Int, content? : String, mention_everyone? : Bool, pinned? : Bool, include_nsfw? : Bool, sort_by? : String, sort_order? : String, max_id? :
Id
[
MessageMarker
], min_id? :
Id
[
MessageMarker
], channel_id? : Array[
Id
[
ChannelMarker
]], author_type? : Array[String], author_id? : Array[
Id
[
UserMarker
]], mentions? : Array[
Id
[
UserMarker
]], mentions_role_id? : Array[
Id
[
RoleMarker
]], replied_to_user_id? : Array[
Id
[
UserMarker
]], replied_to_message_id? : Array[
Id
[
MessageMarker
]], has? : Array[String], embed_type? : Array[String], embed_provider? : Array[String], link_hostname? : Array[String], attachment_filename? : Array[String], attachment_extension? : Array[String]) ->
GuildMessageSearchResults
raise DiscordHttpError

Search messages in a guild. Results that contain message content require the MESSAGE_CONTENT privileged intent, and the caller must have the READ_MESSAGE_HISTORY permission in the channels being searched.

Client::send_soundboard_sound

Play a soundboard sound in a voice channel.

Client::set_voice_channel_status

async fn Client::set_voice_channel_status(self : Client, channel_id :
Id
[
ChannelMarker
], status? : String, audit_reason? : String) -> Unit raise DiscordHttpError

Set a voice channel's status, or clear it by omitting status.

Client::sku_ref

Bind a SKU id to this client.

Client::soundboard_sound_ref

Bind a guild/sound id pair to this client.

Client::start_thread_from_message

Start a thread whose initial message is an existing channel message.

Client::start_thread_in_forum_or_media_channel

Start a thread in a forum or media channel. The thread's starter message is created in the same request from the message fields; at least one of content, embeds, components, sticker_ids, or files must be provided.

Client::start_thread_without_message

async fn Client::start_thread_without_message(self : Client, channel_id :
Id
[
ChannelMarker
], name : String, typ? :
ChannelType
, auto_archive_duration? :
ThreadAutoArchiveDuration
, invitable? : Bool, rate_limit_per_user? : Int, audit_reason? : String) ->
Channel
raise DiscordHttpError

Start a thread that is not attached to an existing message.

Discord currently defaults typ to a private thread and plans to make the field required in a future API version, so pass it explicitly.

Client::sticker_ref

Bind a guild/sticker id pair to this client.

Client::sync_guild_template

Sync a template to the current guild state.

https://discord.com/developers/docs/resources/guild-template#sync-guild-template

Client::trigger_typing

Trigger the typing indicator for a channel.

Client::unpin_message

Remove a message pin from a channel.

Client::update_application_role_connection_metadata_records

Replace the application role connection metadata records for an application.

The records are sent as a raw JSON array. Discord accepts at most five.

https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records

Client::update_current_user_application_role_connection

async fn Client::update_current_user_application_role_connection(self : Client, application_id :
Id
[
ApplicationMarker
], platform_name? : String, platform_username? : String, metadata? : Json, bearer_token~ : String) ->
ApplicationRoleConnection
raise DiscordHttpError

Update the current user's role connection for an application.

Requires an OAuth2 bearer token with the role_connections.write scope.

https://discord.com/developers/docs/resources/user#update-current-user-application-role-connection

Client::update_invite_target_users

async fn Client::update_invite_target_users(self : Client, code : String, target_users_file : FileUpload) -> Unit raise DiscordHttpError

Replace an invite's target users from a CSV file with one user_id column. The caller must be the inviter or have the MANAGE_GUILD permission.

Client::user_ref

Bind a user id to this client.

Client::webhook_ref

Bind a webhook id to this client for bot-authenticated management.

Client::webhook_token_ref

fn Client::webhook_token_ref(self : Client, webhook_id :
Id
[
WebhookMarker
], token : String) -> WebhookTokenRef

Bind a webhook id and URL token to this client.

EmojiRef

pub struct EmojiRef {
// private fields
}

An emoji id and its guild id bound to the REST client that operates on it.

EmojiRef::delete

async fn EmojiRef::delete(self : EmojiRef, reason? : String) -> Unit raise DiscordHttpError

Delete this custom guild emoji.

EmojiRef::edit

Edit this custom guild emoji.

EmojiRef::fetch

Fetch this custom guild emoji.

EntitlementRef

pub struct EntitlementRef {
// private fields
}

An entitlement id and its application id bound to the REST client.

EntitlementRef::consume

async fn EntitlementRef::consume(self : EntitlementRef) -> Unit raise DiscordHttpError

Mark this entitlement as consumed.

EntitlementRef::delete_test

async fn EntitlementRef::delete_test(self : EntitlementRef) -> Unit raise DiscordHttpError

Delete this test entitlement.

EntitlementRef::fetch

Fetch this entitlement.

FileUpload

pub struct FileUpload {
// private fields
}

One file to upload in a multipart/form-data request, next to the payload_json part. Construct with FileUpload(...).
impl Debug for FileUpload

FileUpload::FileUpload

fn FileUpload::FileUpload(filename : String, content : Bytes, content_type? : String, description? : String, title? : String, duration_secs? : Double, waveform? : String, is_spoiler? : Bool) -> FileUpload

Describe one file to upload. description becomes the attachment's alt text where the endpoint supports it; title, duration_secs, waveform, and is_spoiler fill the matching attachment-request fields (the latter two are required for voice messages).

test "describe attachments in payload_json" {
let files = [
@http.FileUpload(
"cat.png",
b"PNG",
content_type="image/png",
description="a cat",
is_spoiler=true,
),
]
json_inspect(@http.attachments_json(files), content=[
{
"id": 0,
"filename": "cat.png",
"description": "a cat",
"is_spoiler": true,
},
])
}

GlobalCommandRef

pub struct GlobalCommandRef {
// private fields
}

A global command id and its application id bound to the REST client.

GlobalCommandRef::delete

async fn GlobalCommandRef::delete(self : GlobalCommandRef) -> Unit raise DiscordHttpError

Delete this global command. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

GlobalCommandRef::edit

async fn GlobalCommandRef::edit(self : GlobalCommandRef, name? : String, description? : String, options? : Array[
CommandOption
], default_member_permissions? :
Permissions
, clear_default_member_permissions? : Bool, nsfw? : Bool, name_localizations? : Map[String, String], clear_name_localizations? : Bool, description_localizations? : Map[String, String], clear_description_localizations? : Bool, integration_types? : Array[
ApplicationIntegrationType
], contexts? : Array[
InteractionContextType
], handler? :
EntryPointCommandHandlerType
) ->
ApplicationCommand
raise DiscordHttpError

Edit this global command. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

GlobalCommandRef::fetch

Fetch this global command. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

GuildChannelPosition

pub struct GuildChannelPosition {
// private fields
}

One entry of a Modify Guild Channel Positions request. Fields left unset are omitted so Discord keeps their current value; clear_parent_id=true sends a JSON null that moves the channel out of its category.

GuildChannelPosition::GuildChannelPosition

Construct one channel-position entry.

GuildCommandRef

pub struct GuildCommandRef {
// private fields
}

A guild command id and its application/guild ids bound to the REST client.

GuildCommandRef::delete

async fn GuildCommandRef::delete(self : GuildCommandRef) -> Unit raise DiscordHttpError

Delete this guild command. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

GuildCommandRef::edit

async fn GuildCommandRef::edit(self : GuildCommandRef, name? : String, description? : String, options? : Array[
CommandOption
], default_member_permissions? :
Permissions
, clear_default_member_permissions? : Bool, nsfw? : Bool, name_localizations? : Map[String, String], clear_name_localizations? : Bool, description_localizations? : Map[String, String], clear_description_localizations? : Bool) ->
ApplicationCommand
raise DiscordHttpError

Edit this guild command. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

GuildCommandRef::edit_permissions

Replace permission overrides for this guild command.

GuildCommandRef::fetch

Fetch this guild command. This is a lower-level API behind src/app's diff-based command sync; bots using sync normally need not call it.

GuildCommandRef::permissions

Fetch permission overrides for this guild command.

GuildRef

pub struct GuildRef {
// private fields
}

A guild id bound to the REST client that operates on it.

GuildRef::active_threads

List active threads in this guild.

GuildRef::add_member

Add a user to this guild.

GuildRef::auto_moderation_rule_ref

Bind an auto-moderation rule id in this guild to the client.

GuildRef::auto_moderation_rules

List auto-moderation rules in this guild.

GuildRef::begin_prune

async fn GuildRef::begin_prune(self : GuildRef, days? : Int, compute_prune_count? : Bool, include_roles? : Array[
Id
[
RoleMarker
]], reason? : String) ->
GuildPruneResult
raise DiscordHttpError

Begin pruning inactive members from this guild.

GuildRef::bulk_ban

async fn GuildRef::bulk_ban(self : GuildRef, user_ids : Array[
Id
[
UserMarker
]], delete_message_seconds? : Int, reason? : String) ->
BulkBanResponse
raise DiscordHttpError

Ban up to 200 users from this guild.

GuildRef::channels

List channels in this guild.

GuildRef::create_channel

async fn GuildRef::create_channel(self : GuildRef, name : String, typ? :
ChannelType
, topic? : String, parent_id? :
Id
[
ChannelMarker
], position? : Int, permission_overwrites? : Array[
Overwrite
], nsfw? : Bool, bitrate? : Int, user_limit? : Int, rate_limit_per_user? : Int, rtc_region? : String, video_quality_mode? :
VideoQualityMode
, default_auto_archive_duration? :
ThreadAutoArchiveDuration
, available_tags? : Array[
ForumTagRequest
], default_reaction_emoji? :
DefaultReaction
, default_thread_rate_limit_per_user? : Int, default_sort_order? :
SortOrderType
, default_forum_layout? :
ForumLayoutType
, reason? : String) ->
Channel
raise DiscordHttpError

Create a channel in this guild.

GuildRef::create_emoji

async fn GuildRef::create_emoji(self : GuildRef, name : String, image : String, roles? : Array[
Id
[
RoleMarker
]], reason? : String) ->
Emoji
raise DiscordHttpError

Create a custom emoji in this guild.

GuildRef::create_role

async fn GuildRef::create_role(self : GuildRef, name? : String, permissions? :
Permissions
, color? : Int, colors? :
RoleColors
, hoist? : Bool, icon? : String, unicode_emoji? : String, mentionable? : Bool, reason? : String) ->
Role
raise DiscordHttpError

Create a role in this guild.

GuildRef::create_scheduled_event

async fn GuildRef::create_scheduled_event(self : GuildRef, name : String, privacy_level :
GuildScheduledEventPrivacyLevel
, scheduled_start_time :
Timestamp
, entity_type :
GuildScheduledEventEntityType
, channel_id? :
Id
[
ChannelMarker
], clear_channel_id? : Bool, entity_metadata? :
EntityMetadata
, clear_entity_metadata? : Bool, scheduled_end_time? :
Timestamp
, clear_scheduled_end_time? : Bool, description? : String, image? : String, recurrence_rule? :
GuildScheduledEventRecurrenceRule
, reason? : String) ->
GuildScheduledEvent
raise DiscordHttpError

Create a scheduled event in this guild.

GuildRef::create_soundboard_sound

async fn GuildRef::create_soundboard_sound(self : GuildRef, name : String, sound : String, volume? : Double, emoji_id? :
Id
[
EmojiMarker
], emoji_name? : String, reason? : String) ->
SoundboardSound
raise DiscordHttpError

Create a soundboard sound in this guild.

GuildRef::create_sticker

async fn GuildRef::create_sticker(self : GuildRef, file : FileUpload, name : String, description : String, tags : String, reason? : String) ->
Sticker
raise DiscordHttpError

Create a custom sticker in this guild.

GuildRef::create_template

async fn GuildRef::create_template(self : GuildRef, name : String, description? : String) ->
GuildTemplate
raise DiscordHttpError

Create a template for this guild.

GuildRef::delete_integration

async fn GuildRef::delete_integration(self : GuildRef, integration_id :
Id
[
IntegrationMarker
], reason? : String) -> Unit raise DiscordHttpError

Delete an integration from this guild.

GuildRef::edit

async fn GuildRef::edit(self : GuildRef, name? : String, verification_level? :
VerificationLevel
, default_message_notifications? :
DefaultMessageNotifications
, explicit_content_filter? :
ExplicitContentFilter
, afk_channel_id? :
Id
[
ChannelMarker
], clear_afk_channel_id? : Bool, afk_timeout? : Int, icon? : String, clear_icon? : Bool, owner_id? :
Id
[
UserMarker
], splash? : String, clear_splash? : Bool, discovery_splash? : String, clear_discovery_splash? : Bool, banner? : String, clear_banner? : Bool, system_channel_id? :
Id
[
ChannelMarker
], clear_system_channel_id? : Bool, system_channel_flags? :
SystemChannelFlags
, rules_channel_id? :
Id
[
ChannelMarker
], clear_rules_channel_id? : Bool, public_updates_channel_id? :
Id
[
ChannelMarker
], clear_public_updates_channel_id? : Bool, preferred_locale? : String, features? : Array[
GuildFeature
], description? : String, clear_description? : Bool, premium_progress_bar_enabled? : Bool, safety_alerts_channel_id? :
Id
[
ChannelMarker
], clear_safety_alerts_channel_id? : Bool, reason? : String) ->
Guild
raise DiscordHttpError

Edit this guild.

GuildRef::edit_channel_positions

async fn GuildRef::edit_channel_positions(self : GuildRef, positions : Array[GuildChannelPosition], reason? : String) -> Unit raise DiscordHttpError

Edit channel positions in this guild.

GuildRef::edit_current_member

async fn GuildRef::edit_current_member(self : GuildRef, nick? : String, clear_nick? : Bool, avatar? : String, clear_avatar? : Bool, banner? : String, clear_banner? : Bool, bio? : String, clear_bio? : Bool, reason? : String) ->
GuildMember
raise DiscordHttpError

Edit the current user's member record in this guild.

GuildRef::edit_incident_actions

async fn GuildRef::edit_incident_actions(self : GuildRef, invites_disabled_until? :
Timestamp
, clear_invites_disabled_until? : Bool, dms_disabled_until? :
Timestamp
, clear_dms_disabled_until? : Bool) ->
IncidentsData
raise DiscordHttpError

Edit incident actions for this guild.

GuildRef::edit_my_voice_state

async fn GuildRef::edit_my_voice_state(self : GuildRef, channel_id? :
Id
[
ChannelMarker
], suppress? : Bool, request_to_speak_timestamp? :
Timestamp
, clear_request_to_speak_timestamp? : Bool) -> Unit raise DiscordHttpError

Edit the current user's voice state in this guild.

GuildRef::edit_onboarding

Replace this guild's onboarding configuration.

GuildRef::edit_role_positions

async fn GuildRef::edit_role_positions(self : GuildRef, positions : Array[(
Id
[
RoleMarker
], Int?)], reason? : String) -> Array[
Role
] raise DiscordHttpError

Edit role positions in this guild.

GuildRef::edit_welcome_screen

async fn GuildRef::edit_welcome_screen(self : GuildRef, enabled? : Bool, clear_enabled? : Bool, welcome_channels? : Array[
WelcomeScreenChannel
], clear_welcome_channels? : Bool, description? : String, clear_description? : Bool, reason? : String) ->
WelcomeScreen
raise DiscordHttpError

Edit this guild's welcome screen.

GuildRef::edit_widget

async fn GuildRef::edit_widget(self : GuildRef, enabled? : Bool, channel_id? :
Id
[
ChannelMarker
], clear_channel_id? : Bool, reason? : String) ->
GuildWidgetSettings
raise DiscordHttpError

Edit this guild's widget settings.

GuildRef::emoji_ref

Bind an emoji id in this guild to the client.

GuildRef::emojis

List custom emojis in this guild.

GuildRef::fetch

async fn GuildRef::fetch(self : GuildRef, with_counts? : Bool) ->
Guild
raise DiscordHttpError

Fetch this guild.

GuildRef::fetch_ban

Fetch ban information for a user; use MemberRef::ban to perform a ban.

GuildRef::integrations

List integrations configured for this guild.

GuildRef::invites

List invites for this guild.

GuildRef::leave

async fn GuildRef::leave(self : GuildRef) -> Unit raise DiscordHttpError

Make the bot itself leave this guild.

GuildRef::member_ref

Bind a user id in this guild to the client.

GuildRef::members

Paginate members in this guild.

GuildRef::my_voice_state

Fetch the current user's voice state in this guild.

GuildRef::onboarding

Fetch this guild's onboarding configuration.

GuildRef::preview

Fetch this guild's public preview.

GuildRef::prune_count

Count members that a prune would remove from this guild.

GuildRef::role_ref

Bind a role id in this guild to the client.

GuildRef::roles

List roles in this guild.

GuildRef::scheduled_event_ref

Bind a scheduled event id in this guild to the client.

GuildRef::scheduled_events

async fn GuildRef::scheduled_events(self : GuildRef, with_user_count? : Bool) -> Array[
GuildScheduledEvent
] raise DiscordHttpError

List scheduled events in this guild.

GuildRef::search_members

async fn GuildRef::search_members(self : GuildRef, query : String, limit? : Int) -> Array[
GuildMember
] raise DiscordHttpError

Search members in this guild.

GuildRef::search_messages

async fn GuildRef::search_messages(self : GuildRef, limit? : Int, offset? : Int, slop? : Int, content? : String, mention_everyone? : Bool, pinned? : Bool, include_nsfw? : Bool, sort_by? : String, sort_order? : String, max_id? :
Id
[
MessageMarker
], min_id? :
Id
[
MessageMarker
], channel_id? : Array[
Id
[
ChannelMarker
]], author_type? : Array[String], author_id? : Array[
Id
[
UserMarker
]], mentions? : Array[
Id
[
UserMarker
]], mentions_role_id? : Array[
Id
[
RoleMarker
]], replied_to_user_id? : Array[
Id
[
UserMarker
]], replied_to_message_id? : Array[
Id
[
MessageMarker
]], has? : Array[String], embed_type? : Array[String], embed_provider? : Array[String], link_hostname? : Array[String], attachment_filename? : Array[String], attachment_extension? : Array[String]) ->
GuildMessageSearchResults
raise DiscordHttpError

Search messages in this guild.

GuildRef::soundboard_sound_ref

Bind a soundboard sound id in this guild to the client.

GuildRef::soundboard_sounds

List custom soundboard sounds in this guild.

GuildRef::sticker_ref

Bind a sticker id in this guild to the client.

GuildRef::stickers

List custom stickers in this guild.

GuildRef::template_ref

fn GuildRef::template_ref(self : GuildRef, code : String) -> TemplateRef

Bind a template code in this guild to the client.

GuildRef::templates

List templates for this guild.

GuildRef::vanity_url

Fetch this guild's vanity invite information.

GuildRef::voice_regions

List voice regions available to this guild.

GuildRef::webhooks

List webhooks belonging to this guild.

GuildRef::welcome_screen

Fetch this guild's welcome screen.

GuildRef::widget

Fetch this guild's public widget representation.

GuildRef::widget_image_url

fn GuildRef::widget_image_url(self : GuildRef, style? : String) -> String

Build this guild's widget image URL.

GuildRef::widget_settings

Fetch this guild's widget settings.

HttpRequest

pub(all) struct HttpRequest {
route : Route
body : Json?
audit_reason : String?
files : Array[FileUpload]?
headers : Map[String, String]
}

One logical REST call before transport encoding. Middleware may pass a rebuilt value to next. headers are extra headers merged into the wire request after the client's base headers (content-type negotiation for bodied requests still wins).

HttpResponse

pub(all) struct HttpResponse {
status : Int
headers : Map[String, String]
body : Json
}

Final wire response for one logical call (after internal 429 retries), before status-code-to-error mapping.

InviteRef

pub struct InviteRef {
// private fields
}

An invite code bound to the REST client that operates on it.

InviteRef::delete

async fn InviteRef::delete(self : InviteRef, reason? : String) ->
Invite
raise DiscordHttpError

Delete this invite.

InviteRef::fetch

Fetch this invite.

InviteRef::target_users_job_status

Fetch this invite's latest target-user update job status.

InviteRef::update_target_users

async fn InviteRef::update_target_users(self : InviteRef, target_users_file : FileUpload) -> Unit raise DiscordHttpError

Replace this invite's target users from a CSV file.

MemberRef

pub struct MemberRef {
// private fields
}

A guild member identity bound to the REST client that operates on it.

MemberRef::add_role

async fn MemberRef::add_role(self : MemberRef, role_id :
Id
[
RoleMarker
], reason? : String) -> Unit raise DiscordHttpError

Add a role to this member.

MemberRef::ban

async fn MemberRef::ban(self : MemberRef, delete_message_seconds? : Int, reason? : String) -> Unit raise DiscordHttpError

Ban this member from the guild.

MemberRef::edit

async fn MemberRef::edit(self : MemberRef, nick? : String, clear_nick? : Bool, roles? : Array[
Id
[
RoleMarker
]], mute? : Bool, deaf? : Bool, channel_id? :
Id
[
ChannelMarker
], clear_channel_id? : Bool, communication_disabled_until? :
Timestamp
, clear_communication_disabled_until? : Bool, flags? :
GuildMemberFlags
, reason? : String) ->
GuildMember
raise DiscordHttpError

Edit this guild member.

MemberRef::edit_voice_state

async fn MemberRef::edit_voice_state(self : MemberRef, channel_id :
Id
[
ChannelMarker
], suppress? : Bool) -> Unit raise DiscordHttpError

Edit this user's voice state in the guild.

MemberRef::fetch

Fetch this guild member.

MemberRef::kick

async fn MemberRef::kick(self : MemberRef, reason? : String) -> Unit raise DiscordHttpError

Remove this member from the guild.

MemberRef::remove_role

async fn MemberRef::remove_role(self : MemberRef, role_id :
Id
[
RoleMarker
], reason? : String) -> Unit raise DiscordHttpError

Remove a role from this member.

MemberRef::timeout

Set this member's communication timeout, or clear it when until is None.

MemberRef::unban

async fn MemberRef::unban(self : MemberRef, reason? : String) -> Unit raise DiscordHttpError

Remove this user's ban; the target does not need to be a current member.

MemberRef::voice_state

Fetch this user's voice state in the guild.

MessageRef

pub struct MessageRef {
// private fields
}

A message id and its channel id bound to the REST client that operates on it.

MessageRef::crosspost

Crosspost this message from an announcement channel to its followers.

MessageRef::delete

async fn MessageRef::delete(self : MessageRef, reason? : String) -> Unit raise DiscordHttpError

Delete this message.

MessageRef::delete_reactions

async fn MessageRef::delete_reactions(self : MessageRef) -> Unit raise DiscordHttpError

Delete every reaction from this message, regardless of emoji or user.

MessageRef::delete_reactions_for

async fn MessageRef::delete_reactions_for(self : MessageRef, emoji : String) -> Unit raise DiscordHttpError

Delete every reaction for one emoji. emoji must already be URL-encoded.

MessageRef::delete_user_reaction

async fn MessageRef::delete_user_reaction(self : MessageRef, emoji : String, user_id :
Id
[
UserMarker
]) -> Unit raise DiscordHttpError

Delete a specific user's reaction. emoji must already be URL-encoded.

MessageRef::expire_poll

Immediately expire this message's poll.

MessageRef::fetch

Fetch this message.

MessageRef::forward

Forward this message to another channel (a snapshot reference; no other content may accompany it).

MessageRef::pin

async fn MessageRef::pin(self : MessageRef, reason? : String) -> Unit raise DiscordHttpError

Pin this message.

MessageRef::poll_answer_voters

Paginate users who selected one answer in this message's poll.

MessageRef::react

async fn MessageRef::react(self : MessageRef, emoji : String) -> Unit raise DiscordHttpError

Add the current user's reaction. emoji must already be URL-encoded.

MessageRef::reactions

List users who reacted with emoji, which must already be URL-encoded.

MessageRef::start_thread

async fn MessageRef::start_thread(self : MessageRef, name : String, auto_archive_duration? :
ThreadAutoArchiveDuration
, rate_limit_per_user? : Int, reason? : String) ->
Channel
raise DiscordHttpError

Start a thread from this message.

MessageRef::unpin

async fn MessageRef::unpin(self : MessageRef, reason? : String) -> Unit raise DiscordHttpError

Remove this message's pin.

MessageRef::unreact

async fn MessageRef::unreact(self : MessageRef, emoji : String) -> Unit raise DiscordHttpError

Delete the current user's reaction. emoji must already be URL-encoded.

MultipartChunk

pub enum MultipartChunk {
Text(String)
Blob(Bytes)
}

One chunk of a multipart body, written to the wire in order. File contents stay as their original Bytes (no copying or concatenation).

Paginator

pub struct Paginator[T] {
// private fields
}

A stateful, asynchronously fetched sequence of REST result pages.

Call next_page, each, or collect sequentially; all three consume the same cursor state.

Paginator::collect

async fn[T] Paginator::collect(self : Paginator[T], max~ : Int) -> Array[T]

Collect at most max remaining items. A non-positive maximum performs no requests and returns an empty array.

Paginator::each

async fn[T] Paginator::each(self : Paginator[T], f : (T) -> Unit raise) -> Unit

Apply a synchronous callback to every remaining item.

Paginator::next_page

async fn[T] Paginator::next_page(self : Paginator[T]) -> Array[T]?

Fetch the next non-empty page, or None after the paginator reaches its end. Empty and short REST pages both mark the sequence as finished.

RoleRef

pub struct RoleRef {
// private fields
}

A role id and its guild id bound to the REST client that operates on it.

RoleRef::delete

async fn RoleRef::delete(self : RoleRef, reason? : String) -> Unit raise DiscordHttpError

Delete this role.

RoleRef::edit

async fn RoleRef::edit(self : RoleRef, name? : String, permissions? :
Permissions
, color? : Int, colors? :
RoleColors
, hoist? : Bool, icon? : String, clear_icon? : Bool, unicode_emoji? : String, clear_unicode_emoji? : Bool, mentionable? : Bool, reason? : String) ->
Role
raise DiscordHttpError

Edit this role.

RoleRef::fetch

Fetch this role.

Route

pub(all) enum Route {
Custom(request_method~ :
RequestMethod
, path~ : String, bucket_key~ : String, is_interaction~ : Bool, supports_reason~ : Bool)
GetGateway
GetGatewayBot
GetCurrentApplication
EditCurrentApplication
GetApplicationActivityInstance(application_id~ :
Id
[
ApplicationMarker
], instance_id~ : String)
GetApplicationRoleConnectionMetadataRecords(application_id~ :
Id
[
ApplicationMarker
])
UpdateApplicationRoleConnectionMetadataRecords(application_id~ :
Id
[
ApplicationMarker
])
ListApplicationEmojis(application_id~ :
Id
[
ApplicationMarker
])
GetApplicationEmoji(application_id~ :
Id
[
ApplicationMarker
], emoji_id~ :
Id
[
EmojiMarker
])
CreateApplicationEmoji(application_id~ :
Id
[
ApplicationMarker
])
ModifyApplicationEmoji(application_id~ :
Id
[
ApplicationMarker
], emoji_id~ :
Id
[
EmojiMarker
])
DeleteApplicationEmoji(application_id~ :
Id
[
ApplicationMarker
], emoji_id~ :
Id
[
EmojiMarker
])
ListEntitlements(application_id~ :
Id
[
ApplicationMarker
], query~ : String)
GetEntitlement(application_id~ :
Id
[
ApplicationMarker
], entitlement_id~ :
Id
[
EntitlementMarker
])
CreateTestEntitlement(application_id~ :
Id
[
ApplicationMarker
])
ConsumeEntitlement(application_id~ :
Id
[
ApplicationMarker
], entitlement_id~ :
Id
[
EntitlementMarker
])
DeleteTestEntitlement(application_id~ :
Id
[
ApplicationMarker
], entitlement_id~ :
Id
[
EntitlementMarker
])
ListSkus(application_id~ :
Id
[
ApplicationMarker
])
ListSkuSubscriptions(sku_id~ :
Id
[
SkuMarker
], query~ : String)
GetSkuSubscription(sku_id~ :
Id
[
SkuMarker
], subscription_id~ :
Id
[
SubscriptionMarker
])
GetCurrentUser
GetCurrentUserGuilds(query~ : String)
GetCurrentUserConnections
GetCurrentUserGuildMember(guild_id~ :
Id
[
GuildMarker
])
GetCurrentUserApplicationRoleConnection(application_id~ :
Id
[
ApplicationMarker
])
UpdateCurrentUserApplicationRoleConnection(application_id~ :
Id
[
ApplicationMarker
])
DeleteCurrentUserApplicationRoleConnection(application_id~ :
Id
[
ApplicationMarker
])
LeaveGuild(guild_id~ :
Id
[
GuildMarker
])
GetUser(user_id~ :
Id
[
UserMarker
])
ModifyCurrentUser
CreateDm
GetCurrentAuthorizationInformation
GetCurrentBotApplicationInformation
GetChannel(channel_id~ :
Id
[
ChannelMarker
])
ModifyChannel(channel_id~ :
Id
[
ChannelMarker
])
DeleteChannel(channel_id~ :
Id
[
ChannelMarker
])
GetChannelMessages(channel_id~ :
Id
[
ChannelMarker
], query~ : String)
GetChannelMessage(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
])
CreateMessage(channel_id~ :
Id
[
ChannelMarker
])
EditMessage(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
])
DeleteMessage(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
])
BulkDeleteMessages(channel_id~ :
Id
[
ChannelMarker
])
CreateReaction(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
], emoji~ : String)
DeleteOwnReaction(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
], emoji~ : String)
DeleteUserReaction(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
], emoji~ : String, user_id~ :
Id
[
UserMarker
])
DeleteAllReactions(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
])
DeleteAllReactionsForEmoji(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
], emoji~ : String)
CrosspostMessage(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
])
GetReactions(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
], emoji~ : String, query~ : String)
GetPollAnswerVoters(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
], answer_id~ : Int, query~ : String)
ExpirePoll(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
])
SendSoundboardSound(channel_id~ :
Id
[
ChannelMarker
])
TriggerTypingIndicator(channel_id~ :
Id
[
ChannelMarker
])
PinMessage(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
])
UnpinMessage(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
])
GetChannelPins(channel_id~ :
Id
[
ChannelMarker
], query~ : String)
GetPinnedMessages(channel_id~ :
Id
[
ChannelMarker
])
EditChannelPermissions(channel_id~ :
Id
[
ChannelMarker
], overwrite_id~ :
Id
[
GenericMarker
])
DeleteChannelPermission(channel_id~ :
Id
[
ChannelMarker
], overwrite_id~ :
Id
[
GenericMarker
])
GetChannelInvites(channel_id~ :
Id
[
ChannelMarker
])
CreateChannelInvite(channel_id~ :
Id
[
ChannelMarker
])
FollowAnnouncementChannel(channel_id~ :
Id
[
ChannelMarker
])
SetVoiceChannelStatus(channel_id~ :
Id
[
ChannelMarker
])
GroupDmAddRecipient(channel_id~ :
Id
[
ChannelMarker
], user_id~ :
Id
[
UserMarker
])
GroupDmRemoveRecipient(channel_id~ :
Id
[
ChannelMarker
], user_id~ :
Id
[
UserMarker
])
CreateWebhook(channel_id~ :
Id
[
ChannelMarker
])
GetChannelWebhooks(channel_id~ :
Id
[
ChannelMarker
])
StartThreadFromMessage(channel_id~ :
Id
[
ChannelMarker
], message_id~ :
Id
[
MessageMarker
])
StartThreadWithoutMessage(channel_id~ :
Id
[
ChannelMarker
])
JoinThread(channel_id~ :
Id
[
ChannelMarker
])
LeaveThread(channel_id~ :
Id
[
ChannelMarker
])
ListThreadMembers(channel_id~ :
Id
[
ChannelMarker
], query~ : String)
GetThreadMember(channel_id~ :
Id
[
ChannelMarker
], user_id~ :
Id
[
UserMarker
], query~ : String)
AddThreadMember(channel_id~ :
Id
[
ChannelMarker
], user_id~ :
Id
[
UserMarker
])
RemoveThreadMember(channel_id~ :
Id
[
ChannelMarker
], user_id~ :
Id
[
UserMarker
])
ListPublicArchivedThreads(channel_id~ :
Id
[
ChannelMarker
], query~ : String)
ListPrivateArchivedThreads(channel_id~ :
Id
[
ChannelMarker
], query~ : String)
ListJoinedPrivateArchivedThreads(channel_id~ :
Id
[
ChannelMarker
], query~ : String)
ListActiveGuildThreads(guild_id~ :
Id
[
GuildMarker
])
SearchGuildMessages(guild_id~ :
Id
[
GuildMarker
], query~ : String)
GetGuild(guild_id~ :
Id
[
GuildMarker
])
GetGuildWithCounts(guild_id~ :
Id
[
GuildMarker
], query~ : String)
ModifyGuild(guild_id~ :
Id
[
GuildMarker
])
GetGuildPreview(guild_id~ :
Id
[
GuildMarker
])
GetGuildChannels(guild_id~ :
Id
[
GuildMarker
])
CreateGuildChannel(guild_id~ :
Id
[
GuildMarker
])
ModifyGuildChannelPositions(guild_id~ :
Id
[
GuildMarker
])
GetGuildMember(guild_id~ :
Id
[
GuildMarker
], user_id~ :
Id
[
UserMarker
])
ListGuildMembers(guild_id~ :
Id
[
GuildMarker
], query~ : String)
SearchGuildMembers(guild_id~ :
Id
[
GuildMarker
], query~ : String)
ModifyGuildMember(guild_id~ :
Id
[
GuildMarker
], user_id~ :
Id
[
UserMarker
])
ModifyCurrentMember(guild_id~ :
Id
[
GuildMarker
])
AddGuildMember(guild_id~ :
Id
[
GuildMarker
], user_id~ :
Id
[
UserMarker
])
GetGuildRoles(guild_id~ :
Id
[
GuildMarker
])
GetGuildRole(guild_id~ :
Id
[
GuildMarker
], role_id~ :
Id
[
RoleMarker
])
CreateGuildRole(guild_id~ :
Id
[
GuildMarker
])
ModifyGuildRolePositions(guild_id~ :
Id
[
GuildMarker
])
ModifyGuildRole(guild_id~ :
Id
[
GuildMarker
], role_id~ :
Id
[
RoleMarker
])
DeleteGuildRole(guild_id~ :
Id
[
GuildMarker
], role_id~ :
Id
[
RoleMarker
])
AddGuildMemberRole(guild_id~ :
Id
[
GuildMarker
], user_id~ :
Id
[
UserMarker
], role_id~ :
Id
[
RoleMarker
])
RemoveGuildMemberRole(guild_id~ :
Id
[
GuildMarker
], user_id~ :
Id
[
UserMarker
], role_id~ :
Id
[
RoleMarker
])
RemoveGuildMember(guild_id~ :
Id
[
GuildMarker
], user_id~ :
Id
[
UserMarker
])
CreateGuildBan(guild_id~ :
Id
[
GuildMarker
], user_id~ :
Id
[
UserMarker
])
RemoveGuildBan(guild_id~ :
Id
[
GuildMarker
], user_id~ :
Id
[
UserMarker
])
GetGuildBan(guild_id~ :
Id
[
GuildMarker
], user_id~ :
Id
[
UserMarker
])
GetGuildBans(guild_id~ :
Id
[
GuildMarker
], query~ : String)
BulkGuildBan(guild_id~ :
Id
[
GuildMarker
])
GetGuildPruneCount(guild_id~ :
Id
[
GuildMarker
], query~ : String)
BeginGuildPrune(guild_id~ :
Id
[
GuildMarker
])
GetGuildVoiceRegions(guild_id~ :
Id
[
GuildMarker
])
GetGuildInvites(guild_id~ :
Id
[
GuildMarker
])
GetGuildIntegrations(guild_id~ :
Id
[
GuildMarker
])
DeleteGuildIntegration(guild_id~ :
Id
[
GuildMarker
], integration_id~ :
Id
[
IntegrationMarker
])
GetGuildVanityUrl(guild_id~ :
Id
[
GuildMarker
])
GetGuildWidgetSettings(guild_id~ :
Id
[
GuildMarker
])
ModifyGuildWidget(guild_id~ :
Id
[
GuildMarker
])
GetGuildWidget(guild_id~ :
Id
[
GuildMarker
])
GetGuildWelcomeScreen(guild_id~ :
Id
[
GuildMarker
])
ModifyGuildWelcomeScreen(guild_id~ :
Id
[
GuildMarker
])
GetGuildOnboarding(guild_id~ :
Id
[
GuildMarker
])
ModifyGuildOnboarding(guild_id~ :
Id
[
GuildMarker
])
ModifyGuildIncidentActions(guild_id~ :
Id
[
GuildMarker
])
GetGuildAuditLog(guild_id~ :
Id
[
GuildMarker
], query~ : String)
ListAutoModerationRules(guild_id~ :
Id
[
GuildMarker
])
GetAutoModerationRule(guild_id~ :
Id
[
GuildMarker
], rule_id~ :
Id
[
AutoModerationRuleMarker
])
CreateAutoModerationRule(guild_id~ :
Id
[
GuildMarker
])
ModifyAutoModerationRule(guild_id~ :
Id
[
GuildMarker
], rule_id~ :
Id
[
AutoModerationRuleMarker
])
DeleteAutoModerationRule(guild_id~ :
Id
[
GuildMarker
], rule_id~ :
Id
[
AutoModerationRuleMarker
])
ListGuildStickers(guild_id~ :
Id
[
GuildMarker
])
GetGuildSticker(guild_id~ :
Id
[
GuildMarker
], sticker_id~ :
Id
[
StickerMarker
])
CreateGuildSticker(guild_id~ :
Id
[
GuildMarker
])
ModifyGuildSticker(guild_id~ :
Id
[
GuildMarker
], sticker_id~ :
Id
[
StickerMarker
])
DeleteGuildSticker(guild_id~ :
Id
[
GuildMarker
], sticker_id~ :
Id
[
StickerMarker
])
ListGuildScheduledEvents(guild_id~ :
Id
[
GuildMarker
], query~ : String)
CreateGuildScheduledEvent(guild_id~ :
Id
[
GuildMarker
])
GetGuildScheduledEvent(guild_id~ :
Id
[
GuildMarker
], event_id~ :
Id
[
ScheduledEventMarker
], query~ : String)
ModifyGuildScheduledEvent(guild_id~ :
Id
[
GuildMarker
], event_id~ :
Id
[
ScheduledEventMarker
])
DeleteGuildScheduledEvent(guild_id~ :
Id
[
GuildMarker
], event_id~ :
Id
[
ScheduledEventMarker
])
ListGuildScheduledEventUsers(guild_id~ :
Id
[
GuildMarker
], event_id~ :
Id
[
ScheduledEventMarker
], query~ : String)
ListGuildSoundboardSounds(guild_id~ :
Id
[
GuildMarker
])
CreateGuildSoundboardSound(guild_id~ :
Id
[
GuildMarker
])
GetGuildSoundboardSound(guild_id~ :
Id
[
GuildMarker
], sound_id~ :
Id
[
SoundboardSoundMarker
])
ModifyGuildSoundboardSound(guild_id~ :
Id
[
GuildMarker
], sound_id~ :
Id
[
SoundboardSoundMarker
])
DeleteGuildSoundboardSound(guild_id~ :
Id
[
GuildMarker
], sound_id~ :
Id
[
SoundboardSoundMarker
])
GetGuildWebhooks(guild_id~ :
Id
[
GuildMarker
])
ListGuildEmojis(guild_id~ :
Id
[
GuildMarker
])
GetGuildEmoji(guild_id~ :
Id
[
GuildMarker
], emoji_id~ :
Id
[
EmojiMarker
])
CreateGuildEmoji(guild_id~ :
Id
[
GuildMarker
])
ModifyGuildEmoji(guild_id~ :
Id
[
GuildMarker
], emoji_id~ :
Id
[
EmojiMarker
])
DeleteGuildEmoji(guild_id~ :
Id
[
GuildMarker
], emoji_id~ :
Id
[
EmojiMarker
])
GetSticker(sticker_id~ :
Id
[
StickerMarker
])
ListStickerPacks
GetStickerPack(pack_id~ :
Id
[
StickerPackMarker
])
ListDefaultSoundboardSounds
ListVoiceRegions
GetCurrentUserVoiceState(guild_id~ :
Id
[
GuildMarker
])
GetUserVoiceState(guild_id~ :
Id
[
GuildMarker
], user_id~ :
Id
[
UserMarker
])
ModifyCurrentUserVoiceState(guild_id~ :
Id
[
GuildMarker
])
ModifyUserVoiceState(guild_id~ :
Id
[
GuildMarker
], user_id~ :
Id
[
UserMarker
])
GetGuildTemplate(template_code~ : String)
CreateGuildFromTemplate(template_code~ : String)
GetGuildTemplates(guild_id~ :
Id
[
GuildMarker
])
CreateGuildTemplate(guild_id~ :
Id
[
GuildMarker
])
SyncGuildTemplate(guild_id~ :
Id
[
GuildMarker
], template_code~ : String)
ModifyGuildTemplate(guild_id~ :
Id
[
GuildMarker
], template_code~ : String)
DeleteGuildTemplate(guild_id~ :
Id
[
GuildMarker
], template_code~ : String)
CreateStageInstance
GetStageInstance(channel_id~ :
Id
[
ChannelMarker
])
ModifyStageInstance(channel_id~ :
Id
[
ChannelMarker
])
DeleteStageInstance(channel_id~ :
Id
[
ChannelMarker
])
GetInvite(code~ : String, query~ : String)
DeleteInvite(code~ : String)
UpdateInviteTargetUsers(code~ : String)
GetInviteTargetUsersJobStatus(code~ : String)
GetWebhook(webhook_id~ :
Id
[
WebhookMarker
])
ModifyWebhook(webhook_id~ :
Id
[
WebhookMarker
])
DeleteWebhook(webhook_id~ :
Id
[
WebhookMarker
])
GetWebhookWithToken(webhook_id~ :
Id
[
WebhookMarker
], token~ : String)
ModifyWebhookWithToken(webhook_id~ :
Id
[
WebhookMarker
], token~ : String)
DeleteWebhookWithToken(webhook_id~ :
Id
[
WebhookMarker
], token~ : String)
ExecuteWebhook(webhook_id~ :
Id
[
WebhookMarker
], token~ : String, query~ : String)
ExecuteSlackCompatibleWebhook(webhook_id~ :
Id
[
WebhookMarker
], token~ : String, query~ : String)
ExecuteGithubCompatibleWebhook(webhook_id~ :
Id
[
WebhookMarker
], token~ : String, query~ : String)
GetWebhookMessage(webhook_id~ :
Id
[
WebhookMarker
], token~ : String, message_id~ :
Id
[
MessageMarker
], query~ : String)
EditWebhookMessage(webhook_id~ :
Id
[
WebhookMarker
], token~ : String, message_id~ :
Id
[
MessageMarker
], query~ : String)
DeleteWebhookMessage(webhook_id~ :
Id
[
WebhookMarker
], token~ : String, message_id~ :
Id
[
MessageMarker
], query~ : String)
CreateInteractionResponse(interaction_id~ :
Id
[
InteractionMarker
], token~ : String, query~ : String)
GetOriginalInteractionResponse(application_id~ :
Id
[
ApplicationMarker
], token~ : String)
EditOriginalInteractionResponse(application_id~ :
Id
[
ApplicationMarker
], token~ : String)
DeleteOriginalInteractionResponse(application_id~ :
Id
[
ApplicationMarker
], token~ : String)
CreateFollowupMessage(application_id~ :
Id
[
ApplicationMarker
], token~ : String)
GetFollowupMessage(application_id~ :
Id
[
ApplicationMarker
], token~ : String, message_id~ :
Id
[
MessageMarker
])
EditFollowupMessage(application_id~ :
Id
[
ApplicationMarker
], token~ : String, message_id~ :
Id
[
MessageMarker
])
DeleteFollowupMessage(application_id~ :
Id
[
ApplicationMarker
], token~ : String, message_id~ :
Id
[
MessageMarker
])
GetGlobalCommands(application_id~ :
Id
[
ApplicationMarker
], query~ : String)
CreateGlobalCommand(application_id~ :
Id
[
ApplicationMarker
])
GetGlobalCommand(application_id~ :
Id
[
ApplicationMarker
], command_id~ :
Id
[
CommandMarker
])
EditGlobalCommand(application_id~ :
Id
[
ApplicationMarker
], command_id~ :
Id
[
CommandMarker
])
DeleteGlobalCommand(application_id~ :
Id
[
ApplicationMarker
], command_id~ :
Id
[
CommandMarker
])
BulkOverwriteGlobalCommands(application_id~ :
Id
[
ApplicationMarker
])
GetGuildCommands(application_id~ :
Id
[
ApplicationMarker
], guild_id~ :
Id
[
GuildMarker
], query~ : String)
CreateGuildCommand(application_id~ :
Id
[
ApplicationMarker
], guild_id~ :
Id
[
GuildMarker
])
GetGuildCommand(application_id~ :
Id
[
ApplicationMarker
], guild_id~ :
Id
[
GuildMarker
], command_id~ :
Id
[
CommandMarker
])
EditGuildCommand(application_id~ :
Id
[
ApplicationMarker
], guild_id~ :
Id
[
GuildMarker
], command_id~ :
Id
[
CommandMarker
])
DeleteGuildCommand(application_id~ :
Id
[
ApplicationMarker
], guild_id~ :
Id
[
GuildMarker
], command_id~ :
Id
[
CommandMarker
])
BulkOverwriteGuildCommands(application_id~ :
Id
[
ApplicationMarker
], guild_id~ :
Id
[
GuildMarker
])
GetGuildApplicationCommandPermissions(application_id~ :
Id
[
ApplicationMarker
], guild_id~ :
Id
[
GuildMarker
])
GetApplicationCommandPermissions(application_id~ :
Id
[
ApplicationMarker
], guild_id~ :
Id
[
GuildMarker
], command_id~ :
Id
[
CommandMarker
])
EditApplicationCommandPermissions(application_id~ :
Id
[
ApplicationMarker
], guild_id~ :
Id
[
GuildMarker
], command_id~ :
Id
[
CommandMarker
])
}

One variant per Discord REST endpoint. A route knows its HTTP method, its concrete path (including query string), and its rate-limit bucket key (path template with major parameters kept and minor ones squashed).

Route::bucket

fn Route::bucket(self : Route) -> String

Rate-limit bucket key: method plus path template with application, channel, guild, and webhook ID/token majors kept while minor resource IDs are squashed.

Route::custom

fn Route::custom(request_method~ :
RequestMethod
, path~ : String, bucket? : String, is_interaction? : Bool, supports_reason? : Bool) -> Route raise CustomRouteError

Construct a route for a Discord REST endpoint without a typed wrapper.

path is relative to the configured API base and must start with /; it may include a query string. When bucket is omitted, the rate limiter uses a custom-route namespace plus the HTTP method and query-free concrete path. Supply a bucket explicitly to group minor resource IDs, for example PATCH:/guilds/123/auto-moderation/rules/{}.

Set is_interaction=true only for interaction or webhook-token endpoints: these skip the global rate limit and omit bot-token authentication.

test "derive stable metadata for a custom route" {
let route = @http.Route::custom(
request_method=Get,
path="/guilds/100/stickers?limit=25",
)
inspect(route.path(), content="/guilds/100/stickers?limit=25")
inspect(route.bucket(), content="CUSTOM:GET:/guilds/100/stickers")
assert_true(route.needs_auth())
}

Route::is_interaction

fn Route::is_interaction(self : Route) -> Bool

Interaction/webhook-token endpoints are exempt from the global limit.

Route::method_

The HTTP method this route is requested with.

Route::needs_auth

fn Route::needs_auth(self : Route) -> Bool

Interaction callbacks and webhook-token routes are called without the bot token because the token in the URL authenticates them.

Route::path

fn Route::path(self : Route) -> String

The request path relative to the API base URL, with all route parameters substituted.

Route::supports_reason

fn Route::supports_reason(self : Route) -> Bool

Whether the endpoint accepts the X-Audit-Log-Reason header.

ScheduledEventRef

pub struct ScheduledEventRef {
// private fields
}

A scheduled event id and its guild id bound to the REST client.

ScheduledEventRef::delete

async fn ScheduledEventRef::delete(self : ScheduledEventRef, reason? : String) -> Unit raise DiscordHttpError

Delete this scheduled event.

ScheduledEventRef::edit

async fn ScheduledEventRef::edit(self : ScheduledEventRef, channel_id? :
Id
[
ChannelMarker
], clear_channel_id? : Bool, entity_metadata? :
EntityMetadata
, clear_entity_metadata? : Bool, name? : String, privacy_level? :
GuildScheduledEventPrivacyLevel
, scheduled_start_time? :
Timestamp
, scheduled_end_time? :
Timestamp
, clear_scheduled_end_time? : Bool, description? : String, clear_description? : Bool, entity_type? :
GuildScheduledEventEntityType
, status? :
GuildScheduledEventStatus
, image? : String, clear_image? : Bool, recurrence_rule? :
GuildScheduledEventRecurrenceRule
, clear_recurrence_rule? : Bool, reason? : String) ->
GuildScheduledEvent
raise DiscordHttpError

Edit this scheduled event.

ScheduledEventRef::fetch

Fetch this scheduled event.

SkuRef

pub struct SkuRef {
// private fields
}

A SKU id bound to the REST client that operates on it.

SkuRef::subscription

Fetch one subscription for this SKU.

SkuRef::subscriptions

List subscriptions for this SKU. No SubscriptionRef is provided because subscriptions expose only a single fetch operation.

SoundboardSoundRef

pub struct SoundboardSoundRef {
// private fields
}

A sound id and its guild id bound to the REST client that operates on it.

SoundboardSoundRef::delete

async fn SoundboardSoundRef::delete(self : SoundboardSoundRef, reason? : String) -> Unit raise DiscordHttpError

Delete this guild soundboard sound.

SoundboardSoundRef::edit

async fn SoundboardSoundRef::edit(self : SoundboardSoundRef, name? : String, volume? : Double, emoji_id? :
Id
[
EmojiMarker
], clear_emoji_id? : Bool, emoji_name? : String, clear_emoji_name? : Bool, reason? : String) ->
SoundboardSound
raise DiscordHttpError

Edit this guild soundboard sound.

SoundboardSoundRef::fetch

Fetch this guild soundboard sound.

StickerRef

pub struct StickerRef {
// private fields
}

A sticker id and its guild id bound to the REST client that operates on it.

StickerRef::delete

async fn StickerRef::delete(self : StickerRef, reason? : String) -> Unit raise DiscordHttpError

Delete this custom guild sticker.

StickerRef::edit

async fn StickerRef::edit(self : StickerRef, name? : String, description? : String, clear_description? : Bool, tags? : String, reason? : String) ->
Sticker
raise DiscordHttpError

Edit this custom guild sticker.

StickerRef::fetch

Fetch this custom guild sticker.

TemplateRef

pub struct TemplateRef {
// private fields
}

A template code and its guild id bound to the REST client.

TemplateRef::create_guild

async fn TemplateRef::create_guild(self : TemplateRef, name : String, icon? : String) ->
Guild
raise DiscordHttpError

Create a guild from this template. This resolves by code only and does not use the bound guild id.

TemplateRef::delete

Delete this guild template.

TemplateRef::edit

async fn TemplateRef::edit(self : TemplateRef, name? : String, description? : String, clear_description? : Bool) ->
GuildTemplate
raise DiscordHttpError

Edit this guild template.

TemplateRef::fetch

Fetch this template. This resolves by code only and does not use the bound guild id.

TemplateRef::sync

Sync this template to the bound guild's current state.

UserRef

pub struct UserRef {
// private fields
}

A user id bound to the REST client that operates on it.

UserRef::dm

async fn UserRef::dm(self : UserRef) -> ChannelRef raise DiscordHttpError

Open or reuse a DM channel with this user and bind it to the client.

UserRef::fetch

Fetch this user.

WebhookMessageRef

pub struct WebhookMessageRef {
// private fields
}

A webhook message id bound to its webhook URL token and REST client.

WebhookMessageRef::delete

Delete this webhook message using the webhook's URL token.

WebhookMessageRef::edit

Edit this webhook message using the webhook's URL token.

WebhookMessageRef::fetch

Fetch this webhook message using the webhook's URL token.

WebhookRef

pub struct WebhookRef {
// private fields
}

A webhook id bound to the REST client for bot-authenticated management. Executing the webhook requires a token; use WebhookRef::with_token.

WebhookRef::delete

async fn WebhookRef::delete(self : WebhookRef, reason? : String) -> Unit raise DiscordHttpError

Delete this webhook using bot authentication.

WebhookRef::edit

async fn WebhookRef::edit(self : WebhookRef, name? : String, avatar? : String, clear_avatar? : Bool, channel_id? :
Id
[
ChannelMarker
], reason? : String) ->
Webhook
raise DiscordHttpError

Edit this webhook using bot authentication.

WebhookRef::fetch

Fetch this webhook using bot authentication.

WebhookRef::with_token

fn WebhookRef::with_token(self : WebhookRef, token : String) -> WebhookTokenRef

Bind a URL token to this webhook for token-authenticated operations.

WebhookTokenRef

pub struct WebhookTokenRef {
// private fields
}

A webhook id and URL token bound to the REST client. These operations use token authentication without the bot token and do not support audit reasons.

WebhookTokenRef::delete

async fn WebhookTokenRef::delete(self : WebhookTokenRef) -> Unit raise DiscordHttpError

Delete this webhook using its URL token without bot authentication.

WebhookTokenRef::edit

async fn WebhookTokenRef::edit(self : WebhookTokenRef, name? : String, avatar? : String, clear_avatar? : Bool) ->
Webhook
raise DiscordHttpError

Edit this webhook using its URL token without bot authentication.

WebhookTokenRef::fetch

Fetch this webhook using its URL token without bot authentication.

WebhookTokenRef::message_ref

Bind a message id created by this webhook to the client.

WebhookTokenRef::send

Execute this webhook using its URL token.

WebhookTokenRef::send_github

async fn WebhookTokenRef::send_github(self : WebhookTokenRef, payload : Json, github_event~ : String, thread_id? :
Id
[
ChannelMarker
], wait? : Bool) -> Unit raise DiscordHttpError

Execute a GitHub-compatible payload using this webhook's URL token.

WebhookTokenRef::send_slack

async fn WebhookTokenRef::send_slack(self : WebhookTokenRef, payload : Json, thread_id? :
Id
[
ChannelMarker
], wait? : Bool) -> Unit raise DiscordHttpError

Execute a Slack-compatible payload using this webhook's URL token.

VERSION

let VERSION : String

Library version, sent in the User-Agent header.

attachments_json

fn attachments_json(files : Array[FileUpload]) -> Json

The attachments array announcing uploaded files inside payload_json: [{ "id": n, "filename": ..., "description"? : ... }]. The typed wrappers add this automatically; use it when building an InteractionResponse with files by hand.

encode_multipart_body

fn encode_multipart_body(payload_json : String, files : Array[FileUpload]) -> (String, Array[MultipartChunk]) raise DiscordHttpError

Encode an interaction-callback multipart/form-data body: the payload_json part followed by one files[n] part per file, in the same wire format as the REST upload path. Returns the Content-Type value (including the boundary) and the ordered wire chunks. Filenames are validated like the REST upload path.

test "keep uploaded bytes as a multipart blob chunk" {
let (content_type, chunks) = @http.encode_multipart_body("{\"type\":4}", [
FileUpload("hello.txt", b"hello", content_type="text/plain"),
])
assert_true(content_type.has_prefix("multipart/form-data; boundary="))
match chunks {
[Text(payload), Text(file_header), Blob(content), ..] => {
assert_true(payload.contains("payload_json"))
assert_true(file_header.contains("files[0]"))
assert_eq(content, b"hello")
}
_ => fail("unexpected multipart chunk layout")
}
}