code stringlengths 40 729k | docstring stringlengths 22 46.3k | func_name stringlengths 1 97 | language stringclasses 1
value | repo stringlengths 6 48 | path stringlengths 8 176 | url stringlengths 47 228 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
pub const fn channel_invites(&self, channel_id: Id<ChannelMarker>) -> GetChannelInvites<'_> {
GetChannelInvites::new(self, channel_id)
} | Get the invites for a guild channel.
Requires the [`MANAGE_CHANNELS`] permission. This method only works if
the channel is a guild channel.
[`MANAGE_CHANNELS`]: twilight_model::guild::Permissions::MANAGE_CHANNELS | channel_invites | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn update_channel_permission(
&self,
channel_id: Id<ChannelMarker>,
permission_overwrite: &PermissionOverwrite,
) -> UpdateChannelPermission<'_> {
UpdateChannelPermission::new(self, channel_id, permission_overwrite)
} | Update the permissions for a role or a user in a channel.
# Examples:
Create permission overrides for a role to view the channel, but not send
messages:
```no_run
# #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> {
# use twilight_http::Client;
# let client = Client::new("my token".to_owned()... | update_channel_permission | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn channel_webhooks(&self, channel_id: Id<ChannelMarker>) -> GetChannelWebhooks<'_> {
GetChannelWebhooks::new(self, channel_id)
} | Get all the webhooks of a channel. | channel_webhooks | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn current_user_guild_member(
&self,
guild_id: Id<GuildMarker>,
) -> GetCurrentUserGuildMember<'_> {
GetCurrentUserGuildMember::new(self, guild_id)
} | Get information about the current user in a guild. | current_user_guild_member | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn current_user_voice_state(
&self,
guild_id: Id<GuildMarker>,
) -> GetCurrentUserVoiceState<'_> {
GetCurrentUserVoiceState::new(self, guild_id)
} | Get voice state of the current user in a guild.
# Caveats
- Current user must already have joined a voice/stage channel in this guild. | current_user_voice_state | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn update_current_user_voice_state(
&self,
guild_id: Id<GuildMarker>,
) -> UpdateCurrentUserVoiceState<'_> {
UpdateCurrentUserVoiceState::new(self, guild_id)
} | Update the current user's voice state.
All parameters are optional.
# Caveats
- `channel_id` must currently point to a stage channel.
- Current user must have already joined `channel_id`. | update_current_user_voice_state | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn emojis(&self, guild_id: Id<GuildMarker>) -> GetEmojis<'_> {
GetEmojis::new(self, guild_id)
} | Get the emojis for a guild, by the guild's id.
# Examples
Get the emojis for guild `100`:
```no_run
# use twilight_http::Client;
# use twilight_model::id::Id;
#
# #[tokio::main]
# async fn main() -> Result<(), Box<dyn std::error::Error>> {
# let client = Client::new("my token".to_owned());
#
let guild_id = Id::new(1... | emojis | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn entitlements(&self, application_id: Id<ApplicationMarker>) -> GetEntitlements<'_> {
GetEntitlements::new(self, application_id)
} | Get the entitlements for an application.
# Examples
Get emojis for the application `100`:
```no_run
# use twilight_http::Client;
# use twilight_model::id::Id;
# #[tokio::main]
# async fn main() -> Result<(), Box<dyn std::error::Error>> {
# let client = Client::new("my token".to_owned());
#
let application_id = Id::... | entitlements | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn emoji(
&self,
guild_id: Id<GuildMarker>,
emoji_id: Id<EmojiMarker>,
) -> GetEmoji<'_> {
GetEmoji::new(self, guild_id, emoji_id)
} | Get an emoji for a guild by the the guild's ID and emoji's ID.
# Examples
Get emoji `100` from guild `50`:
```no_run
# use twilight_http::Client;
# use twilight_model::id::Id;
#
# #[tokio::main]
# async fn main() -> Result<(), Box<dyn std::error::Error>> {
# let client = Client::new("my token".to_owned());
#
let gui... | emoji | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn create_emoji<'a>(
&'a self,
guild_id: Id<GuildMarker>,
name: &'a str,
image: &'a str,
) -> CreateEmoji<'a> {
CreateEmoji::new(self, guild_id, name, image)
} | Create an emoji in a guild.
The emoji must be a Data URI, in the form of
`data:image/{type};base64,{data}` where `{type}` is the image MIME type
and `{data}` is the base64-encoded image. See [Discord Docs/Image Data].
[Discord Docs/Image Data]: https://discord.com/developers/docs/reference#image-data | create_emoji | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn delete_emoji(
&self,
guild_id: Id<GuildMarker>,
emoji_id: Id<EmojiMarker>,
) -> DeleteEmoji<'_> {
DeleteEmoji::new(self, guild_id, emoji_id)
} | Delete an emoji in a guild, by id. | delete_emoji | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn update_emoji(
&self,
guild_id: Id<GuildMarker>,
emoji_id: Id<EmojiMarker>,
) -> UpdateEmoji<'_> {
UpdateEmoji::new(self, guild_id, emoji_id)
} | Update an emoji in a guild, by id. | update_emoji | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub fn create_guild(&self, name: String) -> CreateGuild<'_> {
CreateGuild::new(self, name)
} | Create a new request to create a guild.
The minimum length of the name is 2 UTF-16 characters and the maximum is 100 UTF-16
characters. This endpoint can only be used by bots in less than 10 guilds.
# Errors
Returns a [`CreateGuildErrorType::NameInvalid`] error type if the name
length is too short or too long.
[`Cr... | create_guild | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn delete_guild(&self, guild_id: Id<GuildMarker>) -> DeleteGuild<'_> {
DeleteGuild::new(self, guild_id)
} | Delete a guild permanently. The user must be the owner. | delete_guild | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn update_guild(&self, guild_id: Id<GuildMarker>) -> UpdateGuild<'_> {
UpdateGuild::new(self, guild_id)
} | Update a guild.
All endpoints are optional. See [Discord Docs/Modify Guild].
[Discord Docs/Modify Guild]: https://discord.com/developers/docs/resources/guild#modify-guild | update_guild | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn update_guild_channel_positions<'a>(
&'a self,
guild_id: Id<GuildMarker>,
channel_positions: &'a [Position],
) -> UpdateGuildChannelPositions<'a> {
UpdateGuildChannelPositions::new(self, guild_id, channel_positions)
} | Modify the positions of the channels.
The minimum amount of channels to modify, is a swap between two channels. | update_guild_channel_positions | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn guild_widget(&self, guild_id: Id<GuildMarker>) -> GetGuildWidget<'_> {
GetGuildWidget::new(self, guild_id)
} | Get a guild's widget.
See [Discord Docs/Get Guild Widget].
[Discord Docs/Get Guild Widget]: https://discord.com/developers/docs/resources/guild#get-guild-widget | guild_widget | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn guild_widget_settings(
&self,
guild_id: Id<GuildMarker>,
) -> GetGuildWidgetSettings<'_> {
GetGuildWidgetSettings::new(self, guild_id)
} | Get a guild's widget settings.
See [Discord Docs/Get Guild Widget Settings].
[Discord Docs/Get Guild Widget]: https://discord.com/developers/docs/resources/guild#get-guild-widget-settings | guild_widget_settings | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn update_guild_widget_settings(
&self,
guild_id: Id<GuildMarker>,
) -> UpdateGuildWidgetSettings<'_> {
UpdateGuildWidgetSettings::new(self, guild_id)
} | Modify a guild's widget.
See [Discord Docs/Modify Guild Widget].
[Discord Docs/Modify Guild Widget]: https://discord.com/developers/docs/resources/guild#modify-guild-widget | update_guild_widget_settings | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn delete_guild_integration(
&self,
guild_id: Id<GuildMarker>,
integration_id: Id<IntegrationMarker>,
) -> DeleteGuildIntegration<'_> {
DeleteGuildIntegration::new(self, guild_id, integration_id)
} | Delete an integration for a guild, by the integration's id. | delete_guild_integration | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn guild_invites(&self, guild_id: Id<GuildMarker>) -> GetGuildInvites<'_> {
GetGuildInvites::new(self, guild_id)
} | Get information about the invites of a guild.
Requires the [`MANAGE_GUILD`] permission.
[`MANAGE_GUILD`]: twilight_model::guild::Permissions::MANAGE_GUILD | guild_invites | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn guild_member(
&self,
guild_id: Id<GuildMarker>,
user_id: Id<UserMarker>,
) -> GetMember<'_> {
GetMember::new(self, guild_id, user_id)
} | Get a member of a guild, by their id. | guild_member | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn add_guild_member<'a>(
&'a self,
guild_id: Id<GuildMarker>,
user_id: Id<UserMarker>,
access_token: &'a str,
) -> AddGuildMember<'a> {
AddGuildMember::new(self, guild_id, user_id, access_token)
} | Add a user to a guild.
An access token for the user with `guilds.join` scope is required. All
other fields are optional. See [Discord Docs/Add Guild Member].
# Errors
Returns an error of type [`ValidationErrorType::Nickname`] if the
nickname is too short or too long.
[`ValidationErrorType::Nickname`]: twilight_vali... | add_guild_member | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn update_guild_member(
&self,
guild_id: Id<GuildMarker>,
user_id: Id<UserMarker>,
) -> UpdateGuildMember<'_> {
UpdateGuildMember::new(self, guild_id, user_id)
} | Update a guild member.
All fields are optional. See [Discord Docs/Modify Guild Member].
# Examples
Update a member's nickname to "pinky pie" and server mute them:
```no_run
use std::env;
use twilight_http::Client;
use twilight_model::id::Id;
# #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>... | update_guild_member | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn update_current_member(
&self,
guild_id: Id<GuildMarker>,
) -> UpdateCurrentMember<'_> {
UpdateCurrentMember::new(self, guild_id)
} | Update the user's member in a guild. | update_current_member | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn add_guild_member_role(
&self,
guild_id: Id<GuildMarker>,
user_id: Id<UserMarker>,
role_id: Id<RoleMarker>,
) -> AddRoleToMember<'_> {
AddRoleToMember::new(self, guild_id, user_id, role_id)
} | Add a role to a member in a guild.
# Examples
In guild `1`, add role `2` to user `3`, for the reason `"test"`:
```no_run
# use twilight_http::{request::AuditLogReason, Client};
use twilight_model::id::Id;
#
# #[tokio::main]
# async fn main() -> Result<(), Box<dyn std::error::Error>> {
# let client = Client::new("my ... | add_guild_member_role | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn remove_guild_member_role(
&self,
guild_id: Id<GuildMarker>,
user_id: Id<UserMarker>,
role_id: Id<RoleMarker>,
) -> RemoveRoleFromMember<'_> {
RemoveRoleFromMember::new(self, guild_id, user_id, role_id)
} | Remove a role from a member in a guild, by id. | remove_guild_member_role | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn guild_onboarding(&self, guild_id: Id<GuildMarker>) -> GetGuildOnboarding<'_> {
GetGuildOnboarding::new(self, guild_id)
} | Retrieves the onboarding data for a guild. | guild_onboarding | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn guild_preview(&self, guild_id: Id<GuildMarker>) -> GetGuildPreview<'_> {
GetGuildPreview::new(self, guild_id)
} | For public guilds, get the guild preview.
This works even if the user is not in the guild. | guild_preview | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn guild_prune_count(&self, guild_id: Id<GuildMarker>) -> GetGuildPruneCount<'_> {
GetGuildPruneCount::new(self, guild_id)
} | Get the counts of guild members to be pruned. | guild_prune_count | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn create_guild_prune(&self, guild_id: Id<GuildMarker>) -> CreateGuildPrune<'_> {
CreateGuildPrune::new(self, guild_id)
} | Begin a guild prune.
See [Discord Docs/Begin Guild Prune].
[Discord Docs/Begin Guild Prune]: https://discord.com/developers/docs/resources/guild#begin-guild-prune | create_guild_prune | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn guild_vanity_url(&self, guild_id: Id<GuildMarker>) -> GetGuildVanityUrl<'_> {
GetGuildVanityUrl::new(self, guild_id)
} | Get a guild's vanity url, if there is one. | guild_vanity_url | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn guild_voice_regions(&self, guild_id: Id<GuildMarker>) -> GetGuildVoiceRegions<'_> {
GetGuildVoiceRegions::new(self, guild_id)
} | Get voice region data for the guild.
Can return VIP servers if the guild is VIP-enabled. | guild_voice_regions | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn guild_welcome_screen(
&self,
guild_id: Id<GuildMarker>,
) -> GetGuildWelcomeScreen<'_> {
GetGuildWelcomeScreen::new(self, guild_id)
} | Get the guild's welcome screen.
If the welcome screen is not enabled, this requires the [`MANAGE_GUILD`]
permission.
[`MANAGE_GUILD`]: twilight_model::guild::Permissions::MANAGE_GUILD | guild_welcome_screen | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn update_guild_welcome_screen(
&self,
guild_id: Id<GuildMarker>,
) -> UpdateGuildWelcomeScreen<'_> {
UpdateGuildWelcomeScreen::new(self, guild_id)
} | Update the guild's welcome screen.
Requires the [`MANAGE_GUILD`] permission.
[`MANAGE_GUILD`]: twilight_model::guild::Permissions::MANAGE_GUILD | update_guild_welcome_screen | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn invite<'a>(&'a self, code: &'a str) -> GetInvite<'a> {
GetInvite::new(self, code)
} | Get information about an invite by its code.
If [`with_counts`] is called, the returned invite will contain
approximate member counts. If [`with_expiration`] is called, it will
contain the expiration date.
# Examples
```no_run
# use twilight_http::Client;
#
# #[tokio::main]
# async fn main() -> Result<(), Box<dyn s... | invite | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn create_invite(&self, channel_id: Id<ChannelMarker>) -> CreateInvite<'_> {
CreateInvite::new(self, channel_id)
} | Create an invite, with options.
Requires the [`CREATE_INVITE`] permission.
# Examples
```no_run
# use twilight_http::Client;
# use twilight_model::id::Id;
#
# #[tokio::main]
# async fn main() -> Result<(), Box<dyn std::error::Error>> {
# let client = Client::new("my token".to_owned());
#
let channel_id = Id::new(123... | create_invite | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn delete_invite<'a>(&'a self, code: &'a str) -> DeleteInvite<'a> {
DeleteInvite::new(self, code)
} | Delete an invite by its code.
Requires the [`MANAGE_CHANNELS`] permission on the channel this invite
belongs to, or [`MANAGE_GUILD`] to remove any invite across the guild.
[`MANAGE_CHANNELS`]: twilight_model::guild::Permissions::MANAGE_CHANNELS
[`MANAGE_GUILD`]: twilight_model::guild::Permissions::MANAGE_GUILD | delete_invite | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn message(
&self,
channel_id: Id<ChannelMarker>,
message_id: Id<MessageMarker>,
) -> GetMessage<'_> {
GetMessage::new(self, channel_id, message_id)
} | Get a message by [`Id<ChannelMarker>`] and [`Id<MessageMarker>`]. | message | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn create_message(&self, channel_id: Id<ChannelMarker>) -> CreateMessage<'_> {
CreateMessage::new(self, channel_id)
} | Send a message to a channel.
The message must include at least one of [`attachments`],
[`components`], [`content`], [`embeds`], or [`sticker_ids`].
# Example
```no_run
# #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> {
use twilight_http::Client;
use twilight_model::id::Id;
let client = Cli... | create_message | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn delete_message(
&self,
channel_id: Id<ChannelMarker>,
message_id: Id<MessageMarker>,
) -> DeleteMessage<'_> {
DeleteMessage::new(self, channel_id, message_id)
} | Delete a message by [`Id<ChannelMarker>`] and [`Id<MessageMarker>`]. | delete_message | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn update_message(
&self,
channel_id: Id<ChannelMarker>,
message_id: Id<MessageMarker>,
) -> UpdateMessage<'_> {
UpdateMessage::new(self, channel_id, message_id)
} | Update a message by [`Id<ChannelMarker>`] and [`Id<MessageMarker>`].
You can pass [`None`] to any of the methods to remove the associated
field. Pass [`None`] to [`content`] to remove the content. You must
ensure that the message still contains at least one of [`attachments`],
[`components`], [`content`], [`embeds`], ... | update_message | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn crosspost_message(
&self,
channel_id: Id<ChannelMarker>,
message_id: Id<MessageMarker>,
) -> CrosspostMessage<'_> {
CrosspostMessage::new(self, channel_id, message_id)
} | Crosspost a message by [`Id<ChannelMarker>`] and [`Id<MessageMarker>`]. | crosspost_message | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn create_pin(
&self,
channel_id: Id<ChannelMarker>,
message_id: Id<MessageMarker>,
) -> CreatePin<'_> {
CreatePin::new(self, channel_id, message_id)
} | Create a new pin in a channel, by ID. | create_pin | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
pub const fn delete_pin(
&self,
channel_id: Id<ChannelMarker>,
message_id: Id<MessageMarker>,
) -> DeletePin<'_> {
DeletePin::new(self, channel_id, message_id)
} | Delete a pin in a channel, by ID. | delete_pin | rust | twilight-rs/twilight | twilight-http/src/client/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/client/mod.rs | ISC |
const fn num_digits(index: u64) -> usize {
let mut index = index;
let mut len = 0;
if index < 10 {
return 1;
}
while index > 0 {
index /= 10;
len += 1;
}
len
} | Count the number of digits in a given number. | num_digits | rust | twilight-rs/twilight | twilight-http/src/request/attachment.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/attachment.rs | ISC |
fn push_digits(mut id: u64, buf: &mut Vec<u8>) {
// The largest 64 bit integer is 20 digits.
let mut inner_buf = [0_u8; 20];
// Amount of digits written to the inner buffer.
let mut i = 0;
// While the number have more than one digit we print the last digit by
// taking the rest after modulo 10... | Extend the buffer with the digits of the integer `id`.
The reason for this is to get around a allocation by for example using
`format!("files[{id}]")`. | push_digits | rust | twilight-rs/twilight | twilight-http/src/request/attachment.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/attachment.rs | ISC |
pub fn body(mut self, body: Vec<u8>) -> Self {
if let Ok(request) = self.0.as_mut() {
request.body = Some(body);
}
self
} | Set the contents of the body. | body | rust | twilight-rs/twilight | twilight-http/src/request/base.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/base.rs | ISC |
pub fn json(mut self, to: &impl Serialize) -> Self {
self.0 = self.0.and_then(|mut request| {
let bytes = crate::json::to_vec(to).map_err(Error::json)?;
request.body = Some(bytes);
Ok(request)
});
self
} | Set the body, to be serialized as JSON. | json | rust | twilight-rs/twilight | twilight-http/src/request/base.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/base.rs | ISC |
pub fn use_authorization_token(mut self, use_authorization_token: bool) -> Self {
if let Ok(request) = self.0.as_mut() {
request.use_authorization_token = use_authorization_token;
}
self
} | Whether to use the client's authorization token in the request, if one
is set.
This is primarily useful for executing webhooks. | use_authorization_token | rust | twilight-rs/twilight | twilight-http/src/request/base.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/base.rs | ISC |
pub fn from_route(route: &Route<'_>) -> Self {
Self {
body: None,
form: None,
headers: None,
method: route.method(),
path: route.to_string(),
ratelimit_path: route.to_path(),
use_authorization_token: true,
}
} | Create a request from only its route information.
If you need to set additional configurations like the body then use
[`builder`].
# Examples
Create a request to get a message with an ID of 2 in a channel with an
ID of 1:
```
use twilight_http::{request::Request, routing::Route};
let request = Request::from_route(... | from_route | rust | twilight-rs/twilight | twilight-http/src/request/base.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/base.rs | ISC |
pub fn build(mut self) -> Vec<u8> {
self.buffer.extend(Self::BOUNDARY_TERMINATOR);
self.buffer
} | Consume the form, returning the buffer's contents. | build | rust | twilight-rs/twilight | twilight-http/src/request/multipart.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/multipart.rs | ISC |
pub fn content_type(&self) -> Vec<u8> {
const NAME: &str = "multipart/form-data; boundary=";
let mut content_type = Vec::with_capacity(NAME.len() + self.boundary.len());
content_type.extend(NAME.as_bytes());
content_type.extend(self.boundary);
content_type
} | Get the form's appropriate content type for requests. | content_type | rust | twilight-rs/twilight | twilight-http/src/request/multipart.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/multipart.rs | ISC |
pub fn random_boundary() -> [u8; 15] {
let mut boundary = [0; 15];
for value in &mut boundary {
*value = fastrand::alphanumeric() as u8;
}
boundary
} | Generate a random boundary that is 15 characters long. | random_boundary | rust | twilight-rs/twilight | twilight-http/src/request/multipart.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/multipart.rs | ISC |
pub const fn cover_image(mut self, cover_image: Option<&'a str>) -> Self {
self.fields.cover_image = Some(Nullable(cover_image));
self
} | Sets the cover image of the application. | cover_image | rust | twilight-rs/twilight | twilight-http/src/request/update_user_application.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/update_user_application.rs | ISC |
pub const fn custom_install_url(mut self, custom_install_url: &'a str) -> Self {
self.fields.custom_install_url = Some(custom_install_url);
self
} | Sets the custom install URL of the application. | custom_install_url | rust | twilight-rs/twilight | twilight-http/src/request/update_user_application.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/update_user_application.rs | ISC |
pub const fn description(mut self, description: &'a str) -> Self {
self.fields.description = Some(description);
self
} | Sets the description of the application. | description | rust | twilight-rs/twilight | twilight-http/src/request/update_user_application.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/update_user_application.rs | ISC |
pub const fn icon(mut self, icon: Option<&'a str>) -> Self {
self.fields.icon = Some(Nullable(icon));
self
} | Sets the icon of the application. | icon | rust | twilight-rs/twilight | twilight-http/src/request/update_user_application.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/update_user_application.rs | ISC |
pub fn install_params(mut self, install_params: InstallParams) -> Self {
self.fields.install_params = Some(install_params);
self
} | Sets the install params of the application. | install_params | rust | twilight-rs/twilight | twilight-http/src/request/update_user_application.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/update_user_application.rs | ISC |
pub const fn interactions_endpoint_url(mut self, interactions_endpoint_url: &'a str) -> Self {
self.fields.interactions_endpoint_url = Some(interactions_endpoint_url);
self
} | Sets the interactions endpoint URL of the application. | interactions_endpoint_url | rust | twilight-rs/twilight | twilight-http/src/request/update_user_application.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/update_user_application.rs | ISC |
pub const fn role_connections_verification_url(
mut self,
role_connections_verification_url: &'a str,
) -> Self {
self.fields.role_connections_verification_url = Some(role_connections_verification_url);
self
} | Sets the role connections verification URL of the application. | role_connections_verification_url | rust | twilight-rs/twilight | twilight-http/src/request/update_user_application.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/update_user_application.rs | ISC |
pub fn tags(mut self, tags: Vec<&'a str>) -> Self {
self.fields.tags = Some(tags);
self
} | Sets the tags of the application. | tags | rust | twilight-rs/twilight | twilight-http/src/request/update_user_application.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/update_user_application.rs | ISC |
pub const fn with_localizations(mut self, with_localizations: bool) -> Self {
self.with_localizations = Some(with_localizations);
self
} | Whether to include full localization dictionaries in the response.
Defaults to [`false`]. | with_localizations | rust | twilight-rs/twilight | twilight-http/src/request/application/command/get_global_commands.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/get_global_commands.rs | ISC |
pub const fn name(mut self, name: &'a str) -> Self {
self.fields.name = Some(name);
self
} | Edit the name of the command. | name | rust | twilight-rs/twilight | twilight-http/src/request/application/command/update_global_command.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/update_global_command.rs | ISC |
pub const fn command_options(mut self, options: &'a [CommandOption]) -> Self {
self.fields.options = Some(options);
self
} | Edit the command options of the command. | command_options | rust | twilight-rs/twilight | twilight-http/src/request/application/command/update_global_command.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/update_global_command.rs | ISC |
pub const fn nsfw(mut self, nsfw: bool) -> Self {
self.fields.nsfw = Some(nsfw);
self
} | Edit whether the command is age-restricted. | nsfw | rust | twilight-rs/twilight | twilight-http/src/request/application/command/update_global_command.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/update_global_command.rs | ISC |
pub fn command_options(mut self, options: &'a [CommandOption]) -> Self {
self.fields = self.fields.and_then(|mut fields| {
validate_options(options)?;
fields.options = Some(options);
Ok(fields)
});
self
} | Add a list of command options.
Required command options must be added before optional options.
# Errors
Returns an error of type [`OptionsRequiredFirst`] if a required option
was added after an optional option. The problem option's index is
provided.
[`OptionsRequiredFirst`]: twilight_validate::command::CommandVali... | command_options | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_global_command/chat_input.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_global_command/chat_input.rs | ISC |
pub fn default_member_permissions(mut self, default: Permissions) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.default_member_permissions = Some(default);
}
self
} | Default permissions required for a member to run the command.
Defaults to [`None`]. | default_member_permissions | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_global_command/chat_input.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_global_command/chat_input.rs | ISC |
pub fn dm_permission(mut self, dm_permission: bool) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.dm_permission = Some(dm_permission);
}
self
} | Set whether the command is available in DMs.
Defaults to [`None`]. | dm_permission | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_global_command/chat_input.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_global_command/chat_input.rs | ISC |
pub fn description_localizations(mut self, localizations: &'a HashMap<String, String>) -> Self {
self.fields = self.fields.and_then(|mut fields| {
for description in localizations.values() {
validate_description(description)?;
}
fields.description_localizatio... | Set the localization dictionary for the command description.
Defaults to [`None`].
# Errors
Returns an error of type [`DescriptionInvalid`] if the description is
invalid.
[`DescriptionInvalid`]: twilight_validate::command::CommandValidationErrorType::DescriptionInvalid | description_localizations | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_global_command/chat_input.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_global_command/chat_input.rs | ISC |
pub fn name_localizations(mut self, localizations: &'a HashMap<String, String>) -> Self {
self.fields = self.fields.and_then(|mut fields| {
for name in localizations.values() {
validate_chat_input_name(name)?;
}
fields.name_localizations = Some(localizations)... | Set the localization dictionary for the command name.
Defaults to [`None`].
# Errors
Returns an error of type [`NameLengthInvalid`] if the length is invalid.
Returns an error of type [`NameCharacterInvalid`] if the name contains a
non-alphanumeric character or an uppercase character for which a
lowercase variant ex... | name_localizations | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_global_command/chat_input.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_global_command/chat_input.rs | ISC |
pub fn nsfw(mut self, nsfw: bool) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.nsfw = Some(nsfw);
}
self
} | Set whether the command is age-restricted.
Defaults to not being specified, which uses Discord's default. | nsfw | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_global_command/chat_input.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_global_command/chat_input.rs | ISC |
pub fn name_localizations(mut self, localizations: &'a HashMap<String, String>) -> Self {
self.fields = self.fields.and_then(|mut fields| {
for name in localizations.values() {
validate_name(name)?;
}
fields.name_localizations = Some(localizations);
... | Set the localization dictionary for the command name.
Defaults to [`None`].
# Errors
Returns an error of type [`NameLengthInvalid`] if the name is invalid.
[`NameLengthInvalid`]: twilight_validate::command::CommandValidationErrorType::NameLengthInvalid | name_localizations | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_global_command/message.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_global_command/message.rs | ISC |
pub fn chat_input(
self,
name: &'a str,
description: &'a str,
) -> CreateGlobalChatInputCommand<'a> {
CreateGlobalChatInputCommand::new(self.http, self.application_id, name, description)
} | Create a new chat input global command.
The command name must only contain alphanumeric characters and lowercase
variants must be used where possible. Special characters `-` and `_` are
allowed. The description must be between 1 and 100 characters in length.
Creating a command with the same name as an already-existin... | chat_input | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_global_command/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_global_command/mod.rs | ISC |
pub fn message(self, name: &'a str) -> CreateGlobalMessageCommand<'a> {
CreateGlobalMessageCommand::new(self.http, self.application_id, name)
} | Create a new message global command.
Creating a command with the same name as an already-existing global
command will overwrite the old command. See
[Discord Docs/Create Global Application Command].
# Errors
Returns an error of type [`NameLengthInvalid`] if the command name is
not between 1 and 32 characters.
[`Nam... | message | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_global_command/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_global_command/mod.rs | ISC |
pub fn user(self, name: &'a str) -> CreateGlobalUserCommand<'a> {
CreateGlobalUserCommand::new(self.http, self.application_id, name)
} | Create a new user global command.
Creating a command with the same name as an already-existing global
command will overwrite the old command. See
[Discord Docs/Create Global Application Command].
# Errors
Returns an error of type [`NameLengthInvalid`] if the command name is
not between 1 and 32 characters.
[`NameLe... | user | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_global_command/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_global_command/mod.rs | ISC |
pub fn chat_input(
self,
name: &'a str,
description: &'a str,
) -> CreateGuildChatInputCommand<'a> {
CreateGuildChatInputCommand::new(
self.http,
self.application_id,
self.guild_id,
name,
description,
)
} | Create a chat input command in a guild.
The command name must only contain alphanumeric characters and lowercase
variants must be used where possible. Special characters `-` and `_` are
allowed. The description must be between 1 and 100 characters in length.
Creating a guild command with the same name as an already-e... | chat_input | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_guild_command/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_guild_command/mod.rs | ISC |
pub fn message(self, name: &'a str) -> CreateGuildMessageCommand<'a> {
CreateGuildMessageCommand::new(self.http, self.application_id, self.guild_id, name)
} | Create a message command in a guild.
Creating a guild command with the same name as an already-existing guild
command in the same guild will overwrite the old command. See
[Discord Docs/Create Guild Application Command].
# Errors
Returns an error of type [`NameLengthInvalid`] if the command name is
not between 1 and... | message | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_guild_command/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_guild_command/mod.rs | ISC |
pub fn user(self, name: &'a str) -> CreateGuildUserCommand<'a> {
CreateGuildUserCommand::new(self.http, self.application_id, self.guild_id, name)
} | Create a user command in a guild.
Creating a guild command with the same name as an already-existing guild
command in the same guild will overwrite the old command. See
[Discord Docs/Create Guild Application Command].
# Errors
Returns an error of type [`NameLengthInvalid`] if the command name is
not between 1 and 32... | user | rust | twilight-rs/twilight | twilight-http/src/request/application/command/create_guild_command/mod.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/command/create_guild_command/mod.rs | ISC |
pub fn allowed_mentions(mut self, allowed_mentions: Option<&'a AllowedMentions>) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.allowed_mentions = Some(Nullable(allowed_mentions));
}
self
} | Specify the [`AllowedMentions`] for the message.
Unless otherwise called, the request will use the client's default
allowed mentions. Set to `None` to ignore this default. | allowed_mentions | rust | twilight-rs/twilight | twilight-http/src/request/application/interaction/create_followup.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/interaction/create_followup.rs | ISC |
pub fn attachments(mut self, attachments: &'a [Attachment]) -> Self {
if self.fields.is_ok() {
if let Err(source) = attachments.iter().try_for_each(validate_attachment) {
self.fields = Err(source);
} else {
self.attachment_manager = self
... | Attach multiple files to the message.
Calling this method will clear any previous calls.
# Errors
Returns an error of type [`AttachmentDescriptionTooLarge`] if
the attachments's description is too large.
Returns an error of type [`AttachmentFilename`] if any filename is
invalid.
[`AttachmentDescriptionTooLarge`]: ... | attachments | rust | twilight-rs/twilight | twilight-http/src/request/application/interaction/create_followup.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/interaction/create_followup.rs | ISC |
pub fn components(mut self, components: &'a [Component]) -> Self {
self.fields = self.fields.and_then(|mut fields| {
validate_components(components)?;
fields.components = Some(components);
Ok(fields)
});
self
} | Add multiple [`Component`]s to a message.
Calling this method multiple times will clear previous calls.
# Errors
Refer to the errors section of
[`twilight_validate::component::component`] for a list of errors that
may be returned as a result of validating each provided component. | components | rust | twilight-rs/twilight | twilight-http/src/request/application/interaction/create_followup.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/interaction/create_followup.rs | ISC |
pub fn content(mut self, content: &'a str) -> Self {
self.fields = self.fields.and_then(|mut fields| {
validate_content(content)?;
fields.content = Some(content);
Ok(fields)
});
self
} | Set the message's content.
The maximum length is 2000 UTF-16 characters.
# Errors
Returns an error of type [`ContentInvalid`] if the content length is too
long.
[`ContentInvalid`]: twilight_validate::message::MessageValidationErrorType::ContentInvalid | content | rust | twilight-rs/twilight | twilight-http/src/request/application/interaction/create_followup.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/interaction/create_followup.rs | ISC |
pub fn flags(mut self, flags: MessageFlags) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.flags = Some(flags);
}
self
} | Set the message's flags.
The only supported flags are [`EPHEMERAL`] and [`SUPPRESS_EMBEDS`].
[`EPHEMERAL`]: MessageFlags::EPHEMERAL
[`SUPPRESS_EMBEDS`]: twilight_model::channel::message::MessageFlags::SUPPRESS_EMBEDS | flags | rust | twilight-rs/twilight | twilight-http/src/request/application/interaction/create_followup.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/interaction/create_followup.rs | ISC |
pub fn payload_json(mut self, payload_json: &'a [u8]) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.payload_json = Some(payload_json);
}
self
} | JSON encoded body of any additional request fields.
If this method is called, all other fields are ignored, except for
[`attachments`]. See [Discord Docs/Uploading Files].
# Examples
See [`ExecuteWebhook::payload_json`] for examples.
[`attachments`]: Self::attachments
[`ExecuteWebhook::payload_json`]: crate::reques... | payload_json | rust | twilight-rs/twilight | twilight-http/src/request/application/interaction/create_followup.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/interaction/create_followup.rs | ISC |
pub fn tts(mut self, tts: bool) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.tts = Some(tts);
}
self
} | Specify true if the message is TTS. | tts | rust | twilight-rs/twilight | twilight-http/src/request/application/interaction/create_followup.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/interaction/create_followup.rs | ISC |
pub fn components(mut self, components: Option<&'a [Component]>) -> Self {
self.fields = self.fields.and_then(|mut fields| {
if let Some(components) = components {
validate_components(components)?;
}
fields.components = Some(Nullable(components));
... | Set the message's list of [`Component`]s.
Calling this method will clear previous calls.
# Editing
Pass [`None`] to clear existing components.
# Errors
Refer to the errors section of
[`twilight_validate::component::component`] for a list of errors that
may be returned as a result of validating each provided compon... | components | rust | twilight-rs/twilight | twilight-http/src/request/application/interaction/update_followup.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/interaction/update_followup.rs | ISC |
pub fn content(mut self, content: Option<&'a str>) -> Self {
self.fields = self.fields.and_then(|mut fields| {
if let Some(content_ref) = content.as_ref() {
validate_content(content_ref)?;
}
fields.content = Some(Nullable(content));
Ok(fields)
... | Set the message's content.
The maximum length is 2000 UTF-16 characters.
# Editing
Pass [`None`] to remove the message content. This is impossible if it
would leave the message empty of `attachments`, `content`, or `embeds`.
# Errors
Returns an error of type [`ContentInvalid`] if the content length is too
long.
[... | content | rust | twilight-rs/twilight | twilight-http/src/request/application/interaction/update_followup.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/interaction/update_followup.rs | ISC |
pub fn keep_attachment_ids(mut self, attachment_ids: &'a [Id<AttachmentMarker>]) -> Self {
if let Ok(fields) = self.fields.as_mut() {
self.attachment_manager = self.attachment_manager.set_ids(attachment_ids.to_vec());
// Set an empty list. This will be overwritten in `TryIntoRequest` if... | Specify multiple [`Id<AttachmentMarker>`]s already present in the target
message to keep.
If called, all unspecified attachments (except ones added with
[`attachments`]) will be removed from the message. This is impossible if
it would leave the message empty of `attachments`, `content`, or
`embeds`. If not called, all... | keep_attachment_ids | rust | twilight-rs/twilight | twilight-http/src/request/application/interaction/update_followup.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/interaction/update_followup.rs | ISC |
pub const fn guild_id(mut self, guild_id: Id<GuildMarker>) -> Self {
self.fields.guild_id = Some(guild_id);
self
} | Guild ID to look up entitlements for. | guild_id | rust | twilight-rs/twilight | twilight-http/src/request/application/monetization/get_entitlements.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/monetization/get_entitlements.rs | ISC |
pub fn limit(mut self, limit: u8) -> Result<Self, ValidationError> {
validate_get_entitlements_limit(limit)?;
self.fields.limit = Some(limit);
Ok(self)
} | Number of entitlements to return. Set to 100 if unspecified.
The minimum is 1 and the maximum is 100.
# Errors
Returns a [`GetEntitlementsError`] error type if the amount
is less than 1 or greater than 100.
[`GetEntitlementsError`]: twilight_validate::request::ValidationErrorType::GetEntitlements | limit | rust | twilight-rs/twilight | twilight-http/src/request/application/monetization/get_entitlements.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/monetization/get_entitlements.rs | ISC |
pub const fn sku_ids(mut self, sku_ids: &'a [Id<SkuMarker>]) -> Self {
self.fields.sku_ids = sku_ids;
self
} | List of SKU IDs to check entitlements for. | sku_ids | rust | twilight-rs/twilight | twilight-http/src/request/application/monetization/get_entitlements.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/monetization/get_entitlements.rs | ISC |
pub const fn user_id(mut self, user_id: Id<UserMarker>) -> Self {
self.fields.user_id = Some(user_id);
self
} | User ID to look up entitlements for. | user_id | rust | twilight-rs/twilight | twilight-http/src/request/application/monetization/get_entitlements.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/application/monetization/get_entitlements.rs | ISC |
pub fn available_tags(mut self, available_tags: &'a [ForumTag]) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.available_tags = Some(available_tags);
}
self
} | Set the available tags for the forum. | available_tags | rust | twilight-rs/twilight | twilight-http/src/request/channel/update_channel.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/update_channel.rs | ISC |
pub fn bitrate(mut self, bitrate: u32) -> Self {
self.fields = self.fields.and_then(|mut fields| {
validate_bitrate(bitrate)?;
fields.bitrate = Some(bitrate);
Ok(fields)
});
self
} | For voice and stage channels, set the bitrate of the channel.
Must be at least 8000.
# Errors
Returns an error of type [`BitrateInvalid`] if the bitrate is invalid.
[`BitrateInvalid`]: twilight_validate::channel::ChannelValidationErrorType::BitrateInvalid | bitrate | rust | twilight-rs/twilight | twilight-http/src/request/channel/update_channel.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/update_channel.rs | ISC |
pub fn default_forum_layout(mut self, default_forum_layout: ForumLayout) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.default_forum_layout = Some(default_forum_layout);
}
self
} | Set the default layout for forum channels. | default_forum_layout | rust | twilight-rs/twilight | twilight-http/src/request/channel/update_channel.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/update_channel.rs | ISC |
pub fn default_reaction_emoji(
mut self,
default_reaction_emoji: Option<&'a DefaultReaction>,
) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.default_reaction_emoji = Some(Nullable(default_reaction_emoji));
}
self
} | Set the default reaction emoji for new forum threads. | default_reaction_emoji | rust | twilight-rs/twilight | twilight-http/src/request/channel/update_channel.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/update_channel.rs | ISC |
pub fn default_sort_order(mut self, default_sort_order: Option<ForumSortOrder>) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.default_sort_order = Some(Nullable(default_sort_order));
}
self
} | Set the default sort order for forum channels. | default_sort_order | rust | twilight-rs/twilight | twilight-http/src/request/channel/update_channel.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/update_channel.rs | ISC |
pub fn flags(mut self, flags: ChannelFlags) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.flags = Some(flags);
}
self
} | Set the flags of the channel, if supported. | flags | rust | twilight-rs/twilight | twilight-http/src/request/channel/update_channel.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/update_channel.rs | ISC |
pub fn forum_topic(mut self, topic: Option<&'a str>) -> Self {
self.fields = self.fields.and_then(|mut fields| {
if let Some(topic) = topic {
validate_forum_topic(topic)?;
}
fields.topic = topic;
Ok(fields)
});
self
} | Set the forum topic.
The maximum length is 4096 UTF-16 characters. See
[Discord Docs/Channel Object].
# Errors
Returns an error of type [`ForumTopicInvalid`] if the channel type is
[`GuildForum`] and the topic is invalid.
[Discord Docs/Channel Object]: https://discordapp.com/developers/docs/resources/channel#channe... | forum_topic | rust | twilight-rs/twilight | twilight-http/src/request/channel/update_channel.rs | https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/update_channel.rs | ISC |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.