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 content(mut self, content: &'a str) -> Self { self.0 = self.0.and_then(|mut inner| { validate_content(content)?; inner.fields.message.content = Some(content); Ok(inner) }); 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/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 fn sticker_ids(mut self, sticker_ids: &'a [Id<StickerMarker>]) -> Self { self.0 = self.0.and_then(|mut inner| { validate_sticker_ids(sticker_ids)?; inner.fields.message.sticker_ids = Some(sticker_ids); Ok(inner) }); 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/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 applied_tags(mut self, applied_tags: &'a [Id<TagMarker>]) -> Self { self.fields.applied_tags = Some(applied_tags); self }
Set the forum thread's applied tags.
applied_tags
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 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 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/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 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 .attachment_manager .set_files(attachments.iter().collect()); } } 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`]: twilight_validate::message::MessageValidationErrorType::AttachmentDescriptionTooLarge [`AttachmentFilename`]: twilight_validate::message::MessageValidationErrorType::AttachmentFilename
attachments
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 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 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 }
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/webhook/execute_webhook.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/execute_webhook.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/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 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 flag is [`SUPPRESS_EMBEDS`]. [`SUPPRESS_EMBEDS`]: MessageFlags::SUPPRESS_EMBEDS
flags
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 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]. Without [`payload_json`]: ```no_run # #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { use twilight_http::Client; use twilight_model::id::Id; use twilight_util::builder::embed::EmbedBuilder; let client = Client::new("token".to_owned()); let message = client .execute_webhook(Id::new(1), "token here") .content("some content") .embeds(&[EmbedBuilder::new().title("title").validate()?.build()]) .wait() .await? .model() .await?; assert_eq!(message.content, "some content"); # Ok(()) } ``` With [`payload_json`]: ```no_run # #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { use twilight_http::Client; use twilight_model::id::Id; use twilight_util::builder::embed::EmbedBuilder; let client = Client::new("token".to_owned()); let message = client .execute_webhook(Id::new(1), "token here") .content("some content") .payload_json(br#"{ "content": "other content", "embeds": [ { "title": "title" } ] }"#) .wait() .await? .model() .await?; assert_eq!(message.content, "other content"); # Ok(()) } ``` [Discord Docs/Uploading Files]: https://discord.com/developers/docs/reference#uploading-files [`attachments`]: Self::attachments [`payload_json`]: Self::payload_json
payload_json
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_id(mut self, thread_id: Id<ChannelMarker>) -> Self { self.thread_id.replace(thread_id); self }
Execute in a thread belonging to the channel instead of the channel itself.
thread_id
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 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/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 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/get_webhook.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/get_webhook.rs
ISC
pub fn thread_id(mut self, thread_id: Id<ChannelMarker>) -> Self { self.thread_id.replace(thread_id); self }
Get a message in a thread belonging to the channel instead of the channel itself.
thread_id
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/get_webhook_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/get_webhook_message.rs
ISC
pub fn avatar(mut self, avatar: Option<&'a str>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.avatar = Some(Nullable(avatar)); } 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/update_webhook.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_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 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/channel/webhook/update_webhook_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_webhook_message.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 .attachment_manager .set_files(attachments.iter().collect()); } } self }
Attach multiple new files to the message. This method clears 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`]: twilight_validate::message::MessageValidationErrorType::AttachmentDescriptionTooLarge [`AttachmentFilename`]: twilight_validate::message::MessageValidationErrorType::AttachmentFilename
attachments
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/update_webhook_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_webhook_message.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)); Ok(fields) }); self }
Set the message's list of [`Component`]s. Calling this method will clear previous calls. Requires a webhook owned by the application. # 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 component.
components
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/update_webhook_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_webhook_message.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`, or `embeds`. # 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/webhook/update_webhook_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_webhook_message.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 // the actual list is not empty. fields.attachments = Some(Nullable(Some(Vec::new()))); } self }
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. If not called, all attachments will be kept. [`attachments`]: Self::attachments
keep_attachment_ids
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/update_webhook_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_webhook_message.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 request fields. If this method is called, all other methods are ignored, except for [`attachments`]. If uploading attachments, you must ensure that the `attachments` key corresponds properly to the provided list. See [Discord Docs/Create Message] and [`ExecuteWebhook::payload_json`]. [`attachments`]: Self::attachments [`ExecuteWebhook::payload_json`]: super::ExecuteWebhook::payload_json [Discord Docs/Create Message]: https://discord.com/developers/docs/resources/channel#create-message-params
payload_json
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/update_webhook_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_webhook_message.rs
ISC
pub fn thread_id(mut self, thread_id: Id<ChannelMarker>) -> Self { self.thread_id.replace(thread_id); self }
Update in a thread belonging to the channel instead of the channel itself.
thread_id
rust
twilight-rs/twilight
twilight-http/src/request/channel/webhook/update_webhook_message.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_webhook_message.rs
ISC
pub fn avatar(mut self, avatar: Option<&'a str>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.avatar = Some(Nullable(avatar)); } 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/update_webhook_with_token.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_webhook_with_token.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_with_token.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/channel/webhook/update_webhook_with_token.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/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 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/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_auto_archive_duration( mut self, auto_archive_duration: AutoArchiveDuration, ) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.default_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.
default_auto_archive_duration
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_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 forum layout for new forum channels.
default_forum_layout
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_reaction_emoji(mut self, default_reaction_emoji: &'a DefaultReaction) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.default_reaction_emoji = Some(default_reaction_emoji); } self }
Set the default reaction emoji for new forum threads.
default_reaction_emoji
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_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 nsfw(mut self, nsfw: bool) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.nsfw = Some(nsfw); } self }
Set whether the channel is marked as NSFW.
nsfw
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 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.
permission_overwrites
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 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/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 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 }
For voice channels, set the channel's video quality mode.
video_quality_mode
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 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 able to be pruned. The number of days must be greater than 0, and less than or equal to 30. # 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/get_guild_prune_count.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/get_guild_prune_count.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 calculating prune count
include_roles
rust
twilight-rs/twilight
twilight-http/src/request/guild/get_guild_prune_count.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/get_guild_prune_count.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 description(mut self, description: &'a str) -> Self { self.fields.description = Some(description); self }
Set the description of the welcome screen.
description
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 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 const fn enabled(mut self, enabled: bool) -> Self { self.fields.enabled = Some(enabled); self }
Set to true to enable the guild widget.
enabled
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
fn exec(self) -> ResponseFuture<AutoModerationRule> { 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/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 enabled(mut self, enabled: bool) -> Self { self.fields.enabled = Some(enabled); self }
Set whether the rule is enabled.
enabled
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_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
pub fn after(mut self, user_id: Id<UserMarker>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.after = Some(user_id); } self }
Set the user ID after which to retrieve bans. Mutually exclusive with [`before`]. If both are provided then [`before`] is respected. [`before`]: Self::before
after
rust
twilight-rs/twilight
twilight-http/src/request/guild/ban/get_bans.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/ban/get_bans.rs
ISC
pub fn before(mut self, user_id: Id<UserMarker>) -> Self { if let Ok(fields) = self.fields.as_mut() { fields.before = Some(user_id); } self }
Set the user ID before which to retrieve bans. Mutually exclusive with [`after`]. If both are provided then [`before`] is respected. [`after`]: Self::after [`before`]: Self::before
before
rust
twilight-rs/twilight
twilight-http/src/request/guild/ban/get_bans.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/ban/get_bans.rs
ISC
pub const fn new(name: String) -> Self { Self(Ok(RoleFields { color: None, hoist: None, id: Self::ROLE_ID, mentionable: None, name, permissions: None, position: None, })) }
Create a new default role field builder.
new
rust
twilight-rs/twilight
twilight-http/src/request/guild/create_guild/builder.rs
https://github.com/twilight-rs/twilight/blob/master/twilight-http/src/request/guild/create_guild/builder.rs
ISC