Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Commit

Permalink
Removed the redudant check for the message
Browse files Browse the repository at this point in the history
  • Loading branch information
illusi0nary committed Oct 4, 2020
1 parent ea568ec commit 75752fb
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions commands/Sound/playsound.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,21 @@ module.exports = {
},

run: async (bot, message, args) => {
if (message.guild) {
let config = bot.commands.get('booh').config
if (message.member.voice.channel) {
let soundPath = __dirname + `/../../sounds/`
const connection = await message.member.voice.channel.join()
const sounds = Array.from(readdirSync(resolve(__dirname, `../../sounds/`)))
let playable = soundPath + sounds[Math.floor(Math.random() * sounds.length)]

if (message.content === prefix + config.command) {
if (message.member.voice.channel) {
let soundPath = __dirname + `/../../sounds/`
const connection = await message.member.voice.channel.join()
const sounds = Array.from(readdirSync(resolve(__dirname, `../../sounds/`)))
let playable = soundPath + sounds[Math.floor(Math.random() * sounds.length)]
const dispatcher = connection.play(playable, {
volume: 0.5,
})

const dispatcher = connection.play(playable, {
volume: 0.5,
})

dispatcher.on('finish', () => {
connection.voice.channel.leave()
})
} else {
message.reply('How can I scare your companions without you beeing present in the voice channel?')
}
}
dispatcher.on('finish', () => {
connection.voice.channel.leave()
})
} else {
message.reply('How can I scare your companions without you beeing present in the voice channel?')
}
},
}

0 comments on commit 75752fb

Please sign in to comment.