diff options
author | 2018-11-20 13:56:51 +0100 | |
---|---|---|
committer | 2018-11-20 13:56:51 +0100 | |
commit | 1e020063fae43b516a21067c3cc859e579432ada (patch) | |
tree | 873c2b6bcecefda323ac8e2e65887ef9f73f2dc6 | |
parent | Merge branch 'hundredrab-master' (diff) | |
parent | Replace explicit PyNaCl requirement with discord.py voice requirement (diff) |
fixing merge requests and preventing a race condition
22 files changed, 93 insertions, 182 deletions
@@ -8,6 +8,7 @@ name = "pypi" arrow = "*" pillow = "*" + [dev-packages] "flake8" = "*" "flake8-bugbear" = "*" diff --git a/Pipfile.lock b/Pipfile.lock deleted file mode 100644 index be72165f..00000000 --- a/Pipfile.lock +++ /dev/null @@ -1,179 +0,0 @@ -{ - "_meta": { - "hash": { - "sha256": "577eb73d927cf69687453acf1d06c40b81aedab40a238402f14d5a9385413bc0" - }, - "pipfile-spec": 6, - "requires": { - "python_version": "3.7" - }, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.org/simple", - "verify_ssl": true - } - ] - }, - "default": { - "arrow": { - "hashes": [ - "sha256:a558d3b7b6ce7ffc74206a86c147052de23d3d4ef0e17c210dd478c53575c4cd" - ], - "index": "pypi", - "version": "==0.12.1" - }, - "discord-py": { - "git": "https://github.com/Rapptz/discord.py", - "ref": "rewrite" - }, - "pillow": { - "hashes": [ - "sha256:00203f406818c3f45d47bb8fe7e67d3feddb8dcbbd45a289a1de7dd789226360", - "sha256:0616f800f348664e694dddb0b0c88d26761dd5e9f34e1ed7b7a7d2da14b40cb7", - "sha256:091136f2a37e9ed6bd8ce96fbf5269199ba6edee490d64de7ac934316f31ecca", - "sha256:0d67ae9a5937b1348fa1d97c7dcb6b56aaef828ca6655298e96f2f3114ad829d", - "sha256:0e1aaddd00ee9014fe7a61b9da61427233fcd7c7f193b5efd6689e0ec36bc42f", - "sha256:1f7908aab90c92ad85af9d2fec5fc79456a89b3adcc26314d2cde0e238bd789e", - "sha256:2ea3517cd5779843de8a759c2349a3cd8d3893e03ab47053b66d5ec6f8bc4f93", - "sha256:39b662f65a067709a62943003c1e807d140e7fcf631fcfc66ebe905f8149b9f4", - "sha256:3ddc19447cf42ef3ec564ab7ebbd4f67838ba9816d739befe29dd70149c775bd", - "sha256:48a9f0538c91fc136b3a576bee0e7cd174773dc9920b310c21dcb5519722e82c", - "sha256:5280ebc42641a1283b7b1f2c20e5b936692198b9dd9995527c18b794850be1a8", - "sha256:576a8a7a57065dab968d9d18befa2594a7673dcdab78c9b1f34248410cc6118f", - "sha256:5e334a23c8f7cb6079987a2ed9978821a42b4323a3a3bdbc132945348737f9a9", - "sha256:5e34e4b5764af65551647f5cc67cf5198c1d05621781d5173b342e5e55bf023b", - "sha256:63b120421ab85cad909792583f83b6ca3584610c2fe70751e23f606a3c2e87f0", - "sha256:696b5e0109fe368d0057f484e2e91717b49a03f1e310f857f133a4acec9f91dd", - "sha256:6cb528de694f503ea164541c151da6c18267727a7558e0c9716cc0383d89658a", - "sha256:7306d851d5a0cfac9ea07f1177783836f4b37292e5f224a534a52111cb6a6451", - "sha256:7e3e32346d991f1788026917d0a9c182d6d32dc757163eee7ca990f1f831499e", - "sha256:870ed021a42b1b02b5fe4a739ea735f671a84128c0a666c705db2cb9abd528eb", - "sha256:916da1c19e4012d06a372127d7140dae894806fad67ef44330e5600d77833581", - "sha256:9303a289fa0811e1c6abd9ddebfc770556d7c3311cb2b32eff72164ddc49bc64", - "sha256:9577888ecc0ad7d06c3746afaba339c94d62b59da16f7a5d1cff9e491f23dace", - "sha256:987e1c94a33c93d9b209315bfda9faa54b8edfce6438a1e93ae866ba20de5956", - "sha256:99a3bbdbb844f4fb5d6dd59fac836a40749781c1fa63c563bc216c27aef63f60", - "sha256:99db8dc3097ceafbcff9cb2bff384b974795edeb11d167d391a02c7bfeeb6e16", - "sha256:a379526415f54f9462bc65a4da76fb0acc05e3b2a21717dde79621cf4377e0e6", - "sha256:a5a96cf49eb580756a44ecf12949e52f211e20bffbf5a95760ac14b1e499cd37", - "sha256:a844b5d8120f99fb7cd276ff544ac5bd562b0c053760d59694e6bf747c6ca7f5", - "sha256:a9284368e81a67a7f47d5ef1ef7e4f11a4f688485879f44cf5f9090bba1f9d94", - "sha256:aa6ca3eb56704cdc0d876fc6047ffd5ee960caad52452fbee0f99908a141a0ae", - "sha256:aade5e66795c94e4a2b2624affeea8979648d1b0ae3fcee17e74e2c647fc4a8a", - "sha256:b78905860336c1d292409e3df6ad39cc1f1c7f0964e66844bbc2ebfca434d073", - "sha256:b92f521cdc4e4a3041cc343625b699f20b0b5f976793fb45681aac1efda565f8", - "sha256:bb2baf44e97811687893873eab8cf9f18b40321cc15d15ff9f91dc031e30631f", - "sha256:bfde84bbd6ae5f782206d454b67b7ee8f7f818c29b99fd02bf022fd33bab14cb", - "sha256:c2b62d3df80e694c0e4a0ed47754c9480521e25642251b3ab1dff050a4e60409", - "sha256:c55d348c1c65896c1bd804527de4880d251ae832acf90d74ad525bb79e77d55c", - "sha256:c5e2be6c263b64f6f7656e23e18a4a9980cffc671442795682e8c4e4f815dd9f", - "sha256:c99aa3c63104e0818ec566f8ff3942fb7c7a8f35f9912cb63fd8e12318b214b2", - "sha256:dae06620d3978da346375ebf88b9e2dd7d151335ba668c995aea9ed07af7add4", - "sha256:db5499d0710823fa4fb88206050d46544e8f0e0136a9a5f5570b026584c8fd74", - "sha256:dcd3cd17d291e01e47636101c4a6638ffb44c842d009973e3b5c1b67ff718c58", - "sha256:f12df6b45abc18f27f6e21ce26f7cbf7aa19820911462e46536e22085658ca1e", - "sha256:f36baafd82119c4a114b9518202f2a983819101dcc14b26e43fc12cbefdce00e", - "sha256:f52b79c8796d81391ab295b04e520bda6feed54d54931708872e8f9ae9db0ea1", - "sha256:fa2a50f762d06d84125db0b95d0121e9c640afa7edc23fc0848896760a390f8e", - "sha256:fa49bb60792b542b95ca93a39041e7113843093ce3cfd216870118eb3798fcc9", - "sha256:ff8cff01582fa1a7e533cb97f628531c4014af4b5f38e33cdcfe5eec29b6d888", - "sha256:ffbccfe1c077b5f41738bd719518213c217be7a7a12a7e74113d05a0d6617390" - ], - "index": "pypi", - "version": "==5.3.0" - }, - "python-dateutil": { - "hashes": [ - "sha256:063df5763652e21de43de7d9e00ccf239f953a832941e37be541614732cdfc93", - "sha256:88f9287c0174266bb0d8cedd395cfba9c58e87e5ad86b2ce58859bc11be3cf02" - ], - "version": "==2.7.5" - }, - "six": { - "hashes": [ - "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", - "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" - ], - "version": "==1.11.0" - } - }, - "develop": { - "attrs": { - "hashes": [ - "sha256:10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69", - "sha256:ca4be454458f9dec299268d472aaa5a11f67a4ff70093396e1ceae9c76cf4bbb" - ], - "version": "==18.2.0" - }, - "flake8": { - "hashes": [ - "sha256:6a35f5b8761f45c5513e3405f110a86bea57982c3b75b766ce7b65217abe1670", - "sha256:c01f8a3963b3571a8e6bd7a4063359aff90749e160778e03817cd9b71c9e07d2" - ], - "index": "pypi", - "version": "==3.6.0" - }, - "flake8-bugbear": { - "hashes": [ - "sha256:07b6e769d7f4e168d590f7088eae40f6ddd9fa4952bed31602def65842682c83", - "sha256:0ccf56975f4db1d69dc1cf3598c99d768ebf95d0cad27d76087954aa399b515a" - ], - "index": "pypi", - "version": "==18.8.0" - }, - "flake8-import-order": { - "hashes": [ - "sha256:9be5ca10d791d458eaa833dd6890ab2db37be80384707b0f76286ddd13c16cbf", - "sha256:feca2fd0a17611b33b7fa84449939196c2c82764e262486d5c3e143ed77d387b" - ], - "index": "pypi", - "version": "==0.18" - }, - "flake8-string-format": { - "hashes": [ - "sha256:68ea72a1a5b75e7018cae44d14f32473c798cf73d75cbaed86c6a9a907b770b2", - "sha256:774d56103d9242ed968897455ef49b7d6de272000cfa83de5814273a868832f1" - ], - "index": "pypi", - "version": "==0.2.3" - }, - "flake8-tidy-imports": { - "hashes": [ - "sha256:5fc28c82bba16abb4f1154dc59a90487f5491fbdb27e658cbee241e8fddc1b91", - "sha256:c05c9f7dadb5748a04b6fa1c47cb6ae5a8170f03cfb1dca8b37aec58c1ee6d15" - ], - "index": "pypi", - "version": "==1.1.0" - }, - "flake8-todo": { - "hashes": [ - "sha256:6e4c5491ff838c06fe5a771b0e95ee15fc005ca57196011011280fc834a85915" - ], - "index": "pypi", - "version": "==0.7" - }, - "mccabe": { - "hashes": [ - "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", - "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f" - ], - "version": "==0.6.1" - }, - "pycodestyle": { - "hashes": [ - "sha256:74abc4e221d393ea5ce1f129ea6903209940c1ecd29e002e8c6933c2b21026e0", - "sha256:cbc619d09254895b0d12c2c691e237b2e91e9b2ecf5e84c26b35400f93dcfb83", - "sha256:cbfca99bd594a10f674d0cd97a3d802a1fdef635d4361e1a2658de47ed261e3a" - ], - "version": "==2.4.0" - }, - "pyflakes": { - "hashes": [ - "sha256:9a7662ec724d0120012f6e29d6248ae3727d821bba522a0e6b356eff19126a49", - "sha256:f661252913bc1dbe7fcfcbf0af0db3f42ab65aabd1a6ca68fe5d466bace94dae" - ], - "version": "==2.0.0" - } - } -} 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/ |