Removed the helptest command, commented a lot of voice.js and fixed the music downloading into subfolders
This commit is contained in:
parent
6b4603f1f7
commit
4bec944e11
@ -1,20 +0,0 @@
|
||||
const {client} = require("../index")
|
||||
const { GuildMember, GuildChannel } = require("discord.js")
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
name: "helptest",
|
||||
description: "Kill every1",
|
||||
arguments: [GuildMember, GuildChannel],
|
||||
run: (ctx, member, channel) => {
|
||||
if (!member || !(member instanceof GuildMember) ) {
|
||||
return ctx.reply("Member invalid.")
|
||||
}
|
||||
if (!channel || !(channel instanceof GuildChannel) ) {
|
||||
return ctx.reply("Channel invalid.")
|
||||
}
|
||||
|
||||
ctx.reply(`Member: ${member}\nChannel: ${channel}`)
|
||||
}
|
||||
},
|
||||
]
|
@ -25,7 +25,7 @@ module.exports = [
|
||||
channel = member.voice.channel
|
||||
}
|
||||
|
||||
// Returns
|
||||
// Returns if the user is not in vc or the bot is already in one
|
||||
if (!channel) {
|
||||
return ctx.reply("You are not in a VC right now.")
|
||||
} else if (ctx.guild.members.me.voice.channel && ctx.guild.members.me.voice.channel.id != channel.id) {
|
||||
@ -47,32 +47,40 @@ module.exports = [
|
||||
connection = getVoiceConnection(ctx.guild.id)
|
||||
}
|
||||
|
||||
// Running yt-dlp (getting music title)
|
||||
const metadata = await ytDlp.getVideoInfo(link);
|
||||
|
||||
ctx.reply(`Playing ${metadata.title}`)
|
||||
|
||||
// Running yt-dlp (downloading music)
|
||||
const music = ytDlp.exec([
|
||||
// Arguments to run yt-dlp with
|
||||
link,
|
||||
'-f',
|
||||
'best',
|
||||
'-o',
|
||||
`${dir}/music/${metadata.title}.mp3`,
|
||||
`${dir}/music/'${metadata.title}.mp3'`,
|
||||
'--extract-audio',
|
||||
'--audio-format',
|
||||
'mp3'
|
||||
]).on('close', () => {
|
||||
// Stopping old audioplayer
|
||||
if (players[ctx.guild.id]) {
|
||||
players[ctx.guild.id].stop()
|
||||
}
|
||||
|
||||
// Connecting audio player
|
||||
const player = createAudioPlayer()
|
||||
|
||||
players[ctx.guild.id] = player
|
||||
|
||||
const resource = createAudioResource(`${dir}/music/${metadata.title}.mp3`)
|
||||
// Loading music
|
||||
const resource = createAudioResource(`${dir}/music/'${metadata.title}.mp3'`)
|
||||
|
||||
// Playing the music with the player
|
||||
player.play(resource)
|
||||
|
||||
// Subscribing the connection to the player
|
||||
connection.subscribe(player)
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user