mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix: use in operator when resolving modal component (#11115)
This commit is contained in:
@@ -104,11 +104,10 @@ class ModalComponentResolver {
|
|||||||
* Gets the value of a text input component
|
* Gets the value of a text input component
|
||||||
*
|
*
|
||||||
* @param {string} customId The custom id of the text input component
|
* @param {string} customId The custom id of the text input component
|
||||||
* @param {?boolean} required Whether to throw an error if the component value is not found or empty
|
|
||||||
* @returns {?string}
|
* @returns {?string}
|
||||||
*/
|
*/
|
||||||
getTextInputValue(customId, required = false) {
|
getTextInputValue(customId) {
|
||||||
return this._getTypedComponent(customId, [ComponentType.TextInput], ['value'], required).value ?? null;
|
return this._getTypedComponent(customId, [ComponentType.TextInput]).value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -148,9 +148,9 @@ class ModalSubmitInteraction extends BaseInteraction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Text display components do not have custom ids.
|
// Text display components do not have custom ids.
|
||||||
if (rawComponent.custom_id) data.customId = rawComponent.custom_id;
|
if ('custom_id' in rawComponent) data.customId = rawComponent.custom_id;
|
||||||
|
|
||||||
if (rawComponent.value) data.value = rawComponent.value;
|
if ('value' in rawComponent) data.value = rawComponent.value;
|
||||||
|
|
||||||
if (rawComponent.values) {
|
if (rawComponent.values) {
|
||||||
data.values = rawComponent.values;
|
data.values = rawComponent.values;
|
||||||
|
|||||||
3
packages/discord.js/typings/index.d.ts
vendored
3
packages/discord.js/typings/index.d.ts
vendored
@@ -2609,8 +2609,7 @@ export class ModalComponentResolver<Cached extends CacheType = CacheType> {
|
|||||||
properties: string,
|
properties: string,
|
||||||
required: boolean,
|
required: boolean,
|
||||||
): ModalData;
|
): ModalData;
|
||||||
public getTextInputValue(customId: string, required: true): string;
|
public getTextInputValue(customId: string): string;
|
||||||
public getTextInputValue(customId: string, required?: boolean): string | null;
|
|
||||||
public getStringSelectValues(customId: string): readonly string[];
|
public getStringSelectValues(customId: string): readonly string[];
|
||||||
public getSelectedUsers(customId: string, required: true): ReadonlyCollection<Snowflake, User>;
|
public getSelectedUsers(customId: string, required: true): ReadonlyCollection<Snowflake, User>;
|
||||||
public getSelectedUsers(customId: string, required?: boolean): ReadonlyCollection<Snowflake, User> | null;
|
public getSelectedUsers(customId: string, required?: boolean): ReadonlyCollection<Snowflake, User> | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user