Table of Contents

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

fileUpload FileUploadComponent

The 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

customId string

The custom id of the current file upload.

minValues int?

The minimum number of items that must be uploaded (defaults to 1).

maxValues int?

the maximum number of items that can be uploaded (defaults to 1).

isRequired bool

Whether the current file upload requires files to be uploaded before submitting the modal.

id int?

The id for the component.

Fields

MaxFileCount

The maximum number of values for the MinValues and MaxValues properties.

public const int MaxFileCount = 10

Field Value

int

Properties

CustomId

Gets or sets the custom id of the current file upload.

public string CustomId { get; set; }

Property Value

string

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

bool

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

ComponentType

Methods

Build()

Runs validation checks and builds the component.

public FileUploadComponent Build()

Returns

FileUploadComponent

WithCustomId(string)

Sets the custom id of the current file upload.

public FileUploadComponentBuilder WithCustomId(string customId)

Parameters

customId string

The 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

maxValues int?

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

minValues int?

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

isRequired bool

Whether the current file upload requires files to be uploaded before submitting the modal.

Returns

FileUploadComponentBuilder

The current builder.