pub struct FileUploadBuilder { /* private fields */ }Expand description
Builds a file upload for a modal’s label: users attach 0-10 files.
min_values is 0-10 (at least 1 while the upload is required), max_values 1-10 and at
least min_values; at most 10 file types.
discord.js counterpart: FileUploadBuilder.
Implementations§
Source§impl FileUploadBuilder
impl FileUploadBuilder
Sourcepub fn new(custom_id: impl Into<CompactString>) -> Self
pub fn new(custom_id: impl Into<CompactString>) -> Self
Creates a required upload of one file, sending custom_id (1-100 characters).
discord.js counterpart: new FileUploadBuilder().setCustomId(…).
Sourcepub fn min_values(self, min_values: u8) -> Self
pub fn min_values(self, min_values: u8) -> Self
Sets how many files must be uploaded at least (0-10; Discord’s default: 1).
discord.js counterpart: setMinValues.
Sourcepub fn max_values(self, max_values: u8) -> Self
pub fn max_values(self, max_values: u8) -> Self
Sets how many files can be uploaded at most (1-10; Discord’s default: 1).
discord.js counterpart: setMaxValues.
Sourcepub fn required(self, required: bool) -> Self
pub fn required(self, required: bool) -> Self
Sets whether files must be uploaded to submit the modal (default: yes).
discord.js counterpart: setRequired.
Sourcepub fn file_types<T: Into<CompactString>>(
self,
file_types: impl IntoIterator<Item = T>,
) -> Self
pub fn file_types<T: Into<CompactString>>( self, file_types: impl IntoIterator<Item = T>, ) -> Self
Sets the file types
users may pick — image, video, audio or extensions such as .pdf, at most 10 —,
replacing those set before.
discord.js counterpart: setFileTypes.
Source§impl FileUploadBuilder
impl FileUploadBuilder
Sourcepub fn id(self, id: i32) -> Self
pub fn id(self, id: i32) -> Self
Sets the component’s numeric identifier (Discord generates one otherwise); it must be unique in the message or modal.
discord.js counterpart: setId.
Sourcepub fn build(self) -> Result<Component, ValidationError>
pub fn build(self) -> Result<Component, ValidationError>
Checks the component (and what it contains) and returns it.
discord.js counterpart: toJSON of the component builders.
§Errors
The first ValidationError found; see the type docs
for the rules.
Sourcepub fn build_unchecked(self) -> Component
pub fn build_unchecked(self) -> Component
Returns the component without any check (D-180).
discord.js counterpart: toJSON of the component builders with validation off (disableValidators).