Soundboard is good again

This commit is contained in:
Daniel Odendahl Jr
2017-12-04 23:14:51 +00:00
parent 93df647437
commit 1735e1225f
18 changed files with 26 additions and 12 deletions
+20 -6
View File
@@ -1,8 +1,22 @@
[
"airhorn",
"cat",
"dun-dun-dun",
"laugh track",
"pikachu",
"space"
"airhorn": "airhorn.mp3",
"ayaya": "ayaya.mp3",
"cat": "cat.mp3",
"doh": "doh.mp3",
"dun-dun-dun": "dun-dun-dun.mp3",
"eat my shorts": "eat-my-shorts.mp3",
"glados bird": "glados-bird.mp3",
"it's a trap": "its-a-trap.mp3",
"laugh track": "laugh-track.mp3",
"mario death": "mario-death.mp3",
"no this is patrick": "no-this-is-patrick.mp3",
"pikachu": "pikachu.mp3",
"pokemon center": "pokemon-center.mp3",
"space": "space.mp3",
"spongebob laugh": "spongebob-laugh.mp3",
"ugly barnacle": "ugly-barnacle.mp3",
"vader": "vader.mp3",
"woohoo": "woohoo.mp3",
"wumbo": "wumbo.mp3",
"zelda chest": "zelda-chest.mp3"
]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+5 -5
View File
@@ -20,12 +20,12 @@ module.exports = class SoundboardCommand extends Command {
args: [
{
key: 'sound',
prompt: `What sound would you like to play? Either ${list(sounds, 'or')}.`,
prompt: `What sound would you like to play? Either ${list(Object.keys(sounds), 'or')}.`,
type: 'string',
default: () => sounds[Math.floor(Math.random() * sounds.length)],
default: () => Object.keys(sounds)[Math.floor(Math.random() * sounds.length)],
validate: sound => {
if (sounds.includes(sound.toLowerCase())) return true;
return `Invalid sound, please enter either ${list(sounds, 'or')}.`;
if (sounds[sound.toLowerCase()]) return true;
return `Invalid sound, please enter either ${list(Object.keys(sounds), 'or')}.`;
},
parse: sound => sound.toLowerCase()
}
@@ -43,7 +43,7 @@ module.exports = class SoundboardCommand extends Command {
if (this.client.voiceConnections.has(channel.guild.id)) return msg.reply('I am already playing a sound.');
try {
const connection = await channel.join();
const dispatcher = connection.playFile(path.join(__dirname, '..', '..', 'assets', 'sounds', `${sound}.mp3`));
const dispatcher = connection.playFile(path.join(__dirname, '..', '..', 'assets', 'sounds', sounds[sound]));
dispatcher.once('end', () => channel.leave());
dispatcher.once('error', () => channel.leave());
return null;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "56.0.0",
"version": "56.0.1",
"description": "Your personal server companion.",
"main": "XiaoBot.js",
"scripts": {