FormBuilder class
constructor
The constructor provides one optional argument which is an object which provides the data for the FormBuilder class.
The object may contain the following information:
custom_id
: An id so you can recognize the form when it's being submitted by a member. The id must be unique and a string between 1-100 characters.title
: The title the form should have.inputs
: An array with objects which defines the inputs which should be added in the form.components
: Identical to theinputs
key.
Properties
title
A string which defines the title which was set for the form.
inputs
An array with objects which define the inputs which will be added in the form.
custom_id
A unique id where you can recognize the form with.
components
Identical to the inputs
property.
Functions
setCustomId
Sets a custom id for the form which will be returned to the bot once the form has been submitted and makes you able to recognize the form. The function returns the same FormBuilder class so you don't have to declare it everytime again.
setTitle
Sets a title for the form which is visible to member who should fill the form in. The function returns the same FormBuilder class so you don't have to declare it everytime again.
addComponents
Adds inputs to the form which can be filled in by a member of a server. The function returns the same FormBuilder class so you don't have to declare it everytime again.
addInputs
Identical to the addComponents function. Adds inputs to the form which can be filled in by a member of a server. The function returns the same FormBuilder class so you don't have to declare it everytime again.
toJSON
Converts the FormBuilder 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