#how to increase debouncing delay for autocompletion results

1 messages · Page 1 of 1 (latest)

last robin
#

I have an autocompletion that relies on a rate limited API, and I'm finding that the default debouncing delay that discord has by default is still a tad bit faster than I'd like. Was wondering if there might be a way for me to increase the delay, or maybe rate limit the autocomplete callback function in some way

frail impBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

haughty summit
# last robin I have an autocompletion that relies on a rate limited API, and I'm finding that...

Unfortunately that's not possible. Discord forces you to respond within the time frame, 3 seconds I think?

You can technically (very loose use of the word) rate limit the autocomplete endpoint manually by just not responding, sending no results, or sending a single result which conveys a message, though I agree that's not very user friendly as the user can select this option and you'd have to handle that.

#

The above response also assumes you've done stuff like cache the responses from said rate limited API in order to try and reduce outbound requests to it.

last robin
#

Yeah, i read about the 3s response, which is not an issue to meet. It's just the frequency between de-bounced requests that's been suboptimal. This api i'm using has very stringent free use rate limits that i can trigger with just a single user typing a bit slowly 😅.

Also i can't really go with the option of sending blank responses, because I think discord's frontend (or backend?) does a bit of its own caching, and will reuse previous results on repeat queries.

But regardless, I'll probably throw on a quick in-memory cache anyways. This is just for a bot on a personal server so it doesn't need to function amazingly. Just wanted to see if such a thing were possible.

#

thanks for the ideas/suggestions though 🙏

vague oriole
#

id avoid sending blank responses, instead cache the api responses