Autocomplete in Text Fields

Basically the title. It would be like BotDash where it runs the custom block that has outputs. Not sure if it’s possible due to API limitations but if they could be server specific that would be amazing. For example I’m working on a giveaway bot, and that has a giveaway ID for each one. For commands like re-roll, rather than adding the choices manually (which works for now as giveaways aren’t that often), it would pull the list of possible giveaway IDs from the database. My bot specifically is single server, but ideally it would get only that server’s giveaways for a multi server bot. Ambitious goals, I know :smile:

So this is sort-of possible, but isn’t the simplest thing.

Discord supports something called “Autocomplete” slash command options, where, as the user types in an option, they ping your server and your server responds with a list of up to 25 options for any given input (however, because of the dynamic nature, the user can search through a dataset much larger than 25, they can just only ever see the first 25 results of a given query).

The problem is making this work intuitively with Inventor. One thing I’ve considered is just allowing an “Autocomplete” option type, and you just create another flow that has an Autocomplete trigger where you get basic details like the command name, server, user, and user query, and can do whatever you want (DB lookups, etc.) to grab the data.

This seems like the simplest and probably most powerful way to integrate it, and if that sounds good I’ll add it to the near term roadmap and get it added in soon.

If you want to see one of these styles of command, check out the /lookup command on the Inventor Discord. The bot running that command isn’t a Inventor bot (it’s custom coded to hook into Inventor’s backend) but it’ll at least give you the idea.

You do need to manually implement (at least prefix) searching, but with iterators in Inventor that shouldn’t be too difficult - we’ll just need a “Slash Command Autocomplete Builder” block and an “Add Option to SC Builder” block.

More details on the API: Discord Developer Portal

1 Like

Yes, this sounds exactly like what I would want! I think that a system like the Botdash one would work, although maybe instead of showing up in the flows page (which would clutter if up with enough of them) it could be just a button to “Open SC Builder” and that would take you to the flow. That would be amazing if you can add that to the roadmap. Thank you!

It’ll probably still show up in the flow list, but something I’ve been considering is also adding a button to “jump to” button/modal response flows from the button/modal block then maybe a corresponding option to show/hide those sorts of “secondary” flows.

This would probably similarly be linked by like an ID or something (and/or command name/field) but I would like it to, like button, support some kind of ‘prefix/wildcard’ mode so you can pack multiple things into a single autocomplete responder. I could see this being useful for when you want to search the same table, maybe just with a slightly different column or lookup.

(Also, I’ve removed your resolved marker so I can keep this in my todos.)

1 Like

Do you know when this might be added? I’ve been wanting it for several different features now. Thanks!

Sorry about the delay here, this was most of the way ready and just needed finishing touches for UI and some final testing. It’s now available!

Announcement from Discord:

Slash Command Autocomplete Options are now available!

  • You can now use the “Autocomplete” option type for slash command options
  • Create a flow with the new Slash Command Autocomplete trigger
    • Select the “parent” slash command flow
    • The trigger outputs the name of the field the user is currently typing into, and the value they are typing
    • You can use the new Autocomplete Response Builder , Add Option to Autocomplete Response Builder , and Autocomplete Response Interaction blocks to build and send 25 options as a response to the flow. Those blocks work just how you’d expect based on behavior with buttons and dropdowns.
1 Like