Skip to content

fix(discord): sanitize autocomplete choices#830

Open
ugcodrr wants to merge 2 commits into
mainfrom
fix-autocomplete-choice-names
Open

fix(discord): sanitize autocomplete choices#830
ugcodrr wants to merge 2 commits into
mainfrom
fix-autocomplete-choice-names

Conversation

@ugcodrr
Copy link
Copy Markdown
Member

@ugcodrr ugcodrr commented Apr 12, 2026

Fixes the Sentry error where Discord rejects autocomplete responses with Invalid Form Body | data.choices[n].name - BASE_TYPE_BAD_LENGTH.

This sanitizes autocomplete choices at the shared Discord response boundary before replying:

  • Drops empty or whitespace-only choice names.
  • Drops empty/whitespace-only string values and overlong string values.
  • Trims displayed choice names and caps them to Discord's 100-character limit.
  • Caps autocomplete responses to Discord's 25-choice limit.

This covers the observed status command/player search case where a raw whitespace query could be appended as an autocomplete choice.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
statsify Ready Ready Preview, Comment May 30, 2026 3:35am

* Ensure choices with undefined or null values are excluded
* Trim choice names and handle empty strings more effectively
* Maintain maximum length constraints for choice values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant