yt link download
This commit is contained in:
BIN
sound/897580342851043388.mp3
Normal file
BIN
sound/897580342851043388.mp3
Normal file
Binary file not shown.
@@ -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 => {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user