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
Command Option Autocomplete Functionality #48
Conversation
|
||
@Override | ||
public boolean applyDetermination(ScriptPath path, ObjectTag determination) { | ||
if (!determination.canBeType(ListTag.class)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a stable check - anything can be a ListTag.
The determination should probably just be prefixed (it's intended in the future for determinations with prefixes to have native handling, so those are preferable anyway)
// <context.focused_option> returns the name of the focused option. | ||
// | ||
// @Determine | ||
// ListTag to suggest values to the Discord client. Each entry can be an ElementTag which controls both the value and display of the choice or a MapTag with "name" and "value" keys to control both separately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should document the 25 max here
src/main/java/com/denizenscript/ddiscordbot/events/DiscordCommandAutocompleteScriptEvent.java
Show resolved
Hide resolved
List<Command.Choice> choices = new ArrayList<>(); | ||
for (ObjectTag objectTag : list.objectForms) { | ||
Command.Choice choice; | ||
if (MapTag.matches(objectTag.toString())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use canBeType or shouldBeType
Additions
discord command autocomplete
discordcommand
command options now have an optionalautocomplete
key for whether they can be autocompletedNotes
discord command autocomplete
anddiscord application command
events shared the majority of their context and switches. They have been abstracted intoDiscordCommandInteractionScriptEvent
.