Incendo / cloud-discord

Discord integrations for Cloud v2.
https://cloud.incendo.org/discord/
MIT License
5 stars 1 forks source link

Fixes to the auto complete problem #48

Closed BlueTree242 closed 3 months ago

BlueTree242 commented 6 months ago

This pull request solves auto completion issues. Here are the exact changes:

  1. Added a check whether the suggestion provider of an argument is the same one as SuggestionProvider#noSuggestions().
  2. Before dealing with the SuggestionProvider during registration it would first run the suggestion registration mapper, which will allow you to map providers to discord choices or SuggestionProvider#noSuggestions() (disable auto complete) by setting it on the command factory.

The suggestion registration mapper is very useful when mapping providers that return constant values, or provide suggestions that would be barely helpful and you would like to disable it completely.

The suggestion registration mapper might not be the best idea, If you aren't fine with it or have better ways to solve the same problem, Let me know!

resolves #47

github-actions[bot] commented 3 months ago

Test Results

0 tests   - 9   0 :white_check_mark:  - 9   0s :stopwatch: ±0s 0 suites  - 3   0 :zzz: ±0  0 files    - 3   0 :x: ±0 

Results for commit 0731d6f0. ± Comparison against base commit e4585483.