This commit is contained in:
Daniel Odendahl Jr
2017-06-17 03:26:31 +00:00
parent 5bb78126a9
commit fd4e35533a
129 changed files with 322 additions and 319 deletions
+8 -4
View File
@@ -38,16 +38,20 @@ module.exports = class SoundboardCommand extends Command {
if (!voiceChannel.permissionsFor(this.client.user).has(['CONNECT', 'SPEAK'])) {
return msg.say('Missing the `CONNECT` or `SPEAK` Permission for the Voice Channel.');
}
if (!voiceChannel.joinable) return msg.say('This Voice Channel is not joinable.');
if (this.client.voiceConnections.get(voiceChannel.guild.id)) return msg.say('I am already playing a sound.');
if (!voiceChannel.joinable) return msg.say('Your Voice Channel is not joinable.');
if (this.client.voiceConnections.has(voiceChannel.guild.id)) return msg.say('I am already playing a sound.');
const { sound } = args;
const connection = await voiceChannel.join();
msg.react('🔊');
await msg.react('🔊');
const dispatcher = connection.playFile(path.join(__dirname, '..', '..', 'assets', 'sounds', paths[sound]));
dispatcher.on('end', () => {
dispatcher.once('end', () => {
voiceChannel.leave();
msg.react('✅');
});
dispatcher.once('error', () => {
voiceChannel.leave();
msg.react('⚠');
});
return null;
}
};