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

Feature: Halloween Bot Scare #31

Merged
merged 2 commits into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions commands/Sound/playsound.js
Original file line number Diff line number Diff line change
@@ -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?')
}
},
}
2 changes: 1 addition & 1 deletion handlers/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Binary file added sounds/batR.wav
Binary file not shown.
Binary file added sounds/boo_laughR.wav
Binary file not shown.
Binary file added sounds/chainsawR.wav
Binary file not shown.
Binary file added sounds/creaky_doorR.wav
Binary file not shown.
Binary file added sounds/entrance_mixR.wav
Binary file not shown.
Binary file added sounds/ghostR.wav
Binary file not shown.
Binary file added sounds/howlin_wolfR.wav
Binary file not shown.
Binary file added sounds/lab2XrcR.wav
Binary file not shown.
Binary file added sounds/mnstrX.wav
Binary file not shown.
Binary file added sounds/noreturnR.wav
Binary file not shown.
Binary file added sounds/ogreR.wav
Binary file not shown.
Binary file added sounds/spooky_skeleton.mp3
Binary file not shown.
Binary file added sounds/thunderR.wav
Binary file not shown.
Binary file added sounds/way_scaryR.wav
Binary file not shown.
Binary file added sounds/welcomeR.wav
Binary file not shown.
Binary file added sounds/windR.wav
Binary file not shown.
Binary file added sounds/wrong_doorR.wav
Binary file not shown.