mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor(CommandInteractionOptionResolver): remove getFull from getFocused() (#9789)
* refactor(CommandInteractionOptionResolver): remove getFull from getFocused() * docs: update return type Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -294,14 +294,13 @@ class CommandInteractionOptionResolver {
|
||||
|
||||
/**
|
||||
* Gets the focused option.
|
||||
* @param {boolean} [getFull=false] Whether to get the full option object
|
||||
* @returns {string|AutocompleteFocusedOption}
|
||||
* The value of the option, or the whole option if getFull is true
|
||||
* @returns {AutocompleteFocusedOption}
|
||||
* The whole object of the option that is focused
|
||||
*/
|
||||
getFocused(getFull = false) {
|
||||
getFocused() {
|
||||
const focusedOption = this._hoistedOptions.find(option => option.focused);
|
||||
if (!focusedOption) throw new DiscordjsTypeError(ErrorCodes.AutocompleteInteractionOptionNoFocusedOption);
|
||||
return getFull ? focusedOption : focusedOption.value;
|
||||
return focusedOption;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
3
packages/discord.js/typings/index.d.ts
vendored
3
packages/discord.js/typings/index.d.ts
vendored
@@ -1312,8 +1312,7 @@ export class CommandInteractionOptionResolver<Cached extends CacheType = CacheTy
|
||||
): NonNullable<CommandInteractionOption<Cached>['member' | 'role' | 'user']> | null;
|
||||
public getMessage(name: string, required: true): NonNullable<CommandInteractionOption<Cached>['message']>;
|
||||
public getMessage(name: string, required?: boolean): NonNullable<CommandInteractionOption<Cached>['message']> | null;
|
||||
public getFocused(getFull: true): AutocompleteFocusedOption;
|
||||
public getFocused(getFull?: boolean): string;
|
||||
public getFocused(): AutocompleteFocusedOption;
|
||||
}
|
||||
|
||||
export class ContextMenuCommandInteraction<Cached extends CacheType = CacheType> extends CommandInteraction<Cached> {
|
||||
|
||||
Reference in New Issue
Block a user