discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

[Android] Autocomplete with type integer uses name property in validation

Open miksuh-dev opened this issue 1 year ago • 0 comments

Description

After some recent Android update, there seems to be a bug with autocomplete client-side validation.

When using autocomplete option with type 4 (integer) validation seems to be done against the name property instead of the value property.

These as autocomplete choices are fine:

choices [
  { name: '7', value: 7 },
  { name: '3', value: 3 },
]

But these are not:

choices [
  { name: 'Option 7', value: 7 },
  { name: 'Option 3', value: 3 },
]

This issue only happens when using mobile. Desktop is fine.

Steps to Reproduce

  1. Create a slash command with autocomplete option (type must be an integer). For example:
{
  name: 'test',
  description: 'this is a test command',
  type: 1,
  options: [
    {
      name: 'option 1',
      description: 'this is option 1',
      type: 4,
      required: true,
      autocomplete: true
    },
  ]
}
  1. Return the user following choices:
{
  type: 8
  data: {
    choices: [
      { name: 'Option 7', value: 7 },
      { name: 'Option 3', value: 3 },
    ],
  },
}
  1. Pick one of the suggested choices as a user.

Expected Behavior

The choice is selected correctly and the user can send a new message with the correct choice.

Current Behavior

After selecting a choice, autocomplete's option turns red. When trying to send the message 'Input a valid integer' error is shown.

Screenshots/Videos

No response

Client and System Information

Discord version: 142.14 Device: SM-G973F OS 31 (Android)

miksuh-dev avatar Sep 05 '22 14:09 miksuh-dev