woomy/commands/volume.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-04-20 04:52:50 +00:00
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
2020-04-20 03:02:10 +00:00
2020-04-11 14:45:47 +00:00
exports.conf = {
enabled: true,
guildOnly: true,
2020-04-13 04:28:53 +00:00
aliases: ['vol'],
2020-04-29 11:21:34 +00:00
permLevel: 'User',
2020-04-13 04:28:53 +00:00
requiredPerms: [],
2020-04-11 14:45:47 +00:00
cooldown: 2000
}
exports.help = {
name: 'volume',
category: 'Music',
description: 'Sets volume of currently playing music. (100% = 25% of the actual volume)',
usage: 'volume [volume]',
parameters: '[volume] - Target volume from 0-100%'
2020-04-11 14:45:47 +00:00
}
2020-04-19 10:10:52 +00:00
const { setVolume } = require('../utils/music')
2020-04-11 14:45:47 +00:00
exports.run = async (client, message, args, level, data) => {
2020-04-29 11:21:34 +00:00
let userVolume
if (args[0].includes('%')) {
userVolume.replace('%', '')
}
userVolume = +userVolume
if (isNaN(userVolume) === true) {
return message.channel.send('<:error:466995152976871434> Input must be a number!')
}
2020-04-11 14:45:47 +00:00
2020-04-24 19:06:17 +00:00
if (userVolume) {
userVolume = Number(userVolume)
2020-04-11 14:45:47 +00:00
2020-04-24 19:06:17 +00:00
userVolume = userVolume / 100 * 0.25
2020-04-11 14:45:47 +00:00
2020-04-24 19:06:17 +00:00
if (userVolume <= 1) {
setVolume(message.guild, userVolume)
2020-04-11 14:45:47 +00:00
2020-04-24 19:06:17 +00:00
message.reply('<:success:466995111885144095> Set volume to ' + userVolume * 100 + '%')
2020-04-13 04:28:53 +00:00
}
}
}