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 fn name(mut self, name: &'a str) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_name(name)?; fields.name = Some(name); Ok(fields) }); self }
Set the name. The minimum length is 1 UTF-16 character and the maximum is 100 UTF-16 characters. # Errors Returns an error of type [`NameInvalid`] if the name is invalid. [`NameInvalid`]: twilight_validate::channel::ChannelValidationErrorType::NameInvalid
name
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 parent_id(mut self, parent_id: Option<Id<ChannelMarker>>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.parent_id = Some(Nullable(parent_id)); } self }
If this is specified, and the parent ID is a `ChannelType::CategoryChannel`, move this channel to a child of the category channel.
parent_id
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 permission_overwrites( mut self, permission_overwrites: &'a [PermissionOverwrite], ) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.permission_overwrites = Some(permission_overwrites); } self }
Set the permission overwrites of a channel. This will overwrite all permissions that the channel currently has, so use with caution!
permission_overwrites
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 position(mut self, position: u64) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.position = Some(position); } self }
Set the position of the channel. Positions are numerical and zero-indexed. If you place a channel at position 2, channels 2-n will shift down one position and the initial channel will take its place.
position
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 rtc_region(mut self, rtc_region: Option<&'a str>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.rtc_region = Some(Nullable(rtc_region)); } self }
For voice and stage channels, set the channel's RTC region. Set to `None` to clear.
rtc_region
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 topic(mut self, topic: &'a str) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_topic(topic)?; fields.topic.replace(topic); Ok(fields) }); self }
Set the topic. The maximum length is 1024 UTF-16 characters. See [Discord Docs/Channel Object]. # Errors Returns an error of type [`TopicInvalid`] if the topic is invalid. [Discord Docs/Channel Object]: https://discordapp.com/developers/docs/resources/channel#channel-object-channel-structure [`TopicInvalid`]: twilight_validate::channel::ChannelValidationErrorType::TopicInvalid
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
pub fn video_quality_mode(mut self, video_quality_mode: VideoQualityMode) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.video_quality_mode = Some(video_quality_mode); } self }
Set the [`VideoQualityMode`] for the voice channel.
video_quality_mode
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 kind(mut self, kind: ChannelType) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.kind = Some(kind); } self }
Set the kind of channel. Only conversion between `ChannelType::GuildText` and `ChannelType::GuildAnnouncement` is possible, and only if the guild has the `NEWS` feature enabled. See [Discord Docs/Modify Channel]. [Discord Docs/Modify Channel]: https://discord.com/developers/docs/resources/channel#modify-channel-json-params-guild-channel
kind
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 max_age(mut self, max_age: u32) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_invite_max_age(max_age)?; fields.max_age = Some(max_age); Ok(fields) }); self }
Set the maximum age for an invite. If no age is specified, Discord sets the age to 86400 seconds, or 24 hours. Set to 0 to never expire. # Examples Create an invite for a channel with a maximum of 1 use and an age of 1 hour: ```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>> { let client = Client::new(env::var("DISCORD_TOKEN")?); let invite = client .create_invite(Id::new(1)) .max_age(60 * 60) .await? .model() .await?; println!("invite code: {}", invite.code); # Ok(()) } ``` # Errors Returns an error of type [`InviteMaxAge`] if the age is invalid. [`InviteMaxAge`]: twilight_validate::request::ValidationErrorType::InviteMaxAge
max_age
rust
twilight-rs/twilight
twilight-http/src/request/channel/invite/create_invite.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/invite/create_invite.rs
ISC
pub fn max_uses(mut self, max_uses: u16) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_invite_max_uses(max_uses)?; fields.max_uses = Some(max_uses); Ok(fields) }); self }
Set the maximum uses for an invite, or 0 for infinite. Discord defaults this to 0, or infinite. # Examples Create an invite for a channel with a maximum of 5 uses: ```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>> { let client = Client::new(env::var("DISCORD_TOKEN")?); let invite = client .create_invite(Id::new(1)) .max_uses(5) .await? .model() .await?; println!("invite code: {}", invite.code); # Ok(()) } ``` # Errors Returns an error of type [`InviteMaxUses`] if the uses is invalid. [`InviteMaxUses`]: twilight_validate::request::ValidationErrorType::InviteMaxUses
max_uses
rust
twilight-rs/twilight
twilight-http/src/request/channel/invite/create_invite.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/invite/create_invite.rs
ISC
pub fn target_application_id(mut self, target_application_id: Id<ApplicationMarker>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.target_application_id = Some(target_application_id); } self }
Set the target application ID for this invite. This only works if [`target_type`] is set to [`TargetType::EmbeddedApplication`]. [`target_type`]: Self::target_type
target_application_id
rust
twilight-rs/twilight
twilight-http/src/request/channel/invite/create_invite.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/invite/create_invite.rs
ISC
pub fn target_user_id(mut self, target_user_id: Id<UserMarker>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.target_user_id = Some(target_user_id); } self }
Set the target user id for this invite.
target_user_id
rust
twilight-rs/twilight
twilight-http/src/request/channel/invite/create_invite.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/invite/create_invite.rs
ISC
pub fn target_type(mut self, target_type: TargetType) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.target_type = Some(target_type); } self }
Set the target type for this invite.
target_type
rust
twilight-rs/twilight
twilight-http/src/request/channel/invite/create_invite.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/invite/create_invite.rs
ISC
pub fn temporary(mut self, temporary: bool) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.temporary = Some(temporary); } self }
Specify true if the invite should grant temporary membership. Defaults to false.
temporary
rust
twilight-rs/twilight
twilight-http/src/request/channel/invite/create_invite.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/invite/create_invite.rs
ISC
pub fn unique(mut self, unique: bool) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.unique = Some(unique); } self }
Specify true if the invite should be unique. Defaults to false. If true, don't try to reuse a similar invite (useful for creating many unique one time use invites). See [Discord Docs/Create Channel Invite]. [Discord Docs/Create Channel Invite]: https://discord.com/developers/docs/resources/channel#create-channel-invite
unique
rust
twilight-rs/twilight
twilight-http/src/request/channel/invite/create_invite.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/invite/create_invite.rs
ISC
pub const fn with_counts(mut self) -> Self { self.fields.with_counts = true; self }
Whether the invite returned should contain approximate member counts.
with_counts
rust
twilight-rs/twilight
twilight-http/src/request/channel/invite/get_invite.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/invite/get_invite.rs
ISC
pub const fn with_expiration(mut self) -> Self { self.fields.with_expiration = true; self }
Whether the invite returned should contain its expiration date.
with_expiration
rust
twilight-rs/twilight
twilight-http/src/request/channel/invite/get_invite.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/invite/get_invite.rs
ISC
pub fn poll(mut self, poll: &'a Poll) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.poll = Some(poll); } self }
Specify if this message is a poll.
poll
rust
twilight-rs/twilight
twilight-http/src/request/channel/message/create_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/message/create_message.rs
ISC
pub fn fail_if_not_exists(mut self, fail_if_not_exists: bool) -> Self { if let Ok(fields) = self.fields.as_mut() { if let Some(reference) = fields.message_reference.as_mut() { reference.fail_if_not_exists = Some(fail_if_not_exists); } else { fields.message_reference = Some(MessageReference { kind: MessageReferenceType::default(), channel_id: None, guild_id: None, message_id: None, fail_if_not_exists: Some(fail_if_not_exists), }); } } self }
Whether to fail sending if the reply no longer exists. Defaults to [`true`].
fail_if_not_exists
rust
twilight-rs/twilight
twilight-http/src/request/channel/message/create_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/message/create_message.rs
ISC
pub fn nonce(mut self, nonce: u64) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.nonce = Some(nonce); } self }
Attach a nonce to the message, for optimistic message sending.
nonce
rust
twilight-rs/twilight
twilight-http/src/request/channel/message/create_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/message/create_message.rs
ISC
pub fn reply(mut self, other: Id<MessageMarker>) -> Self { self.fields = self.fields.map(|mut fields| { let channel_id = self.channel_id; let reference = if let Some(reference) = fields.message_reference { MessageReference { channel_id: Some(channel_id), message_id: Some(other), ..reference } } else { MessageReference { kind: MessageReferenceType::Default, channel_id: Some(channel_id), guild_id: None, message_id: Some(other), fail_if_not_exists: None, } }; fields.message_reference = Some(reference); fields }); self }
Specify the ID of another message to create a reply to.
reply
rust
twilight-rs/twilight
twilight-http/src/request/channel/message/create_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/message/create_message.rs
ISC
pub fn forward(mut self, other: Id<MessageMarker>) -> Self { self.fields = self.fields.map(|mut fields| { let channel_id = self.channel_id; let reference = if let Some(reference) = fields.message_reference { MessageReference { channel_id: Some(channel_id), message_id: Some(other), ..reference } } else { MessageReference { kind: MessageReferenceType::Forward, channel_id: Some(channel_id), guild_id: None, message_id: Some(other), fail_if_not_exists: None, } }; fields.message_reference = Some(reference); fields }); self }
Specify the ID of another message to forward.
forward
rust
twilight-rs/twilight
twilight-http/src/request/channel/message/create_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/message/create_message.rs
ISC
pub fn sticker_ids(mut self, sticker_ids: &'a [Id<StickerMarker>]) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_sticker_ids(sticker_ids)?; fields.sticker_ids = Some(sticker_ids); Ok(fields) }); self }
Set the IDs of up to 3 guild stickers. # Errors Returns an error of type [`StickersInvalid`] if the length is invalid. [`StickersInvalid`]: twilight_validate::message::MessageValidationErrorType::StickersInvalid
sticker_ids
rust
twilight-rs/twilight
twilight-http/src/request/channel/message/create_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/message/create_message.rs
ISC
pub fn limit(mut self, limit: u16) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_get_channel_messages_limit(limit)?; fields.limit = Some(limit); Ok(fields) }); self }
Set the maximum number of messages to retrieve. The minimum is 1 and the maximum is 100. # Errors Returns an error of type [`GetChannelMessages`] error type if the amount is less than 1 or greater than 100. [`GetChannelMessages`]: twilight_validate::request::ValidationErrorType::GetChannelMessages
limit
rust
twilight-rs/twilight
twilight-http/src/request/channel/message/get_channel_messages.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/message/get_channel_messages.rs
ISC
pub fn content(mut self, content: Option<&'a str>) -> Self { self.fields = self.fields.and_then(|mut fields| { if let Some(content) = content { validate_content(content)?; } fields.content = Some(Nullable(content)); Ok(fields) }); self }
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`, `embeds`, or `sticker_ids`. # 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/channel/message/update_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/message/update_message.rs
ISC
pub fn kind(mut self, kind: ReactionType) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.kind = Some(kind); } self }
Set the kind of reaction to retrieve. This can be either a super reaction or a normal reaction.
kind
rust
twilight-rs/twilight
twilight-http/src/request/channel/reaction/get_reactions.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/reaction/get_reactions.rs
ISC
pub fn guild_scheduled_event_id( mut self, guild_scheduled_event_id: Id<ScheduledEventMarker>, ) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.guild_scheduled_event_id = Some(guild_scheduled_event_id); } self }
Set the guild scheduled event associated with this stage instance.
guild_scheduled_event_id
rust
twilight-rs/twilight
twilight-http/src/request/channel/stage/create_stage_instance.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/stage/create_stage_instance.rs
ISC
pub fn privacy_level(mut self, privacy_level: PrivacyLevel) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.privacy_level = Some(privacy_level); } self }
Set the [`PrivacyLevel`] of the instance.
privacy_level
rust
twilight-rs/twilight
twilight-http/src/request/channel/stage/create_stage_instance.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/stage/create_stage_instance.rs
ISC
pub fn send_start_notification(mut self, send_start_notification: bool) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.send_start_notification = Some(send_start_notification); } self }
Set whether to notify everyone when a stage starts. The stage moderator must have [`Permissions::MENTION_EVERYONE`] for this notification to be sent. [`Permissions::MENTION_EVERYONE`]: twilight_model::guild::Permissions::MENTION_EVERYONE
send_start_notification
rust
twilight-rs/twilight
twilight-http/src/request/channel/stage/create_stage_instance.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/stage/create_stage_instance.rs
ISC
pub fn topic(mut self, topic: &'a str) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_stage_topic(topic)?; fields.topic.replace(topic); Ok(fields) }); self }
Set the new topic of the instance. # Errors Returns an error of type [`StageTopic`] if the length is invalid. [`StageTopic`]: twilight_validate::request::ValidationErrorType::StageTopic
topic
rust
twilight-rs/twilight
twilight-http/src/request/channel/stage/update_stage_instance.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/stage/update_stage_instance.rs
ISC
pub fn auto_archive_duration(mut self, auto_archive_duration: AutoArchiveDuration) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.auto_archive_duration = Some(auto_archive_duration); } self }
Set the thread's auto archive duration. Automatic archive durations are not locked behind the guild's boost level.
auto_archive_duration
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/create_thread.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/create_thread.rs
ISC
pub fn invitable(mut self, invitable: bool) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.invitable = Some(invitable); } self }
Whether non-moderators can add other non-moderators to a thread.
invitable
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/create_thread.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/create_thread.rs
ISC
pub const fn limit(mut self, limit: u64) -> Self { self.limit = Some(limit); self }
Maximum number of threads to return.
limit
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/get_joined_private_archived_threads.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/get_joined_private_archived_threads.rs
ISC
pub const fn before(mut self, before: &'a str) -> Self { self.before = Some(before); self }
Return threads before this ISO 8601 timestamp.
before
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/get_private_archived_threads.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/get_private_archived_threads.rs
ISC
pub fn after(mut self, after: Id<UserMarker>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.after = Some(after); } self }
Fetch the thread members after the user ID.
after
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/get_thread_members.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/get_thread_members.rs
ISC
pub fn with_member(mut self, with_member: bool) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.with_member = Some(with_member); } self }
Include the associated guild members for each thread member.
with_member
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/get_thread_members.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/get_thread_members.rs
ISC
pub fn applied_tags(mut self, applied_tags: Option<&'a [Id<TagMarker>]>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.applied_tags = Some(Nullable(applied_tags)); } self }
Set the forum thread's applied tags.
applied_tags
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/update_thread.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/update_thread.rs
ISC
pub fn archived(mut self, archived: bool) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.archived = Some(archived); } self }
Set whether the thread is archived. Requires that the user have [`SEND_MESSAGES`] in the thread. However, if the thread is locked, the user must have [`MANAGE_THREADS`]. [`SEND_MESSAGES`]: twilight_model::guild::Permissions::SEND_MESSAGES [`MANAGE_THREADS`]: twilight_model::guild::Permissions::MANAGE_THREADS
archived
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/update_thread.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/update_thread.rs
ISC
pub fn locked(mut self, locked: bool) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.locked = Some(locked); } self }
Set whether the thread is locked. If the thread is already locked, only users with [`MANAGE_THREADS`] can unlock it. [`MANAGE_THREADS`]: twilight_model::guild::Permissions::MANAGE_THREADS
locked
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/update_thread.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/update_thread.rs
ISC
pub fn attachments(mut self, attachments: &'a [Attachment]) -> Self { if self.0.is_ok() { let validation = attachments .iter() .try_for_each(|attachment| validate_attachment_filename(&attachment.filename)); if let Err(source) = validation { self.0 = Err(source); } else if let Ok(inner) = self.0.as_mut() { let mut manager = mem::take(&mut inner.attachment_manager); manager = manager.set_files(attachments.iter().collect()); inner.attachment_manager = manager; } } self }
Attach multiple files to the message. Calling this method will clear any previous calls. # Errors Returns an error of type [`AttachmentFilename`] if any filename is invalid. [`AttachmentFilename`]: twilight_validate::message::MessageValidationErrorType::AttachmentFilename
attachments
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/create_forum_thread/message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/create_forum_thread/message.rs
ISC
pub fn components(mut self, components: &'a [Component]) -> Self { self.0 = self.0.and_then(|mut inner| { validate_components(components)?; inner.fields.message.components = Some(components); Ok(inner) }); self }
Set the message's list of [`Component`]s. Calling this method will clear previous calls. Requires a webhook owned by the application. # 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/channel/thread/create_forum_thread/message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/create_forum_thread/message.rs
ISC
pub fn flags(mut self, flags: MessageFlags) -> Self { if let Ok(inner) = self.0.as_mut() { inner.fields.message.flags = Some(flags); } self }
Set the message's flags. The only supported flags are [`SUPPRESS_EMBEDS`] and [`SUPPRESS_NOTIFICATIONS`]. [`SUPPRESS_EMBEDS`]: MessageFlags::SUPPRESS_EMBEDS [`SUPPRESS_NOTIFICATIONS`]: MessageFlags::SUPPRESS_NOTIFICATIONS
flags
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/create_forum_thread/message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/create_forum_thread/message.rs
ISC
pub fn payload_json(mut self, payload_json: &'a [u8]) -> Self { if let Ok(inner) = self.0.as_mut() { inner.fields.message.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. [Discord Docs/Uploading Files]: https://discord.com/developers/docs/reference#uploading-files [`ExecuteWebhook::payload_json`]: crate::request::channel::webhook::ExecuteWebhook::payload_json [`attachments`]: Self::attachments
payload_json
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/create_forum_thread/message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/create_forum_thread/message.rs
ISC
pub const fn auto_archive_duration( mut self, auto_archive_duration: AutoArchiveDuration, ) -> Self { self.fields.auto_archive_duration = Some(auto_archive_duration); self }
Set the default auto archive duration for newly created threads in the channel. Automatic archive durations are not locked behind the guild's boost level.
auto_archive_duration
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/create_forum_thread/mod.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/create_forum_thread/mod.rs
ISC
fn exec(self) -> ResponseFuture<ForumThread> { let http = self.http; match self.try_into_request() { Ok(request) => http.request(request), Err(source) => ResponseFuture::error(source), } }
Execute the request, returning a future resolving to a [`Response`]. [`Response`]: crate::response::Response
exec
rust
twilight-rs/twilight
twilight-http/src/request/channel/thread/create_forum_thread/mod.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/thread/create_forum_thread/mod.rs
ISC
pub fn avatar(mut self, avatar: &'a str) -> Self { self.fields = self.fields.map(|mut fields| { fields.avatar = Some(avatar); fields }); self }
Set the avatar of the webhook. This 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
avatar
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/create_webhook.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/create_webhook.rs
ISC
pub const fn token(mut self, token: &'a str) -> Self { self.fields.token = Some(token); self }
Specify the token for auth, if not already authenticated with a Bot token.
token
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/delete_webhook.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/delete_webhook.rs
ISC
pub fn thread_id(mut self, thread_id: Id<ChannelMarker>) -> Self { self.thread_id.replace(thread_id); self }
Delete in a thread belonging to the channel instead of the channel itself.
thread_id
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/delete_webhook_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/delete_webhook_message.rs
ISC
pub fn avatar_url(mut self, avatar_url: &'a str) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.avatar_url = Some(avatar_url); } self }
The URL of the avatar of the webhook.
avatar_url
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/execute_webhook.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/execute_webhook.rs
ISC
pub fn thread_name(mut self, thread_name: &'a str) -> Self { self.fields = self.fields.map(|mut fields| { fields.thread_name = Some(thread_name); fields }); self }
Set the name of the created thread when used in a forum channel.
thread_name
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/execute_webhook.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/execute_webhook.rs
ISC
pub fn username(mut self, username: &'a str) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_webhook_username(username).map_err(|source| { MessageValidationError::from_validation_error( MessageValidationErrorType::WebhookUsername, source, ) })?; fields.username = Some(username); Ok(fields) }); self }
Specify the username of the webhook's message. # Errors Returns an error of type [`WebhookUsername`] if the webhook's name is invalid. [`WebhookUsername`]: twilight_validate::request::ValidationErrorType::WebhookUsername
username
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/execute_webhook.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/execute_webhook.rs
ISC
pub const fn wait(mut self) -> ExecuteWebhookAndWait<'a> { self.wait = true; ExecuteWebhookAndWait::new(self.http, self) }
Wait for the message to send before sending a response. See [Discord Docs/Execute Webhook]. Using this will result in receiving the created message. [Discord Docs/Execute Webhook]: https://discord.com/developers/docs/resources/webhook#execute-webhook-querystring-params
wait
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/execute_webhook.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/execute_webhook.rs
ISC
pub fn channel_id(mut self, channel_id: Id<ChannelMarker>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.channel_id = Some(channel_id); } self }
Move this webhook to a new channel.
channel_id
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/update_webhook.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_webhook.rs
ISC
pub fn name(mut self, name: &'a str) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_webhook_username(name)?; fields.name = Some(name); Ok(fields) }); self }
Change the name of the webhook. # Errors Returns an error of type [`WebhookUsername`] if the webhook's name is invalid. [`WebhookUsername`]: twilight_validate::request::ValidationErrorType::WebhookUsername
name
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/update_webhook.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_webhook.rs
ISC
pub fn default_sort_order(mut self, default_sort_order: ForumSortOrder) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.default_sort_order = Some(default_sort_order); } self }
Set the default sort order for newly created forum channels.
default_sort_order
rust
twilight-rs/twilight
twilight-http/src/request/guild/create_guild_channel.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/create_guild_channel.rs
ISC
pub fn default_thread_rate_limit_per_user( mut self, default_thread_rate_limit_per_user: u16, ) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_rate_limit_per_user(default_thread_rate_limit_per_user)?; fields.default_thread_rate_limit_per_user = Some(default_thread_rate_limit_per_user); Ok(fields) }); self }
Set the default number of seconds that a user must wait before before they are able to send another message in any newly-created thread in the channel. This field is only applicable for text, announcement, media, and forum channels. The minimum is 0 and the maximum is 21600. This is also known as "Slow Mode". See [Discord Docs/Channel Object]. [Discord Docs/Channel Object]: https://discordapp.com/developers/docs/resources/channel#channel-object-channel-structure
default_thread_rate_limit_per_user
rust
twilight-rs/twilight
twilight-http/src/request/guild/create_guild_channel.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/create_guild_channel.rs
ISC
pub fn parent_id(mut self, parent_id: Id<ChannelMarker>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.parent_id = Some(parent_id); } self }
If this is specified, and the parent ID is a `ChannelType::CategoryChannel`, create this channel as a child of the category channel.
parent_id
rust
twilight-rs/twilight
twilight-http/src/request/guild/create_guild_channel.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/create_guild_channel.rs
ISC
pub fn rtc_region(mut self, rtc_region: &'a str) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.rtc_region = Some(rtc_region); } self }
For voice and stage channels, set the channel's RTC region.
rtc_region
rust
twilight-rs/twilight
twilight-http/src/request/guild/create_guild_channel.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/create_guild_channel.rs
ISC
pub fn topic(mut self, topic: &'a str) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_topic(topic)?; fields.topic.replace(topic); Ok(fields) }); self }
Set the topic. The maximum length is 1024 UTF-16 characters. See [Discord Docs/Channel Object]. # Errors Returns an error of type [`TopicInvalid`] if the name is invalid. [`TopicInvalid`]: twilight_validate::channel::ChannelValidationErrorType::TopicInvalid [Discord Docs/Channel Object]: https://discordapp.com/developers/docs/resources/channel#channel-object-channel-structure
topic
rust
twilight-rs/twilight
twilight-http/src/request/guild/create_guild_channel.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/create_guild_channel.rs
ISC
pub fn include_roles(mut self, roles: &'a [Id<RoleMarker>]) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.include_roles = roles; } self }
List of roles to include when pruning.
include_roles
rust
twilight-rs/twilight
twilight-http/src/request/guild/create_guild_prune.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/create_guild_prune.rs
ISC
pub fn compute_prune_count(mut self, compute_prune_count: bool) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.compute_prune_count = Some(compute_prune_count); } self }
Return the amount of pruned members. Discouraged for large guilds.
compute_prune_count
rust
twilight-rs/twilight
twilight-http/src/request/guild/create_guild_prune.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/create_guild_prune.rs
ISC
pub fn days(mut self, days: u16) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_guild_prune_days(days)?; fields.days = Some(days); Ok(fields) }); self }
Set the number of days that a user must be inactive before being pruned. The number of days must be greater than 0. # Errors Returns an error of type [`GuildPruneDays`] if the number of days is 0 or more than 30. [`GuildPruneDays`]: twilight_validate::request::ValidationErrorType::GuildPruneDays
days
rust
twilight-rs/twilight
twilight-http/src/request/guild/create_guild_prune.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/create_guild_prune.rs
ISC
pub fn after(mut self, after: u64) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.after = Some(after); } self }
Get audit log entries after the entry specified.
after
rust
twilight-rs/twilight
twilight-http/src/request/guild/get_audit_log.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/get_audit_log.rs
ISC
pub fn before(mut self, before: u64) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.before = Some(before); } self }
Get audit log entries before the entry specified.
before
rust
twilight-rs/twilight
twilight-http/src/request/guild/get_audit_log.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/get_audit_log.rs
ISC
pub fn user_id(mut self, user_id: Id<UserMarker>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.user_id = Some(user_id); } self }
Filter audit log for entries from a user. This is the user who did the auditable action, not the target of the auditable action.
user_id
rust
twilight-rs/twilight
twilight-http/src/request/guild/get_audit_log.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/get_audit_log.rs
ISC
pub const fn with_counts(mut self, with: bool) -> Self { self.fields.with_counts = with; self }
Sets if you want to receive `approximate_member_count` and `approximate_presence_count` in the guild structure.
with_counts
rust
twilight-rs/twilight
twilight-http/src/request/guild/get_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/get_guild.rs
ISC
pub fn nick(mut self, nick: Option<&'a str>) -> Self { self.fields = self.fields.and_then(|mut fields| { if let Some(nick) = nick { validate_nickname(nick)?; } fields.nick = Some(Nullable(nick)); Ok(fields) }); self }
Set the current user's nickname. Set to [`None`] to clear the nickname. The minimum length is 1 UTF-16 character and the maximum is 32 UTF-16 characters. # Errors Returns an error of type [`Nickname`] if the nickname length is too short or too long. [`Nickname`]: twilight_validate::request::ValidationErrorType::Nickname
nick
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_current_member.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_current_member.rs
ISC
pub fn afk_channel_id(mut self, afk_channel_id: Option<Id<ChannelMarker>>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.afk_channel_id = Some(Nullable(afk_channel_id)); } self }
Set the voice channel where AFK voice users are sent.
afk_channel_id
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn afk_timeout(mut self, afk_timeout: u64) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.afk_timeout = Some(afk_timeout); } self }
Set how much time it takes for a voice user to be considered AFK.
afk_timeout
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn banner(mut self, banner: Option<&'a str>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.banner = Some(Nullable(banner)); } self }
Set the banner. This is a base64 encoded 16:9 PNG or JPEG image. Pass `None` to remove the banner. The server must have the `BANNER` feature.
banner
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn default_message_notifications( mut self, default_message_notifications: Option<DefaultMessageNotificationLevel>, ) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.default_message_notifications = Some(Nullable(default_message_notifications)); } self }
Set the default message notification level. See [Discord Docs/Create Guild] for more information. [Discord Docs/Create Guild]: https://discord.com/developers/docs/resources/guild#create-guild
default_message_notifications
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn discovery_splash(mut self, discovery_splash: Option<&'a str>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.discovery_splash = Some(Nullable(discovery_splash)); } self }
Set the guild's discovery splash image. Requires the guild to have the `DISCOVERABLE` feature enabled.
discovery_splash
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn explicit_content_filter( mut self, explicit_content_filter: Option<ExplicitContentFilter>, ) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.explicit_content_filter = Some(Nullable(explicit_content_filter)); } self }
Set the explicit content filter level.
explicit_content_filter
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn features(mut self, features: &'a [&'a str]) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.features = Some(features); } self }
Set the enabled features of the guild. Attempting to add or remove the [`GuildFeature::Community`] feature requires the [`Permissions::ADMINISTRATOR`] permission. Attempting to add or remove the [`GuildFeature::Discoverable`] feature requires the [`Permissions::ADMINISTRATOR`] permission. Additionally the guild must pass all the discovery requirements. Attempting to add or remove the [`GuildFeature::InvitesDisabled`] feature requires the [`Permissions::MANAGE_GUILD`] permission. [`GuildFeature::Community`]: twilight_model::guild::GuildFeature::Community [`GuildFeature::Discoverable`]: twilight_model::guild::GuildFeature::Discoverable [`GuildFeature::InvitesDisabled`]: twilight_model::guild::GuildFeature::InvitesDisabled [`Permissions::ADMINISTRATOR`]: twilight_model::guild::Permissions::ADMINISTRATOR [`Permissions::MANAGE_GUILD`]: twilight_model::guild::Permissions::MANAGE_GUILD
features
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn icon(mut self, icon: Option<&'a str>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.icon = Some(Nullable(icon)); } self }
Set the icon. This 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
icon
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn name(mut self, name: &'a str) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_guild_name(name)?; fields.name.replace(name); Ok(fields) }); self }
Set the name of the guild. The minimum length is 1 UTF-16 character and the maximum is 100 UTF-16 characters. # Errors Returns an error of type [`GuildName`] if the name length is too short or too long. [`GuildName`]: twilight_validate::request::ValidationErrorType::GuildName
name
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn owner_id(mut self, owner_id: Id<UserMarker>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.owner_id = Some(owner_id); } self }
Transfer ownership to another user. Only works if the current user is the owner.
owner_id
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn splash(mut self, splash: Option<&'a str>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.splash = Some(Nullable(splash)); } self }
Set the guild's splash image. Requires the guild to have the `INVITE_SPLASH` feature enabled.
splash
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn system_channel(mut self, system_channel_id: Option<Id<ChannelMarker>>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.system_channel_id = Some(Nullable(system_channel_id)); } self }
Set the channel where events such as welcome messages are posted.
system_channel
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn rules_channel(mut self, rules_channel_id: Option<Id<ChannelMarker>>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.rules_channel_id = Some(Nullable(rules_channel_id)); } self }
Set the rules channel. Requires the guild to be `PUBLIC`. See [Discord Docs/Modify Guild]. [Discord Docs/Modify Guild]: https://discord.com/developers/docs/resources/guild#modify-guild
rules_channel
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn public_updates_channel( mut self, public_updates_channel_id: Option<Id<ChannelMarker>>, ) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.public_updates_channel_id = Some(Nullable(public_updates_channel_id)); } self }
Set the public updates channel. Requires the guild to be `PUBLIC`.
public_updates_channel
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn preferred_locale(mut self, preferred_locale: Option<&'a str>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.preferred_locale = Some(Nullable(preferred_locale)); } self }
Set the preferred locale for the guild. Defaults to `en-US`. Requires the guild to be `PUBLIC`.
preferred_locale
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn verification_level(mut self, verification_level: Option<VerificationLevel>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.verification_level = Some(Nullable(verification_level)); } self }
Set the verification level. See [Discord Docs/Guild Object]. [Discord Docs/Guild Object]: https://discord.com/developers/docs/resources/guild#guild-object-verification-level
verification_level
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub fn premium_progress_bar_enabled(mut self, premium_progress_bar_enabled: bool) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.premium_progress_bar_enabled = Some(premium_progress_bar_enabled); } self }
Set whether the premium progress bar is enabled.
premium_progress_bar_enabled
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild.rs
ISC
pub const fn enabled(mut self, enabled: bool) -> Self { self.fields.enabled = Some(enabled); self }
Set whether the welcome screen is enabled.
enabled
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild_welcome_screen.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild_welcome_screen.rs
ISC
pub const fn welcome_channels(mut self, welcome_channels: &'a [WelcomeScreenChannel]) -> Self { self.fields.welcome_channels = welcome_channels; self }
Set the channels linked in the welcome screen, with associated metadata.
welcome_channels
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild_welcome_screen.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild_welcome_screen.rs
ISC
pub const fn channel_id(mut self, channel_id: Option<Id<ChannelMarker>>) -> Self { self.fields.channel_id = Some(Nullable(channel_id)); self }
Set which channel to display on the widget.
channel_id
rust
twilight-rs/twilight
twilight-http/src/request/guild/update_guild_widget_settings.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/update_guild_widget_settings.rs
ISC
pub fn action_block_message(mut self) -> Self { self.fields = self.fields.map(|mut fields| { fields.actions.get_or_insert_with(Vec::new).push( CreateAutoModerationRuleFieldsAction { kind: AutoModerationActionType::BlockMessage, metadata: CreateAutoModerationRuleFieldsActionMetadata::default(), }, ); fields }); self }
Append an action of type [`BlockMessage`]. [`BlockMessage`]: AutoModerationActionType::BlockMessage
action_block_message
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
ISC
pub fn action_send_alert_message(mut self, channel_id: Id<ChannelMarker>) -> Self { self.fields = self.fields.map(|mut fields| { fields.actions.get_or_insert_with(Vec::new).push( CreateAutoModerationRuleFieldsAction { kind: AutoModerationActionType::SendAlertMessage, metadata: CreateAutoModerationRuleFieldsActionMetadata { channel_id: Some(channel_id), ..Default::default() }, }, ); fields }); self }
Append an action of type [`SendAlertMessage`]. [`SendAlertMessage`]: AutoModerationActionType::SendAlertMessage
action_send_alert_message
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
ISC
pub fn action_timeout(mut self, duration_seconds: u32) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_auto_moderation_action_metadata_duration_seconds(duration_seconds)?; fields.actions.get_or_insert_with(Vec::new).push( CreateAutoModerationRuleFieldsAction { kind: AutoModerationActionType::Timeout, metadata: CreateAutoModerationRuleFieldsActionMetadata { duration_seconds: Some(duration_seconds), ..Default::default() }, }, ); Ok(fields) }); self }
Append an action of type [`Timeout`]. # Errors Returns [`ValidationErrorType::AutoModerationActionMetadataDurationSeconds`] if the duration is invalid. [`Timeout`]: AutoModerationActionType::Timeout [`ValidationErrorType::AutoModerationActionMetadataDurationSeconds`]: twilight_validate::request::ValidationErrorType::AutoModerationActionMetadataDurationSeconds
action_timeout
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
ISC
pub fn enabled(mut self, enabled: bool) -> Self { self.fields = self.fields.map(|mut fields| { fields.enabled = Some(enabled); fields }); self }
Set whether the rule is enabled.
enabled
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
ISC
pub fn exempt_channels(mut self, exempt_channels: &'a [Id<ChannelMarker>]) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_auto_moderation_exempt_channels(exempt_channels)?; fields.exempt_channels = Some(exempt_channels); Ok(fields) }); self }
Set the channels where the rule does not apply. See [Discord Docs/Trigger Metadata]. # Errors Returns [`ValidationErrorType::AutoModerationExemptChannels`] if the `exempt_roles` field is invalid. [Discord Docs/Trigger Metadata]: https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata [`ValidationErrorType::AutoModerationExemptChannels`]: twilight_validate::request::ValidationErrorType::AutoModerationExemptChannels
exempt_channels
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
ISC
pub fn exempt_roles(mut self, exempt_roles: &'a [Id<RoleMarker>]) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_auto_moderation_exempt_roles(exempt_roles)?; fields.exempt_roles = Some(exempt_roles); Ok(fields) }); self }
Set the roles to which the rule does not apply. See [Discord Docs/Trigger Metadata]. # Errors Returns [`ValidationErrorType::AutoModerationExemptRoles`] if the `exempt_roles` field is invalid. [Discord Docs/Trigger Metadata]: https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata [`ValidationErrorType::AutoModerationExemptRoles`]: twilight_validate::request::ValidationErrorType::AutoModerationExemptRoles
exempt_roles
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
ISC
pub fn with_keyword( mut self, keyword_filter: &'a [&'a str], regex_patterns: &'a [&'a str], allow_list: &'a [&'a str], ) -> ResponseFuture<AutoModerationRule> { self.fields = self.fields.and_then(|mut fields| { validate_auto_moderation_metadata_keyword_allow_list(allow_list)?; validate_auto_moderation_metadata_keyword_filter(keyword_filter)?; validate_auto_moderation_metadata_regex_patterns(regex_patterns)?; fields.trigger_metadata = Some(CreateAutoModerationRuleFieldsTriggerMetadata { allow_list: Some(allow_list), keyword_filter: Some(keyword_filter), presets: None, mention_total_limit: None, regex_patterns: Some(regex_patterns), }); fields.trigger_type = Some(AutoModerationTriggerType::Keyword); Ok(fields) }); self.exec() }
Create the request with the trigger type [`Keyword`], then execute it. Rules of this type require the `keyword_filter`, `regex_patterns` and `allow_list` fields specified, and this method ensures this. See [Discord Docs/Keyword Matching Strategies] and [Discord Docs/Trigger Metadata] for more information. Only rust-flavored regex is currently supported by Discord. # Errors Returns [`ValidationErrorType::AutoModerationMetadataKeywordFilter`] if the `keyword_filter` field is invalid. Returns [`ValidationErrorType::AutoModerationMetadataKeywordFilterItem`] if a `keyword_filter` item is invalid. Returns [`ValidationErrorType::AutoModerationMetadataAllowList`] if the `allow_list` field is invalid. Returns [`ValidationErrorType::AutoModerationMetadataAllowListItem`] if an `allow_list` item is invalid. Returns [`ValidationErrorType::AutoModerationMetadataRegexPatterns`] if the `regex_patterns` field is invalid. Returns [`ValidationErrorType::AutoModerationMetadataRegexPatternsItem`] if a `regex_patterns` item is invalid. [`Keyword`]: AutoModerationTriggerType::Keyword [Discord Docs/Keyword Matching Strategies]: https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies [Discord Docs/Trigger Metadata]: https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata [`ValidationErrorType::AutoModerationMetadataKeywordFilter`]: twilight_validate::request::ValidationErrorType::AutoModerationMetadataKeywordFilter [`ValidationErrorType::AutoModerationMetadataKeywordFilterItem`]: twilight_validate::request::ValidationErrorType::AutoModerationMetadataKeywordFilterItem [`ValidationErrorType::AutoModerationMetadataAllowList`]: twilight_validate::request::ValidationErrorType::AutoModerationMetadataAllowList [`ValidationErrorType::AutoModerationMetadataAllowListItem`]: twilight_validate::request::ValidationErrorType::AutoModerationMetadataAllowListItem [`ValidationErrorType::AutoModerationMetadataRegexPatterns`]: twilight_validate::request::ValidationErrorType::AutoModerationMetadataRegexPatterns [`ValidationErrorType::AutoModerationMetadataRegexPatternsItem`]: twilight_validate::request::ValidationErrorType::AutoModerationMetadataRegexPatternsItem
with_keyword
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
ISC
pub fn with_spam(mut self) -> ResponseFuture<AutoModerationRule> { self.fields = self.fields.map(|mut fields| { fields.trigger_type = Some(AutoModerationTriggerType::Spam); fields }); self.exec() }
Create the request with the trigger type [`Spam`], then execute it. [`Spam`]: AutoModerationTriggerType::Spam
with_spam
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
ISC
pub fn with_keyword_preset( mut self, presets: &'a [AutoModerationKeywordPresetType], allow_list: &'a [&'a str], ) -> ResponseFuture<AutoModerationRule> { self.fields = self.fields.and_then(|mut fields| { validate_auto_moderation_metadata_keyword_allow_list(allow_list)?; fields.trigger_metadata = Some(CreateAutoModerationRuleFieldsTriggerMetadata { allow_list: Some(allow_list), keyword_filter: None, presets: Some(presets), mention_total_limit: None, regex_patterns: None, }); fields.trigger_type = Some(AutoModerationTriggerType::KeywordPreset); Ok(fields) }); self.exec() }
Create the request with the trigger type [`KeywordPreset`], then execute it. Rules of this type require the `presets` and `allow_list` fields specified, and this method ensures this. See [Discord Docs/TriggerMetadata]. # Errors Returns [`ValidationErrorType::AutoModerationMetadataPresetAllowList`] if the `allow_list` is invalid. Returns [`ValidationErrorType::AutoModerationMetadataPresetAllowListItem`] if a `allow_list` item is invalid. [`KeywordPreset`]: AutoModerationTriggerType::KeywordPreset [Discord Docs/Trigger Metadata]: https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata [`ValidationErrorType::AutoModerationMetadataPresetAllowList`]: twilight_validate::request::ValidationErrorType::AutoModerationMetadataPresetAllowList [`ValidationErrorType::AutoModerationMetadataPresetAllowListItem`]: twilight_validate::request::ValidationErrorType::AutoModerationMetadataPresetAllowListItem
with_keyword_preset
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/create_auto_moderation_rule.rs
ISC
pub const fn exempt_channels(mut self, exempt_channels: &'a [Id<ChannelMarker>]) -> Self { self.fields.exempt_channels = Some(exempt_channels); self }
Set the channels where the rule does not apply.
exempt_channels
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/update_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/update_auto_moderation_rule.rs
ISC
pub const fn exempt_roles(mut self, exempt_roles: &'a [Id<RoleMarker>]) -> Self { self.fields.exempt_roles = Some(exempt_roles); self }
Set the roles to which the rule does not apply.
exempt_roles
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/update_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/update_auto_moderation_rule.rs
ISC
pub const fn trigger_metadata( mut self, trigger_metadata: &'a AutoModerationTriggerMetadata, ) -> Self { self.fields.trigger_metadata = Some(trigger_metadata); self }
Set the trigger metadata. Care must be taken to set the correct metadata based on the rule's type.
trigger_metadata
rust
twilight-rs/twilight
twilight-http/src/request/guild/auto_moderation/update_auto_moderation_rule.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/auto_moderation/update_auto_moderation_rule.rs
ISC
pub fn delete_message_seconds(mut self, seconds: u32) -> Self { self.fields = self.fields.and_then(|mut fields| { validate_create_guild_ban_delete_message_seconds(seconds)?; fields.delete_message_seconds = Some(seconds); Ok(fields) }); self }
Set the number of seconds' worth of messages to delete. The number of seconds must be less than or equal to `604_800` (this is equivalent to `7` days). # Errors Returns an error of type [`CreateGuildBanDeleteMessageSeconds`] if the number of seconds is greater than `604_800` (this is equivalent to `7` days). [`CreateGuildBanDeleteMessageSeconds`]: twilight_validate::request::ValidationErrorType::CreateGuildBanDeleteMessageSeconds
delete_message_seconds
rust
twilight-rs/twilight
twilight-http/src/request/guild/ban/create_ban.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/ban/create_ban.rs
ISC