diff --git a/sound/897580342851043388.mp3 b/sound/897580342851043388.mp3 new file mode 100644 index 0000000..1d5fd7b Binary files /dev/null and b/sound/897580342851043388.mp3 differ diff --git a/src/cmds/play.js b/src/cmds/play.js index efcf82a..b611eb4 100644 --- a/src/cmds/play.js +++ b/src/cmds/play.js @@ -5,12 +5,13 @@ module.exports = { const ytsr = require('ytsr'); const path = require('path'); const discord = require('discord.js'); + const fs = require('fs') const { joinVoiceChannel, createAudioPlayer, createAudioResource } = require('@discordjs/voice'); let connection; let aplay; let queue; - function link(msg) { + async function link(msg) { let request = msg.content.slice(path.basename(__filename).length + cl.cfg.prefix.length - 3); if (request.trim() == "") { msg.reply("Dej link albo tagi albo weź i spierdalaj"); @@ -18,13 +19,15 @@ module.exports = { request = request.trim() if (ytdl.validateURL(request)) { msg.reply("Poprawny link"); - return request; + link = './sound/' + msg.member.voice.channel.id + '.mp3' + await ytdl(request).pipe(fs.createWriteStream(link)); + return link; } else { msg.reply("Kurwo wenecka daj prawdziwy link a nie jaja sobie robisz"); } } else { msg.reply("Szukasz:" + request); - + } } if (!connection) { @@ -36,7 +39,7 @@ module.exports = { }) } aplay = createAudioPlayer(); - let song = createAudioResource('C:/Users/Stachu/Documents/GitHub/bot/src/sound/afro.mp3') + let song = createAudioResource(link(msg)); aplay.play(song); connection.subscribe(aplay); aplay.on('error', error => { diff --git a/src/sound/afro.mp3 b/src/sound/afro.mp3 deleted file mode 100644 index 6d58e77..0000000 Binary files a/src/sound/afro.mp3 and /dev/null differ diff --git a/src/sound/gospel.mp3 b/src/sound/gospel.mp3 deleted file mode 100644 index 8fba61b..0000000 Binary files a/src/sound/gospel.mp3 and /dev/null differ