1{
2 lib,
3 setuptools,
4 aiohttp,
5 buildPythonPackage,
6 fetchFromGitHub,
7 libopus,
8 pynacl,
9 pythonOlder,
10 withVoice ? true,
11 ffmpeg,
12}:
13
14buildPythonPackage rec {
15 pname = "disnake";
16 version = "2.10.1";
17 pyproject = true;
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "DisnakeDev";
23 repo = "disnake";
24 tag = "v${version}";
25 hash = "sha256-MQxYkUA3uclmY2cKBr4DsBg79ovsH1EsMOjiVPGaLVE=";
26 };
27
28 build-system = [ setuptools ];
29
30 dependencies =
31 [
32 aiohttp
33 ]
34 ++ lib.optionals withVoice [
35 libopus
36 pynacl
37 ffmpeg
38 ];
39
40 postPatch = lib.optionalString withVoice ''
41 substituteInPlace "disnake/opus.py" \
42 --replace-fail 'ctypes.util.find_library("opus")' "'${libopus}/lib/libopus.so.0'"
43 substituteInPlace "disnake/player.py" \
44 --replace-fail 'executable: str = "ffmpeg"' 'executable: str="${ffmpeg}/bin/ffmpeg"'
45 '';
46
47 # Only have integration tests with discord
48 doCheck = false;
49
50 pythonImportsCheck = [
51 "disnake"
52 "disnake.file"
53 "disnake.member"
54 "disnake.user"
55 "disnake.state"
56 "disnake.guild"
57 "disnake.webhook"
58 "disnake.ext.commands.bot"
59 ];
60
61 meta = {
62 description = "API wrapper for Discord written in Python";
63 homepage = "https://disnake.dev/";
64 changelog = "https://github.com/DisnakeDev/disnake/blob/v${version}/docs/whats_new.rst";
65 license = lib.licenses.mit;
66 maintainers = with lib.maintainers; [ infinidoge ];
67 };
68}