2016-12-14 18:13:52 +00:00
|
|
|
{ lib
|
2021-04-11 20:39:14 +00:00
|
|
|
, aiohttp
|
2016-12-14 18:13:52 +00:00
|
|
|
, buildPythonPackage
|
2021-04-11 20:39:14 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, libopus
|
|
|
|
, pynacl
|
2016-12-14 18:13:52 +00:00
|
|
|
, pythonOlder
|
2021-04-11 20:39:14 +00: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-12 23:03:09 +00:00
|
|
|
version = "1.7.3";
|
2021-04-11 20:39:14 +00: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-12 23:03:09 +00:00
|
|
|
sha256 = "sha256-eKXCzGFSzxpdZed4/4G6uJ96s5yCm6ci8K8XYR1zQlE=";
|
2016-12-14 18:13:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-11 20:39:14 +00: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-04-11 20:39:14 +00:00
|
|
|
# Only have integration tests with discord
|
2017-09-05 09:16:41 +00: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 01:59:42 +00:00
|
|
|
meta = with lib; {
|
2021-04-11 20:39:14 +00:00
|
|
|
description = "Python wrapper for the Discord API";
|
2020-10-23 01:59:42 +00:00
|
|
|
homepage = "https://discordpy.rtfd.org/";
|
|
|
|
maintainers = [ maintainers.ivar ];
|
|
|
|
license = licenses.mit;
|
2016-12-14 18:13:52 +00:00
|
|
|
};
|
|
|
|
}
|