Change default extractor #97
1 changed files with 9 additions and 3 deletions
|
@ -10,7 +10,7 @@ import {
|
|||
import { Metadata } from "../../utils/metadata";
|
||||
import { getLocale, getLocalizations } from "../../utils/locales";
|
||||
import { getFilename } from "../../utils/misc";
|
||||
import { Player, SearchResult, useMasterPlayer, useQueue } from "discord-player";
|
||||
import { Player, QueryType, SearchResult, useMasterPlayer, useQueue } from "discord-player";
|
||||
|
||||
export default {
|
||||
scope: () => [],
|
||||
|
@ -118,6 +118,7 @@ export default {
|
|||
const result = await player
|
||||
.search(query, {
|
||||
requestedBy: interaction.user,
|
||||
searchEngine: QueryType.YOUTUBE_SEARCH,
|
||||
})
|
||||
.then((x) => x);
|
||||
|
||||
|
@ -170,9 +171,14 @@ export default {
|
|||
}, 2900);
|
||||
});
|
||||
|
||||
/* Create a race between a timeout and the research
|
||||
/* Create a race between a timeout and the search
|
||||
* At the end, Discord will always receive a response */
|
||||
const tracks = await Promise.race([delay, player.search(query)])
|
||||
const tracks = await Promise.race([
|
||||
delay,
|
||||
player.search(query, {
|
||||
requestedBy: interaction.user,
|
||||
}),
|
||||
])
|
||||
.then((res) => {
|
||||
clearTimeout(timeoutId);
|
||||
return (res as SearchResult).tracks;
|
||||
|
|
Loading…
Reference in a new issue