more music stuff

This commit is contained in:
Emily 2020-04-24 17:50:54 +10:00
parent 78aab0f9f6
commit 1f73cf351f
5 changed files with 46 additions and 8 deletions

36
commands/defaultvolume.js Normal file
View File

@ -0,0 +1,36 @@
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
exports.conf = {
enabled: true,
guildOnly: true,
aliases: [],
permLevel: 'Administrator',
requiredPerms: [],
cooldown: 5000 // miliseconds
}
exports.help = {
name: 'defaultvolume',
category: 'Music',
description: 'Change the default volume Woomy plays music at.',
usage: 'volume [volume]',
params: '[volume] - what you want to set the default volume to'
}
exports.run = async (client, message, args, level, data) => {
const prefix = args.join(' ')
if (!prefix) {
return message.channel.send(`Current server prefix: \`${data.guild.prefix}\``)
}
if (prefix.toLowerCase() === 'reset') {
await client.updateGuild(message.guild, { prefix: client.config.defaultPrefix })
return message.channel.send('Server prefix has been reset.')
}
await client.updateGuild(message.guild, { prefix: prefix })
message.channel.send(`The server prefix has been updated: \`${prefix}\``)
}

View File

@ -19,5 +19,5 @@ exports.help = {
const { play } = require('../utils/music')
exports.run = async (client, message, args, level, data) => {
await play(client, message, args.join(' '))
await play(client, data.guild.music, message, args.join(' '))
}

View File

@ -12,7 +12,7 @@ exports.conf = {
exports.help = {
name: 'pride',
category: 'Fun',
description: 'Adds a pride flag ring to your avatar. Available flags are lesbian, gay, bisexual, pansexual, trans, asexual, aromantic and ally. Generator created by [Demirramon.](https://demirramon.com/)',
description: 'Adds a pride flag ring to your avatar. Available flags are lesbian, gay, bisexual, pansexual, trans, asexual, aromantic and ally.',
usage: '`pride [flag]` - Adds a pride flag overlay to your avatar.\n`pride -g [flag]` - Adds a pride flag gradient on your avatar.',
parameters: '`flag` - What flag you want to add to your avatar (options listed above)\n`-g` - Add this to the start of the command to turn the flag into a gradient.'
}

View File

@ -38,9 +38,11 @@ module.exports = model('Guild', new Schema({
}
},
autoplay: {
type: Boolean,
default: false
music: {
type: Object,
default: {
defaultVolume: 0.25
}
},
plugins: {

View File

@ -64,7 +64,7 @@ exports.getVideoByQuery = async function (client, query) {
}
}
exports.play = async function (client, message, query, ignoreQueue) {
exports.play = async function (client, data, message, query, ignoreQueue) {
const guild = exports.getGuild(message.guild.id)
guild.message = message
@ -178,7 +178,7 @@ exports.play = async function (client, message, query, ignoreQueue) {
const v = guild.queue[0]
guild.dispatcher = connection.play(await ytdl(exports.getLinkFromID(v.video.videoId), { highWaterMark: 1024 * 1024 * 32 }), { type: 'opus' })
guild.dispatcher.setVolume(0.25)
guild.dispatcher.setVolume(data.defaultVolume)
message.channel.send('Playing **' + v.video.title + '**')
@ -188,7 +188,7 @@ exports.play = async function (client, message, query, ignoreQueue) {
guild.playing = false
if (guild.queue.length > 0) {
exports.play(client, message, null, true)
exports.play(client, data, message, null, true)
} else {
guild.queue = []
guild.playing = false