diff options
author | 2018-10-14 19:58:26 +0530 | |
---|---|---|
committer | 2018-10-14 19:58:26 +0530 | |
commit | dc8a2330c5ca4ddef307101b6ce47de99ba61522 (patch) | |
tree | 63e1510c21660eec7ef3d765d0ca68700dcd764e /bot | |
parent | Issue #15 Feature pull request template (#49) (diff) |
Add cog to play spooky sounds
* Add SpookySound cog
* Add sound files
* Add PyNaCl to Pipfile (required for Discord voice)
Diffstat (limited to 'bot')
18 files changed, 80 insertions, 0 deletions
diff --git a/bot/cogs/spookysound.py b/bot/cogs/spookysound.py new file mode 100644 index 00000000..99c1ae24 --- /dev/null +++ b/bot/cogs/spookysound.py @@ -0,0 +1,39 @@ +import random +from pathlib import Path + +import discord +from discord.ext import commands + +HACKTOBERBOT_VOICE_CHANNEL_ID = 101010 # Replace with actual channel ID + + +class SpookySound: + + def __init__(self, bot): + self.bot = bot + self.sound_files = list(Path("./bot/resources/spookysounds").glob("*.mp3")) + self.channel = None + + async def on_ready(self): + self.channel = self.bot.get_channel(HACKTOBERBOT_VOICE_CHANNEL_ID) + + @commands.cooldown(rate=1, per=120) + @commands.command(brief="Play a spooky sound, restricted to once per 2 mins") + async def spookysound(self, ctx): + """ + Connect to the Hacktoberbot voice channel, play a random spooky sound, then disconnect. Cannot be used more than + once in 2 minutes. + """ + await ctx.send("Initiating spooky sound...") + voice = await self.channel.connect() + file_path = random.choice(self.sound_files) + src = discord.FFmpegPCMAudio(str(file_path.resolve())) + + async def disconnect(): + await voice.disconnect() + + voice.play(src, after=lambda e: self.bot.loop.create_task(disconnect())) + + +def setup(bot): + bot.add_cog(SpookySound(bot)) diff --git a/bot/resources/spookysounds/109710__tomlija__horror-gate.mp3 b/bot/resources/spookysounds/109710__tomlija__horror-gate.mp3 Binary files differnew file mode 100644 index 00000000..495f2bd1 --- /dev/null +++ b/bot/resources/spookysounds/109710__tomlija__horror-gate.mp3 diff --git a/bot/resources/spookysounds/126113__klankbeeld__laugh.mp3 b/bot/resources/spookysounds/126113__klankbeeld__laugh.mp3 Binary files differnew file mode 100644 index 00000000..538feabc --- /dev/null +++ b/bot/resources/spookysounds/126113__klankbeeld__laugh.mp3 diff --git a/bot/resources/spookysounds/133674__klankbeeld__horror-laugh-original-132802-nanakisan-evil-laugh-08.mp3 b/bot/resources/spookysounds/133674__klankbeeld__horror-laugh-original-132802-nanakisan-evil-laugh-08.mp3 Binary files differnew file mode 100644 index 00000000..17f66698 --- /dev/null +++ b/bot/resources/spookysounds/133674__klankbeeld__horror-laugh-original-132802-nanakisan-evil-laugh-08.mp3 diff --git a/bot/resources/spookysounds/14570__oscillator__ghost-fx.mp3 b/bot/resources/spookysounds/14570__oscillator__ghost-fx.mp3 Binary files differnew file mode 100644 index 00000000..5670657c --- /dev/null +++ b/bot/resources/spookysounds/14570__oscillator__ghost-fx.mp3 diff --git a/bot/resources/spookysounds/168650__0xmusex0__doorcreak.mp3 b/bot/resources/spookysounds/168650__0xmusex0__doorcreak.mp3 Binary files differnew file mode 100644 index 00000000..42f9e9fd --- /dev/null +++ b/bot/resources/spookysounds/168650__0xmusex0__doorcreak.mp3 diff --git a/bot/resources/spookysounds/171078__klankbeeld__horror-scream-woman-long.mp3 b/bot/resources/spookysounds/171078__klankbeeld__horror-scream-woman-long.mp3 Binary files differnew file mode 100644 index 00000000..1cdb0f4d --- /dev/null +++ b/bot/resources/spookysounds/171078__klankbeeld__horror-scream-woman-long.mp3 diff --git a/bot/resources/spookysounds/193812__geoneo0__four-voices-whispering-6.mp3 b/bot/resources/spookysounds/193812__geoneo0__four-voices-whispering-6.mp3 Binary files differnew file mode 100644 index 00000000..89150d57 --- /dev/null +++ b/bot/resources/spookysounds/193812__geoneo0__four-voices-whispering-6.mp3 diff --git a/bot/resources/spookysounds/237282__devilfish101__frantic-violin-screech.mp3 b/bot/resources/spookysounds/237282__devilfish101__frantic-violin-screech.mp3 Binary files differnew file mode 100644 index 00000000..b5f85f8d --- /dev/null +++ b/bot/resources/spookysounds/237282__devilfish101__frantic-violin-screech.mp3 diff --git a/bot/resources/spookysounds/249686__cylon8472__cthulhu-growl.mp3 b/bot/resources/spookysounds/249686__cylon8472__cthulhu-growl.mp3 Binary files differnew file mode 100644 index 00000000..d141f68e --- /dev/null +++ b/bot/resources/spookysounds/249686__cylon8472__cthulhu-growl.mp3 diff --git a/bot/resources/spookysounds/35716__analogchill__scream.mp3 b/bot/resources/spookysounds/35716__analogchill__scream.mp3 Binary files differnew file mode 100644 index 00000000..a0614b53 --- /dev/null +++ b/bot/resources/spookysounds/35716__analogchill__scream.mp3 diff --git a/bot/resources/spookysounds/413315__inspectorj__something-evil-approaches-a.mp3 b/bot/resources/spookysounds/413315__inspectorj__something-evil-approaches-a.mp3 Binary files differnew file mode 100644 index 00000000..38374316 --- /dev/null +++ b/bot/resources/spookysounds/413315__inspectorj__something-evil-approaches-a.mp3 diff --git a/bot/resources/spookysounds/60571__gabemiller74__breathofdeath.mp3 b/bot/resources/spookysounds/60571__gabemiller74__breathofdeath.mp3 Binary files differnew file mode 100644 index 00000000..f769d9d8 --- /dev/null +++ b/bot/resources/spookysounds/60571__gabemiller74__breathofdeath.mp3 diff --git a/bot/resources/spookysounds/Female_Monster_Growls_.mp3 b/bot/resources/spookysounds/Female_Monster_Growls_.mp3 Binary files differnew file mode 100644 index 00000000..8b04f0f5 --- /dev/null +++ b/bot/resources/spookysounds/Female_Monster_Growls_.mp3 diff --git a/bot/resources/spookysounds/Male_Zombie_Roar_.mp3 b/bot/resources/spookysounds/Male_Zombie_Roar_.mp3 Binary files differnew file mode 100644 index 00000000..964d685e --- /dev/null +++ b/bot/resources/spookysounds/Male_Zombie_Roar_.mp3 diff --git a/bot/resources/spookysounds/Monster_Alien_Growl_Calm_.mp3 b/bot/resources/spookysounds/Monster_Alien_Growl_Calm_.mp3 Binary files differnew file mode 100644 index 00000000..9e643773 --- /dev/null +++ b/bot/resources/spookysounds/Monster_Alien_Growl_Calm_.mp3 diff --git a/bot/resources/spookysounds/Monster_Alien_Grunt_Hiss_.mp3 b/bot/resources/spookysounds/Monster_Alien_Grunt_Hiss_.mp3 Binary files differnew file mode 100644 index 00000000..ad99cf76 --- /dev/null +++ b/bot/resources/spookysounds/Monster_Alien_Grunt_Hiss_.mp3 diff --git a/bot/resources/spookysounds/sources.txt b/bot/resources/spookysounds/sources.txt new file mode 100644 index 00000000..7df03c2e --- /dev/null +++ b/bot/resources/spookysounds/sources.txt @@ -0,0 +1,41 @@ +Female_Monster_Growls_ +Male_Zombie_Roar_ +Monster_Alien_Growl_Calm_ +Monster_Alien_Grunt_Hiss_ +https://www.youtube.com/audiolibrary/soundeffects + +413315__inspectorj__something-evil-approaches-a +https://freesound.org/people/InspectorJ/sounds/413315/ + +133674__klankbeeld__horror-laugh-original-132802-nanakisan-evil-laugh-08 +https://freesound.org/people/klankbeeld/sounds/133674/ + +35716__analogchill__scream +https://freesound.org/people/analogchill/sounds/35716/ + +249686__cylon8472__cthulhu-growl +https://freesound.org/people/cylon8472/sounds/249686/ + +126113__klankbeeld__laugh +https://freesound.org/people/klankbeeld/sounds/126113/ + +14570__oscillator__ghost-fx +https://freesound.org/people/oscillator/sounds/14570/ + +60571__gabemiller74__breathofdeath +https://freesound.org/people/gabemiller74/sounds/60571/ + +168650__0xmusex0__doorcreak +https://freesound.org/people/0XMUSEX0/sounds/168650/ + +193812__geoneo0__four-voices-whispering-6 +https://freesound.org/people/geoneo0/sounds/193812/ + +109710__tomlija__horror-gate +https://freesound.org/people/Tomlija/sounds/109710/ + +171078__klankbeeld__horror-scream-woman-long +https://freesound.org/people/klankbeeld/sounds/171078/ + +237282__devilfish101__frantic-violin-screech +https://freesound.org/people/devilfish101/sounds/237282/ |