Update play.js
This commit is contained in:
parent
fc19af32a5
commit
0641ccfb0d
|
@ -116,14 +116,10 @@ module.exports = {
|
||||||
playNextInQueue(message.guild.id);
|
playNextInQueue(message.guild.id);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
loadingMessage = await message.channel.send(`**Loading**...`);
|
|
||||||
|
|
||||||
tempFilePath = path.join(__dirname, '../utils/tmp', `${uuidv4()}.mp3`);
|
|
||||||
|
|
||||||
console.log(`YouTube link received: ${searchQuery}`);
|
console.log(`YouTube link received: ${searchQuery}`);
|
||||||
videoUrl = searchQuery;
|
videoUrl = searchQuery;
|
||||||
|
|
||||||
exec(`yt-dlp --cookies ${path.join(__dirname, '../cookies.txt')} --print title ${searchQuery}`, (error, stdout, stderr) => {
|
exec(`yt-dlp --cookies ${path.join(__dirname, '../cookies.txt')} --print title ${searchQuery}`, async (error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(`Error getting title: ${error}`);
|
console.error(`Error getting title: ${error}`);
|
||||||
message.reply('Failed to retrieve video title.');
|
message.reply('Failed to retrieve video title.');
|
||||||
|
@ -133,6 +129,10 @@ module.exports = {
|
||||||
title = stdout.trim() || "Unknown Title";
|
title = stdout.trim() || "Unknown Title";
|
||||||
console.log(`Retrieved title: ${title}`);
|
console.log(`Retrieved title: ${title}`);
|
||||||
|
|
||||||
|
loadingMessage = await message.channel.send(`**Loading**... ${title}`);
|
||||||
|
|
||||||
|
tempFilePath = path.join(__dirname, '../utils/tmp', `${uuidv4()}.mp3`);
|
||||||
|
|
||||||
exec(`yt-dlp --cookies ${path.join(__dirname, '../cookies.txt')} --format bestaudio --output "${tempFilePath}" ${searchQuery}`, async (error, stdout, stderr) => {
|
exec(`yt-dlp --cookies ${path.join(__dirname, '../cookies.txt')} --format bestaudio --output "${tempFilePath}" ${searchQuery}`, async (error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(`Error downloading file: ${error}`);
|
console.error(`Error downloading file: ${error}`);
|
||||||
|
@ -223,4 +223,4 @@ function isValidURL(string) {
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue