Skip to content

Commit 22b0853

Browse files
committed
fix: use YoutubePlugin instance to search for results
1 parent 16900e0 commit 22b0853

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

commands/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = {
3737
await interaction.deferReply({ ephemeral: true }).catch((error) => { });
3838
try {
3939
// Search for results using query and type
40-
const results = await client.distube.search(query, { limit: config.DISTUBE_SEARCH_MAX_RESULTS, type: type });
40+
const results = await client.youtubePlugin.search(query, { limit: config.DISTUBE_SEARCH_MAX_RESULTS, type: type });
4141
// Update response
4242
await module.exports.updateResponse(interaction, lang, results, results[0]);
4343
const response = await interaction.fetchReply();

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ require("./utils/functions")(client);
1616
client.dashboards = {};
1717
client.cooldowns = {};
1818

19+
// Create YoutubePlugin instance
20+
client.youtubePlugin = new YouTubePlugin({
21+
cookies: JSON.parse(fs.readFileSync("./admin/ytCookies.json"))
22+
});
23+
1924
// Create DisTube instance
2025
client.distube = new DisTube(client, {
21-
plugins: [new YouTubePlugin({ cookies: JSON.parse(fs.readFileSync("./admin/ytCookies.json")) })],
26+
plugins: [client.youtubePlugin],
2227
nsfw: config.DISTUBE_NSFW,
2328
savePreviousSongs: config.DISTUBE_SAVE_PREVIOUS_SONGS,
2429
customFilters: config.DISTUBE_CUSTOM_FILTERS

0 commit comments

Comments
 (0)