music stuff

This commit is contained in:
Emily 2020-04-21 19:14:49 +10:00
parent 3a8e2a8840
commit 5d2e02221b
6 changed files with 111 additions and 5 deletions

View File

@ -5,7 +5,7 @@ exports.conf = {
guildOnly: true,
aliases: ['np'],
permLevel: 'User',
requiredPerms: [],
requiredPerms: ['EMBED_LINKS'],
cooldown: 2000
}

View File

@ -5,8 +5,8 @@ exports.conf = {
guildOnly: true,
aliases: [],
permLevel: 'User',
requiredPerms: [],
cooldown: 2000
requiredPerms: ['CONNECT', 'SPEAK'],
cooldown: 5000
}
exports.help = {

51
commands/removesong.js Normal file
View File

@ -0,0 +1,51 @@
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
exports.conf = {
enabled: true,
guildOnly: true,
aliases: [],
permLevel: 'User',
requiredPerms: [],
cooldown: 2000
}
exports.help = {
name: 'removesong',
category: 'Music',
description: 'Removes a song from the queue.',
usage: 'removesong [position]',
parameters: '[position] - The position of the song you want to remove'
}
const { getGuild } = require('../utils/music')
module.exports.run = (client, message, args, level) => {
var queue = getGuild(message.guild.id).queue
if (queue.length < 2) {
return message.channel.send('<:error:466995152976871434> Not enough songs are in the queue for this command to work!')
}
if (!args[0]) {
return message.channel.send(`<:error:466995152976871434> You didn't tell me what song to remove! Usage: \`${client.commands.get('removesong').help.usage}\``)
}
var input = +args[0]
if (isNaN(input) === true) {
return message.channel.send('That isn\'t a number! You need to tell me the songs position in the queue (1, 2, etc.)')
}
if (input >= queue.length) {
return message.channel.send('Invalid (too large)')
}
if (input < 1) {
return message.channel.send('Invalid (too small)')
}
var songName = queue[input].video.title
queue.splice(input, 1)
message.channel.send(`Removed from queue: **${songName}**`)
}

20
commands/shuffle.js Normal file
View File

@ -0,0 +1,20 @@
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
exports.conf = {
enabled: true,
guildOnly: true,
aliases: [],
permLevel: 'User',
requiredPerms: [],
cooldown: 2000
}
exports.help = {
name: 'removesong',
category: 'Music',
description: 'Removes a song from the queue.',
usage: 'removesong [position]',
parameters: '[position] - The position of the song you want to remove'
}
const { getGuild } = require('../utils/music')

34
commands/stop.js Normal file
View File

@ -0,0 +1,34 @@
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
exports.conf = {
enabled: true,
guildOnly: true,
aliases: [],
permLevel: 'User',
requiredPerms: [],
cooldown: 2000
}
exports.help = {
name: 'stop',
category: 'Music',
description: 'Stops music, clears the queue and disconnects from the voice channel.',
usage: 'stop',
params: ''
}
const { getGuild } = require('../utils/music')
exports.run = async (client, message) => {
const guild = getGuild(message.guild.id)
if (guild.queue.length < 1 || !guild.playing || !guild.dispatcher) return message.channel.send('Nothing is playing.')
if (!message.member.voice.channel) return message.channel.send('You need to be in voice channel to use this command!')
guild.playing = false
guild.paused = false
guild.queue = []
guild.dispatcher.end('silent')
message.channel.send('Playback stopped!')
}

View File

@ -67,7 +67,7 @@ exports.getVideoByQuery = async function (client, query) {
exports.play = async function (client, message, query, ignoreQueue) {
const guild = exports.getGuild(message.guild.id)
if (!message.member.voice.channel && !guild.voice.channel) {
if (!message.member.voice.channel && !guild.voiceChannel) {
return message.reply('You have to be connected to a voice channel to use this command!')
}
@ -168,7 +168,8 @@ exports.play = async function (client, message, query, ignoreQueue) {
} else {
guild.playing = true
guild.voice.channel = vc
guild.voiceChannel = vc
console.log(vc)
const connection = await vc.join()