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