Update play.js

This commit is contained in:
Wizzard 2024-08-17 18:36:59 -04:00
parent fc19af32a5
commit 0641ccfb0d
1 changed files with 6 additions and 6 deletions

View File

@ -116,14 +116,10 @@ module.exports = {
playNextInQueue(message.guild.id);
return;
} else {
loadingMessage = await message.channel.send(`**Loading**...`);
tempFilePath = path.join(__dirname, '../utils/tmp', `${uuidv4()}.mp3`);
console.log(`YouTube link received: ${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) {
console.error(`Error getting title: ${error}`);
message.reply('Failed to retrieve video title.');
@ -133,6 +129,10 @@ module.exports = {
title = stdout.trim() || "Unknown 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) => {
if (error) {
console.error(`Error downloading file: ${error}`);