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

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") });
try {
var searchResult;
if (!query.includes("http")) {
const search = await playdl.search(query, { limit: 10 });
var searchResult = await client.player.search(query, {
requestedBy: interaction.user,
searchEngine: QueryType.AUTO
});
if (search) {
const found = search.map(track => new Track(client.player, {
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" }) });
}
if (!searchResult.tracks[0] || !searchResult)
return interaction.editReply({ content: interaction.translate("music/play:NO_RESULT", { query, error: "Unknown Error" }) });
} catch (error) {
console.log(error);
return interaction.editReply({
@ -87,7 +66,7 @@ class Play extends BaseCommand {
autoSelfDeaf: true,
leaveOnEnd: true,
leaveOnStop: true,
bufferingTimeout: 1000,
bufferingTimeout: 1000
});
if (searchResult.searched) {