Soundboard Random by Default

This commit is contained in:
Daniel Odendahl Jr
2017-08-25 13:22:36 +00:00
parent 84e2aa4c8f
commit d2008c749d
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -22,11 +22,12 @@ module.exports = class SoundboardCommand extends Command {
key: 'sound',
prompt: 'What sound would you like to play?',
type: 'string',
default: sounds[Math.floor(Math.random() * sounds.length)],
validate: sound => {
if (sounds.includes(sound.toLowerCase())) return true;
return 'Invalid Sound. Use `help soundboard` for a list of sounds.';
},
parse: sound => sound.toLowerCase()
parse: sound => path.join(__dirname, '..', '..', 'assets', 'sounds', `${sound.toLowerCase()}.mp3`)
}
]
});
@@ -43,7 +44,7 @@ module.exports = class SoundboardCommand extends Command {
if (this.client.voiceConnections.has(channel.guild.id)) return msg.say('I am already playing a sound.');
const connection = await channel.join();
await msg.react('🔊');
const dispatcher = connection.playFile(path.join(__dirname, '..', '..', 'assets', 'sounds', `${sound}.mp3`));
const dispatcher = connection.playFile(sound, { volume: 0.25 });
dispatcher.once('end', () => {
channel.leave();
msg.react('✅');
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "31.1.3",
"version": "31.1.4",
"description": "Your personal server companion.",
"main": "Shard.js",
"scripts": {