Я не умею гитхабом пользоваться

This commit is contained in:
JonnyBro 2022-09-10 23:53:40 +05:00
parent 6097de097d
commit b248684fc3

View file

@ -44,34 +44,13 @@ class Play extends BaseCommand {
if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.editReply({ content: interaction.translate("music/play:VOICE_CHANNEL_CONNECT") }); if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.editReply({ content: interaction.translate("music/play:VOICE_CHANNEL_CONNECT") });
try { try {
var searchResult; var searchResult = await client.player.search(query, {
if (!query.includes("http")) { requestedBy: interaction.user,
const search = await playdl.search(query, { limit: 10 }); searchEngine: QueryType.AUTO
});
if (search) { if (!searchResult.tracks[0] || !searchResult)
const found = search.map(track => new Track(client.player, { return interaction.editReply({ content: interaction.translate("music/play:NO_RESULT", { query, error: "Unknown Error" }) });
title: track.title,
duration: Util.buildTimeCode(Util.parseMS(track.durationInSec * 1000)),
thumbnail: track.thumbnails[0].url || "https://cdn.discordapp.com/attachments/708642702602010684/1012418217660121089/noimage.png",
views: track.views,
author: track.channel.name,
description: "search",
url: track.url,
requestedBy: interaction.user,
playlist: null,
source: "youtube"
}));
searchResult = { playlist: null, tracks: found, searched: true };
}
} else {
searchResult = await client.player.search(query, {
requestedBy: interaction.user
});
if (!searchResult.tracks[0] || !searchResult)
return interaction.editReply({ content: interaction.translate("music/play:NO_RESULT", { query, error: "Unknown Error" }) });
}
} catch (error) { } catch (error) {
console.log(error); console.log(error);
return interaction.editReply({ return interaction.editReply({
@ -87,7 +66,7 @@ class Play extends BaseCommand {
autoSelfDeaf: true, autoSelfDeaf: true,
leaveOnEnd: true, leaveOnEnd: true,
leaveOnStop: true, leaveOnStop: true,
bufferingTimeout: 1000, bufferingTimeout: 1000
}); });
if (searchResult.searched) { if (searchResult.searched) {