mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 14:38:49 +00:00
fix: refactored autocomplete interactions
This commit is contained in:
1 parent
20bc4aa88f
commit
af78759813
4 files changed
+127
-73
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { Track } from 'discord-player';
|
||||
|
||||
export function shouldUseLastQuery(query: string, lastQuery?: string, timestamp?: number): boolean {
|
||||
return Boolean(
|
||||
lastQuery && (query.startsWith(lastQuery) || lastQuery.startsWith(query)) && Date.now() - (timestamp ?? 0) < 500
|
||||
);
|
||||
}
|
||||
|
||||
export function isQueryTooShort(query: string): boolean {
|
||||
return query.length < 3;
|
||||
}
|
||||
|
||||
export function getTrackName(track: Track): string {
|
||||
const name = `${track.title} [Author: ${track.author}]`;
|
||||
return name.length > 100 ? name.slice(0, 100) : name;
|
||||
}
|
||||
Reference in new issue
Block a user