discord / discord-api-docs

Official Discord API Documentation
https://discord.com/developers/docs/intro
Other
5.99k stars 1.26k forks source link

Discord autocomplete allows bypassing developer defined values when creating/switching channels #7206

Open SatisfyAi opened 1 month ago

SatisfyAi commented 1 month ago

Description

When using a slash command with an autocomplete option, if a user starts typing and selects an option, but then switches channels or creates a new channel before sending the command, the selected autocomplete value becomes invalid. Instead of sending the expected value to the bot, the command sends the name of the option instead of the value, causing the command to fail.

Steps to Reproduce

  1. Begin typing a slash command that includes autocomplete options.
  2. Select one of the provided autocomplete values.
  3. Switch to a different channel or create a new channel.
  4. Return to the original channel and attempt to send the command.

Expected Behavior

Although the selected autocomplete value appears to remain selected after switching channels or creating a new one, the command sends the name rather than its actual value, causing the command to break.

Current Behavior

The autocomplete value stays selected however instead of sending the value to the bot it sends the name of the option instead, which breaks the command.

Screenshots/Videos

The attached video shows what happens when:

  1. Channel is switched
  2. Command is ran normally
  3. Channel is created

https://github.com/user-attachments/assets/0d1a32e9-7063-4634-b63c-ee0e2c5b4741

Client and System Information

stable 334959 (b559238) Windows 10 64-bit (10.0.19045)

almostSouji commented 1 month ago

as far as i am aware, autocomplete is not meant to act like choices and specifically allows non-matches to be sent as-is i know some bots that use this as a "suggest common reasons, but allow custom reasons as well", for example

advaith1 commented 1 month ago

Autocomplete does allow custom inputs, but if the user selects an option provided by the bot, it should always submit the value instead of the name.

SatisfyAi commented 1 month ago

Yeah the issue is with the autocomplete options provided by the bot, as those fail during the channel switch.