InputBuilder class
constructor
The constructor provides one optional argument which is an object which provides the data for the ButtonBuilder class.
The object may contain the following information:
custom_id
: An id so you can recognize the input when the form has been submitted by a member. The id must be unique and a string between 1-100 characters.min_length
: A number which defines the minimum amount of characters a member should provide.max_length
: A number which defines the maximum amount of characters a member may provide.value
: A string which defines the default value of the input.placeholder
: A string which defines the default placeholder a member will see when no text has been written in the input.required
: A boolean which defines whether the input is required to fill in or not.label
: A string of maximum 45 characters which will be shown just above the input.style
: A number or a string which defines the type of style of the input. (short
orparagraph
)
Properties
custom_id
An id so you can recognize the input when the form has been submitted by a member. The id must be unique and a string between 1-100 characters.
min_length
A number which defines the minimum amount of characters a member should provide.
max_length
A number which defines the maximum amount of characters a member may provide.
value
A string which defines the default value of the input.
placeholder
A string which defines the default placeholder a member will see when no text has been written in the input.
required
A boolean which defines whether the input is required to fill in or not.
label
A string of maximum 45 characters which will be shown just above the input.
style
A number which defines the type of style of the input.
Functions
setCustomId
Sets a custom id for the input which will be returned to the bot once the form the input has been added in has been submitted and makes you able to recognize the input. The function returns the same InputBuilder class so you don't have to declare it everytime again.
Argument | Description |
---|---|
customId | A string of max 100 characters which will be returned to the bot in the formSubmit event so you can recognize the iinput which was filled in by the member. |
setRequired
Defines whether the input must be filled in or not. The function returns the same InputBuilder class so you don't have to declare it everytime again.
Argument | Description |
---|---|
disabled | A boolean which defines whether the input must be filled in or not. |
setLabel
Sets a label for the input which is visible just above the input for the member filling in the form. The function returns the same InputBuilder class so you don't have to declare it everytime again.
Argument | Description |
---|---|
label | A string of max 45 characters which will be visible just above the input in the form. |
setValue
Sets a default value for the input. The value will already be filled in when the member gets to see the form for the first time. The function returns the same InputBuilder class so you don't have to declare it everytime again.
Argument | Description |
---|---|
value | A string of max 100 characters which should be the default value of the input. |
setStyle
Sets the style of the input and defines how the input will look like. The function returns the same InputBuilder class so you don't have to declare it everytime again.
Argument | Description |
---|---|
style | A string or a number which defines the style of the input. In the table below is explained which strings and numbers are allowed. |
Type | Description |
---|---|
| The style of the input will become a short input of one line. |
| The style of the input will become a longer input with multiple paragraphs. |
setPlaceholder
Sets a placeholder for the input. This text will be visible when the input is empty. The function will return the same InputBuilder class so you don't have to declare it everytime again.
Argument | Description |
---|---|
placeholder | The placeholder you'd like to give the input. The placeholder will be visible when the member hasn't written anything in the input. This must be a string of maximum 100 characters. |
setMinLength
Sets the minimum length of characters which the member must provide. The function will return the same InputBuilder class so you don't have to declare it everytime again.
Argument | Description |
---|---|
minLength | The minimum amount of characters the member must provide in the input. |
setMaxLength
Sets the maximum length of characters which the member may provide. The function will return the same InputBuilder class so you don't have to declare it everytime again.
Argument | Description |
---|---|
maxLength | The minimum amount of characters the member may provide in the input. |
toJSON
Converts the ButtonBuilder class to an object to make it a valid object for the Discord API. The function returns the same data as the data property.
Last updated