This commit is contained in:
Daniel Odendahl Jr
2017-10-01 07:18:24 +00:00
parent 41631c7150
commit 92eb2224c7
3 changed files with 82 additions and 3 deletions
+9 -2
View File
@@ -17,6 +17,7 @@ module.exports = class SoundboardCommand extends Command {
usages: 1,
duration: 15
},
clientPermissions: ['ADD_REACTIONS', 'READ_MESSAGE_HISTORY'],
args: [
{
key: 'sound',
@@ -45,8 +46,14 @@ module.exports = class SoundboardCommand extends Command {
try {
const connection = await channel.join();
const dispatcher = connection.playFile(path.join(__dirname, '..', '..', 'assets', 'sounds', `${sound}.mp3`));
dispatcher.once('end', () => channel.leave());
dispatcher.once('error', () => channel.leave());
dispatcher.once('end', async () => {
channel.leave();
await msg.react('✅');
});
dispatcher.once('error', async () => {
channel.leave();
await msg.react('⚠');
});
return null;
} catch (err) {
channel.leave();