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
|
|
|
|
, websockets
|
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-04-11 21:39:14 +01:00
|
|
|
version = "1.7.1";
|
|
|
|
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-04-11 21:39:14 +01:00
|
|
|
sha256 = "sha256-dpASIqe6rJEyiWJyPbQhq9M54lX1ilfp4UuGnbJcFLo=";
|
2016-12-14 18:13:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-11 21:39:14 +01:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
aiohttp
|
|
|
|
websockets
|
|
|
|
] ++ 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 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/";
|
|
|
|
maintainers = [ maintainers.ivar ];
|
|
|
|
license = licenses.mit;
|
2016-12-14 18:13:52 +00:00
|
|
|
};
|
|
|
|
}
|