new play changes

This commit is contained in:
Stanislaw
2021-12-27 21:36:50 +01:00
parent cee3c07409
commit 60bf216d71
3 changed files with 6 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ module.exports = {
let aplay;
let queue;
async function link(msg) {
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");
@@ -19,9 +19,9 @@ module.exports = {
request = request.trim()
if (ytdl.validateURL(request)) {
msg.reply("Poprawny link");
link = './sound/' + msg.member.voice.channel.id + '.mp3'
await ytdl(request).pipe(fs.createWriteStream(link));
return link;
let linked = './sound/' + msg.member.voice.channel.id + '.mp4'
ytdl(request).pipe(fs.createWriteStream(linked));
return linked;
} else {
msg.reply("Kurwo wenecka daj prawdziwy link a nie jaja sobie robisz");
}
@@ -39,7 +39,8 @@ module.exports = {
})
}
aplay = createAudioPlayer();
let song = createAudioResource(link(msg));
link(msg);
let song = createAudioResource('./sound/' + msg.member.voice.channel.id + '.mp4');
aplay.play(song);
connection.subscribe(aplay);
aplay.on('error', error => {