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
|
||||
*
|
||||
* @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}
|
||||
*/
|
||||
getTextInputValue(customId, required = false) {
|
||||
return this._getTypedComponent(customId, [ComponentType.TextInput], ['value'], required).value ?? null;
|
||||
getTextInputValue(customId) {
|
||||
return this._getTypedComponent(customId, [ComponentType.TextInput]).value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -148,9 +148,9 @@ class ModalSubmitInteraction extends BaseInteraction {
|
||||
};
|
||||
|
||||
// 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) {
|
||||
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,
|
||||
required: boolean,
|
||||
): ModalData;
|
||||
public getTextInputValue(customId: string, required: true): string;
|
||||
public getTextInputValue(customId: string, required?: boolean): string | null;
|
||||
public getTextInputValue(customId: string): string;
|
||||
public getStringSelectValues(customId: string): readonly string[];
|
||||
public getSelectedUsers(customId: string, required: true): ReadonlyCollection<Snowflake, User>;
|
||||
public getSelectedUsers(customId: string, required?: boolean): ReadonlyCollection<Snowflake, User> | null;
|
||||
|
||||
Reference in New Issue
Block a user