1{ lib 2, fetchPypi 3, buildPythonPackage 4, pythonOlder 5, withVoice ? true, libopus 6, asyncio 7, aiohttp 8, websockets 9, pynacl 10}: 11 12buildPythonPackage rec { 13 pname = "discord.py"; 14 version = "0.16.12"; 15 16 src = fetchPypi { 17 inherit pname version; 18 sha256 = "17fb8814100fbaf7a79468baa432184db6cef3bbea4ad194fe297c7407d50108"; 19 }; 20 21 propagatedBuildInputs = [ asyncio aiohttp websockets pynacl ]; 22 patchPhase = '' 23 substituteInPlace "requirements.txt" \ 24 --replace "aiohttp>=1.0.0,<1.1.0" "aiohttp" 25 '' + lib.optionalString withVoice '' 26 substituteInPlace "discord/opus.py" \ 27 --replace "ctypes.util.find_library('opus')" "'${libopus}/lib/libopus.so.0'" 28 ''; 29 30 disabled = pythonOlder "3.5"; 31 32 # No tests in archive 33 doCheck = false; 34 35 meta = { 36 description = "A python wrapper for the Discord API"; 37 homepage = "https://discordpy.rtfd.org/"; 38 license = lib.licenses.mit; 39 40 # discord.py requires websockets<4.0 41 # See https://github.com/Rapptz/discord.py/issues/973 42 broken = true; 43 }; 44}