diff --git a/commands/defaultvolume.js b/commands/defaultvolume.js new file mode 100644 index 0000000..e7575f2 --- /dev/null +++ b/commands/defaultvolume.js @@ -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}\``) +} diff --git a/commands/play.js b/commands/play.js index 346b0f3..63313a8 100644 --- a/commands/play.js +++ b/commands/play.js @@ -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(' ')) } diff --git a/commands/pride.js b/commands/pride.js index 5178a90..e1e06ed 100644 --- a/commands/pride.js +++ b/commands/pride.js @@ -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.' } diff --git a/models/guild.js b/models/guild.js index 1712da2..9482faf 100644 --- a/models/guild.js +++ b/models/guild.js @@ -38,9 +38,11 @@ module.exports = model('Guild', new Schema({ } }, - autoplay: { - type: Boolean, - default: false + music: { + type: Object, + default: { + defaultVolume: 0.25 + } }, plugins: { diff --git a/utils/music.js b/utils/music.js index 3e474b0..bbb7589 100644 --- a/utils/music.js +++ b/utils/music.js @@ -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