pub struct InteractionClient<'a> { /* private fields */ }
Expand description

Client interface for using interactions.

Examples

Retrieve the application ID and then use an interaction request:

use std::env;
use twilight_http::Client;
use twilight_model::id::Id;

let client = Client::new(env::var("DISCORD_TOKEN")?);
let application_id = Id::new(123);

let interaction_client = client.interaction(application_id);

let commands = interaction_client
    .global_commands()
    .exec()
    .await?
    .models()
    .await?;

println!("there are {} global commands", commands.len());

Implementations

Respond to an interaction, by its ID and token.

For variants of InteractionResponse that contain InteractionResponseData, there is an associated builder in the twilight-util crate.

This endpoint is not bound to the application’s global rate limit.

Delete the original message, by its token.

This endpoint is not bound to the application’s global rate limit.

Get the original message, by its token.

This endpoint is not bound to the application’s global rate limit.

Edit the original message, by its token.

This endpoint is not bound to the application’s global rate limit.

Create a followup message to an interaction, by its token.

The message must include at least one of attachments, content, or embeds.

This endpoint is not bound to the application’s global rate limit.

Examples
use std::env;
use twilight_http::Client;
use twilight_model::id::Id;

let client = Client::new(env::var("DISCORD_TOKEN")?);
let application_id = Id::new(1);

client
    .interaction(application_id)
    .create_followup("webhook token")
    .content("Pinkie...")?
    .exec()
    .await?;

Delete a followup message to an interaction, by its token and message ID.

This endpoint is not bound to the application’s global rate limit.

Get a followup message of an interaction, by its token and the message ID.

This endpoint is not bound to the application’s global rate limit.

Edit a followup message of an interaction, by its token and the message ID.

This endpoint is not bound to the application’s global rate limit.

Create a new global command.

Delete a global command, by ID.

Fetch a global command for your application.

Fetch all global commands for your application.

Set global commands.

This method is idempotent: it can be used on every start, without being ratelimited if there aren’t changes to the commands.

The Command struct has an associated builder in the twilight-util crate.

Edit a global command, by ID.

You must specify a name and description. See Discord Docs/Edit Global Application Command.

Create a new command in a guild.

Delete a command in a guild, by ID.

Fetch a guild command for your application.

Fetch all commands for a guild, by ID.

Set a guild’s commands.

This method is idempotent: it can be used on every start, without being ratelimited if there aren’t changes to the commands.

The Command struct has an associated builder in the twilight-util crate.

Edit a command in a guild, by ID.

You must specify a name and description. See Discord Docs/Edit Guild Application Command.

Fetch command permissions for a command from the current application in a guild.

Fetch command permissions for all commands from the current application in a guild.

Update command permissions for a single command in a guild.

This overwrites the command permissions so the full set of permissions have to be sent every time.

Errors

Returns an error of type PermissionsCountInvalid if the permissions are invalid.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more