This commit is contained in:
Elysia
2024-01-09 20:15:49 +07:00
parent 26c71d7777
commit 02fcfb881f
21 changed files with 52 additions and 529 deletions

View File

@@ -82,76 +82,6 @@ class TextInputComponent extends BaseMessageComponent {
this.value = data.value ?? null;
}
/**
* Sets the custom id of this text input component
* @param {string} customId A unique string to be sent in the interaction when submitted
* @returns {TextInputComponent}
*/
setCustomId(customId) {
this.customId = Util.verifyString(customId, RangeError, 'TEXT_INPUT_CUSTOM_ID');
return this;
}
/**
* Sets the label of this text input component
* @param {string} label The text to be displayed above this text input component
* @returns {TextInputComponent}
*/
setLabel(label) {
this.label = Util.verifyString(label, RangeError, 'TEXT_INPUT_LABEL');
return this;
}
/**
* Sets the text input component to be required for modal submission
* @param {boolean} [required=true] Whether this text input component is required
* @returns {TextInputComponent}
*/
setRequired(required = true) {
this.required = required;
return this;
}
/**
* Sets the maximum length of text input required in this text input component
* @param {number} maxLength Maximum length of text to be required
* @returns {TextInputComponent}
*/
setMaxLength(maxLength) {
this.maxLength = maxLength;
return this;
}
/**
* Sets the minimum length of text input required in this text input component
* @param {number} minLength Minimum length of text to be required
* @returns {TextInputComponent}
*/
setMinLength(minLength) {
this.minLength = minLength;
return this;
}
/**
* Sets the placeholder of this text input component
* @param {string} placeholder Custom placeholder text to display when no text is entered
* @returns {TextInputComponent}
*/
setPlaceholder(placeholder) {
this.placeholder = Util.verifyString(placeholder, RangeError, 'TEXT_INPUT_PLACEHOLDER');
return this;
}
/**
* Sets the style of this text input component
* @param {TextInputStyleResolvable} style The style of this text input component
* @returns {TextInputComponent}
*/
setStyle(style) {
this.style = TextInputComponent.resolveStyle(style);
return this;
}
/**
* Sets the value of this text input component
* @param {string} value Value of this text input component