Skip to content

Autocomplete value is determined based on the command option type #1175

Closed
@Jiralite

Description

@Jiralite

Issue description

The value of an autocomplete interaction is dynamic and may be a number. However, this is incorrect. The value of an autocomplete interaction is always a string.

Code sample

declare const interaction: APIApplicationCommandAutocompleteInteraction;

if (interaction.data.options[0]?.type === ApplicationCommandOptionType.String) {
	const { value } = interaction.data.options[0]; // String. Correct.
}

if (interaction.data.options[0]?.type === ApplicationCommandOptionType.Integer) {
	const { value } = interaction.data.options[0]; // Number. Incorrect.
}

if (interaction.data.options[0]?.type === ApplicationCommandOptionType.Number) {
	const { value } = interaction.data.options[0]; // Number. Incorrect.
}

Package version

main

Runtime

Node.js

Runtime version

N/A

Priority this issue should have

Medium (should be fixed soon)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions