diff --git a/commands/Sound/playsound.js b/commands/Sound/playsound.js new file mode 100644 index 0000000..a2d40ed --- /dev/null +++ b/commands/Sound/playsound.js @@ -0,0 +1,33 @@ +const { prefix } = require('../../config.json') +const { readdirSync } = require('fs') +const { resolve } = require('path') + +module.exports = { + config: { + name: 'Boo Sound', + usage: `${prefix}booh`, + description: 'Display this menu', + command: 'booh', + aliases: ['buh', 'scare'], + displayHelp: false, + }, + + run: async (bot, message, args) => { + 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, + }) + + dispatcher.on('finish', () => { + connection.voice.channel.leave() + }) + } else { + message.reply('How can I scare your companions without you beeing present in the voice channel?') + } + }, +} diff --git a/handlers/command.js b/handlers/command.js index 560546a..af7455b 100644 --- a/handlers/command.js +++ b/handlers/command.js @@ -11,7 +11,7 @@ module.exports = (bot) => { } } - const dirs = ['Info', 'Configuration'] + const dirs = ['Info', 'Configuration', 'Sound'] if (process.env.NODE_ENV === 'dev') dirs.push('Test') diff --git a/package.json b/package.json index 87b05a4..a91ae85 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "license": "MIT", "private": true, "dependencies": { + "@discordjs/opus": "^0.3.2", "discord.js": "^12.3.1", + "ffmpeg-static": "^4.2.7", "lowdb": "^1.0.0" }, "devDependencies": { diff --git a/sounds/batR.wav b/sounds/batR.wav new file mode 100644 index 0000000..f657a0b Binary files /dev/null and b/sounds/batR.wav differ diff --git a/sounds/boo_laughR.wav b/sounds/boo_laughR.wav new file mode 100644 index 0000000..a831613 Binary files /dev/null and b/sounds/boo_laughR.wav differ diff --git a/sounds/chainsawR.wav b/sounds/chainsawR.wav new file mode 100644 index 0000000..7d7c22c Binary files /dev/null and b/sounds/chainsawR.wav differ diff --git a/sounds/creaky_doorR.wav b/sounds/creaky_doorR.wav new file mode 100644 index 0000000..52c00dc Binary files /dev/null and b/sounds/creaky_doorR.wav differ diff --git a/sounds/entrance_mixR.wav b/sounds/entrance_mixR.wav new file mode 100644 index 0000000..69c70db Binary files /dev/null and b/sounds/entrance_mixR.wav differ diff --git a/sounds/ghostR.wav b/sounds/ghostR.wav new file mode 100644 index 0000000..538b8f9 Binary files /dev/null and b/sounds/ghostR.wav differ diff --git a/sounds/howlin_wolfR.wav b/sounds/howlin_wolfR.wav new file mode 100644 index 0000000..162f73b Binary files /dev/null and b/sounds/howlin_wolfR.wav differ diff --git a/sounds/lab2XrcR.wav b/sounds/lab2XrcR.wav new file mode 100644 index 0000000..8a845b5 Binary files /dev/null and b/sounds/lab2XrcR.wav differ diff --git a/sounds/mnstrX.wav b/sounds/mnstrX.wav new file mode 100644 index 0000000..330c360 Binary files /dev/null and b/sounds/mnstrX.wav differ diff --git a/sounds/noreturnR.wav b/sounds/noreturnR.wav new file mode 100644 index 0000000..5103b4b Binary files /dev/null and b/sounds/noreturnR.wav differ diff --git a/sounds/ogreR.wav b/sounds/ogreR.wav new file mode 100644 index 0000000..3894d77 Binary files /dev/null and b/sounds/ogreR.wav differ diff --git a/sounds/spooky_skeleton.mp3 b/sounds/spooky_skeleton.mp3 new file mode 100644 index 0000000..43b1159 Binary files /dev/null and b/sounds/spooky_skeleton.mp3 differ diff --git a/sounds/thunderR.wav b/sounds/thunderR.wav new file mode 100644 index 0000000..2a036a3 Binary files /dev/null and b/sounds/thunderR.wav differ diff --git a/sounds/way_scaryR.wav b/sounds/way_scaryR.wav new file mode 100644 index 0000000..02d192b Binary files /dev/null and b/sounds/way_scaryR.wav differ diff --git a/sounds/welcomeR.wav b/sounds/welcomeR.wav new file mode 100644 index 0000000..a20eb52 Binary files /dev/null and b/sounds/welcomeR.wav differ diff --git a/sounds/windR.wav b/sounds/windR.wav new file mode 100644 index 0000000..0e49d3d Binary files /dev/null and b/sounds/windR.wav differ diff --git a/sounds/wrong_doorR.wav b/sounds/wrong_doorR.wav new file mode 100644 index 0000000..93d3588 Binary files /dev/null and b/sounds/wrong_doorR.wav differ