mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 22:15:29 +00:00
fix: Fix deconstruction error if no lastQuery result in autocomplete
This commit is contained in:
1 parent
74c1447e7d
commit
851e9321f5
1 file changed
+1
-1
@@ -17,7 +17,7 @@ class LyricsAutocomplete extends BaseAutocompleteInteraction {
|
|||||||
const logger = this.getLogger(this.name, executionId, interaction);
|
const logger = this.getLogger(this.name, executionId, interaction);
|
||||||
|
|
||||||
const query: string = interaction.options.getString('query', true);
|
const query: string = interaction.options.getString('query', true);
|
||||||
const { lastQuery, result, timestamp } = recentQueries.get(interaction.user.id);
|
const { lastQuery, result, timestamp } = recentQueries.get(interaction.user.id) || {};
|
||||||
|
|
||||||
if (lastQuery && (query.startsWith(lastQuery) || lastQuery.startsWith(query)) && Date.now() - timestamp < 500) {
|
if (lastQuery && (query.startsWith(lastQuery) || lastQuery.startsWith(query)) && Date.now() - timestamp < 500) {
|
||||||
logger.debug(`Responding with results from lastQuery for query '${query}'`);
|
logger.debug(`Responding with results from lastQuery for query '${query}'`);
|
||||||
|
|||||||
Reference in new issue
Block a user