Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Jiralite opened this issue Dec 19, 2024 · 0 comments · May be fixed by #1198
Open

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

Jiralite opened this issue Dec 19, 2024 · 0 comments · May be fixed by #1198
Assignees
Labels

Comments

@Jiralite
Copy link
Member

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant