2016-12-14 18:13:52 +00:00
|
|
|
{ lib
|
2021-04-11 21:39:14 +01:00
|
|
|
, aiohttp
|
2016-12-14 18:13:52 +00:00
|
|
|
, buildPythonPackage
|
2021-04-11 21:39:14 +01:00
|
|
|
, fetchFromGitHub
|
|
|
|
, libopus
|
|
|
|
, pynacl
|
2016-12-14 18:13:52 +00:00
|
|
|
, pythonOlder
|
2021-04-11 21:39:14 +01:00
|
|
|
, withVoice ? true
|
2016-12-14 18:13:52 +00:00
|
|
|
}:
|
|
|
|
|
2018-01-29 17:45:38 +00:00
|
|
|
buildPythonPackage rec {
|
2016-12-14 18:13:52 +00:00
|
|
|
pname = "discord.py";
|
2021-06-13 00:03:09 +01:00
|
|
|
version = "1.7.3";
|
2021-11-24 10:03:41 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
2021-04-11 21:39:14 +01:00
|
|
|
disabled = pythonOlder "3.8";
|
2016-12-14 18:13:52 +00:00
|
|
|
|
2020-01-10 19:34:18 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Rapptz";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-06-13 00:03:09 +01:00
|
|
|
sha256 = "sha256-eKXCzGFSzxpdZed4/4G6uJ96s5yCm6ci8K8XYR1zQlE=";
|
2016-12-14 18:13:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-11 21:39:14 +01:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
aiohttp
|
|
|
|
] ++ lib.optionalString withVoice [
|
|
|
|
libopus
|
|
|
|
pynacl
|
|
|
|
];
|
|
|
|
|
2016-12-14 18:13:52 +00:00
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace "discord/opus.py" \
|
|
|
|
--replace "ctypes.util.find_library('opus')" "'${libopus}/lib/libopus.so.0'"
|
2021-11-24 10:03:41 +00:00
|
|
|
substituteInPlace requirements.txt \
|
|
|
|
--replace "aiohttp>=3.6.0,<3.8.0" "aiohttp>=3.6.0,<4"
|
2016-12-14 18:13:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-04-11 21:39:14 +01:00
|
|
|
# Only have integration tests with discord
|
2017-09-05 10:16:41 +01:00
|
|
|
doCheck = false;
|
|
|
|
|
2020-01-10 19:34:18 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"discord"
|
|
|
|
"discord.file"
|
|
|
|
"discord.member"
|
|
|
|
"discord.user"
|
|
|
|
"discord.state"
|
|
|
|
"discord.guild"
|
|
|
|
"discord.webhook"
|
|
|
|
"discord.ext.commands.bot"
|
|
|
|
];
|
|
|
|
|
2020-10-23 02:59:42 +01:00
|
|
|
meta = with lib; {
|
2021-04-11 21:39:14 +01:00
|
|
|
description = "Python wrapper for the Discord API";
|
2020-10-23 02:59:42 +01:00
|
|
|
homepage = "https://discordpy.rtfd.org/";
|
|
|
|
license = licenses.mit;
|
2021-11-24 10:03:41 +00:00
|
|
|
maintainers = with maintainers; [ ivar ];
|
2016-12-14 18:13:52 +00:00
|
|
|
};
|
|
|
|
}
|