diff options
21 files changed, 93 insertions, 3 deletions
@@ -8,6 +8,7 @@ name = "pypi" arrow = "*" pillow = "*" + [dev-packages] "flake8" = "*" "flake8-bugbear" = "*" diff --git a/bot/cogs/hacktober/halloween_facts.py b/bot/cogs/hacktober/halloween_facts.py index 304d5d94..bd164e30 100644 --- a/bot/cogs/hacktober/halloween_facts.py +++ b/bot/cogs/hacktober/halloween_facts.py @@ -7,6 +7,8 @@ from pathlib import Path import discord from discord.ext import commands +from bot.constants import HACKTOBER_CHANNEL_ID + SPOOKY_EMOJIS = [ "\N{BAT}", "\N{DERELICT HOUSE BUILDING}", @@ -18,7 +20,6 @@ SPOOKY_EMOJIS = [ "\N{SPIDER WEB}", ] PUMPKIN_ORANGE = discord.Color(0xFF7518) -HACKTOBERBOT_CHANNEL_ID = 498804484324196362 INTERVAL = timedelta(hours=6).total_seconds() @@ -32,7 +33,7 @@ class HalloweenFacts: self.last_fact = None async def on_ready(self): - self.channel = self.bot.get_channel(HACKTOBERBOT_CHANNEL_ID) + self.channel = self.bot.get_channel(HACKTOBER_CHANNEL_ID) self.bot.loop.create_task(self._fact_publisher_task()) async def _fact_publisher_task(self): diff --git a/bot/cogs/hacktober/spookysound.py b/bot/cogs/hacktober/spookysound.py new file mode 100644 index 00000000..e1598517 --- /dev/null +++ b/bot/cogs/hacktober/spookysound.py @@ -0,0 +1,46 @@ +import random +from pathlib import Path + +import discord +from discord.ext import commands + +from bot.constants import HACKTOBER_VOICE_CHANNEL_ID + + +class SpookySound: + """ + A cog that plays a spooky sound in a voice channel on command. + """ + + def __init__(self, bot): + self.bot = bot + self.sound_files = list(Path("./bot/resources/spookysounds").glob("*.mp3")) + self.channel = None + + @commands.cooldown(rate=1, per=1) + @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. + """ + if not self.channel: + await self.bot.wait_until_ready() + self.channel = self.bot.get_channel(HACKTOBER_VOICE_CHANNEL_ID) + + await ctx.send("Initiating spooky sound...") + file_path = random.choice(self.sound_files) + src = discord.FFmpegPCMAudio(str(file_path.resolve())) + voice = await self.channel.connect() + voice.play(src, after=lambda e: self.bot.loop.create_task(self.disconnect(voice))) + + @staticmethod + async def disconnect(voice): + """ + Helper method to disconnect a given voice client. + """ + await voice.disconnect() + + +def setup(bot): + bot.add_cog(SpookySound(bot)) diff --git a/bot/constants.py b/bot/constants.py index 7d00a360..f2bf04a2 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -1 +1,2 @@ -HACKTOBER_CHANNEL_ID = 498804484324196362 +HACKTOBER_CHANNEL_ID = 414574275865870337 +HACKTOBER_VOICE_CHANNEL_ID = 514420006474219521 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/ |