Class FileUploadComponentBuilder
- Namespace
- Discord
- Assembly
- Discord.Net.Core.dll
Represents a class used to build FileUploadComponent's.
public class FileUploadComponentBuilder : IInteractableComponentBuilder, IMessageComponentBuilder
- Inheritance
-
FileUploadComponentBuilder
- Implements
- Inherited Members
- Extension Methods
Constructors
FileUploadComponentBuilder()
Initializes a new instance of the FileUploadComponentBuilder.
public FileUploadComponentBuilder()
FileUploadComponentBuilder(FileUploadComponent)
Initializes a new instance of the FileUploadComponentBuilder class from an existing FileUploadComponent.
public FileUploadComponentBuilder(FileUploadComponent fileUpload)
Parameters
fileUploadFileUploadComponentThe component.
FileUploadComponentBuilder(string, int?, int?, bool, int?)
Initializes a new instance of the FileUploadComponentBuilder.
public FileUploadComponentBuilder(string customId, int? minValues = null, int? maxValues = null, bool isRequired = true, int? id = null)
Parameters
customIdstringThe custom id of the current file upload.
minValuesint?The minimum number of items that must be uploaded (defaults to 1).
maxValuesint?the maximum number of items that can be uploaded (defaults to 1).
isRequiredboolWhether the current file upload requires files to be uploaded before submitting the modal.
idint?The id for the component.
Fields
MaxFileCount
public const int MaxFileCount = 10
Field Value
Properties
CustomId
Gets or sets the custom id of the current file upload.
public string CustomId { get; set; }
Property Value
Exceptions
- ArgumentException
CustomId length exceeds MaxCustomIdLength.
- ArgumentException
CustomId length subceeds 1.
Id
Gets or sets the id for the component. An autoincremented id will be assigned if not set.
public int? Id { get; set; }
Property Value
- int?
IsRequired
Gets or sets a value indicating whether the current file upload requires files to be uploaded before submitting the modal (defaults to true).
public bool IsRequired { get; set; }
Property Value
MaxValues
Gets or sets the maximum number of items that can be uploaded (defaults to 1).
public int? MaxValues { get; set; }
Property Value
- int?
Exceptions
- ArgumentException
MaxValues exceeds MaxFileCount.
MinValues
Gets or sets the minimum number of items that must be uploaded (defaults to 1).
public int? MinValues { get; set; }
Property Value
- int?
Exceptions
- ArgumentException
MinValues exceeds MaxFileCount.
- ArgumentException
MinValues length subceeds 0.
Type
Gets the type of the component.
public ComponentType Type { get; }
Property Value
Methods
Build()
Runs validation checks and builds the component.
public FileUploadComponent Build()
Returns
WithCustomId(string)
Sets the custom id of the current file upload.
public FileUploadComponentBuilder WithCustomId(string customId)
Parameters
customIdstringThe id to use for the current file upload.
Returns
- FileUploadComponentBuilder
The current builder.
Exceptions
- ArgumentException
CustomId length exceeds MaxCustomIdLength.
- ArgumentException
CustomId length subceeds 1.
WithMaxValues(int?)
Sets the maximum number of items that can be uploaded (defaults to 1).
public FileUploadComponentBuilder WithMaxValues(int? maxValues)
Parameters
maxValuesint?The maximum number of items that can be uploaded.
Returns
- FileUploadComponentBuilder
The current builder.
Exceptions
- ArgumentException
MaxValues exceeds MaxFileCount.
WithMinValues(int?)
Sets the minimum number of items that must be uploaded (defaults to 1).
public FileUploadComponentBuilder WithMinValues(int? minValues)
Parameters
minValuesint?Sets the minimum number of items that must be uploaded.
Returns
- FileUploadComponentBuilder
The current builder.
Exceptions
- ArgumentException
MinValues exceeds MaxFileCount.
- ArgumentException
MinValues length subceeds 0.
WithRequired(bool)
Sets whether the current file upload requires files to be uploaded before submitting the modal.
public FileUploadComponentBuilder WithRequired(bool isRequired)
Parameters
isRequiredboolWhether the current file upload requires files to be uploaded before submitting the modal.
Returns
- FileUploadComponentBuilder
The current builder.