mirror of
https://github.com/discordjs/discord.js.git
synced 2026-05-28 06:20:10 +00:00
Compare commits
935 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d1d7c5162 | ||
|
|
0d417b6432 | ||
|
|
4255dcd3ca | ||
|
|
84fe65ec78 | ||
|
|
cd404fc7d3 | ||
|
|
9b45294814 | ||
|
|
c405d67e09 | ||
|
|
4278a37e3c | ||
|
|
b7204f33b9 | ||
|
|
f192d16b5b | ||
|
|
e57fe71387 | ||
|
|
dd623891e2 | ||
|
|
e44853ee6d | ||
|
|
8f9923976f | ||
|
|
dbaaa8dc93 | ||
|
|
85fae72b7b | ||
|
|
8d3018e190 | ||
|
|
01d032abee | ||
|
|
9682adb9fe | ||
|
|
f7a542f12b | ||
|
|
4be7a1bfd1 | ||
|
|
d42b589528 | ||
|
|
9309b702eb | ||
|
|
bbc9df0b0d | ||
|
|
8f04fae4c0 | ||
|
|
9888cef486 | ||
|
|
47a164bd36 | ||
|
|
a5dfa08777 | ||
|
|
5563af0da5 | ||
|
|
9bef99c75c | ||
|
|
7fe032c785 | ||
|
|
a6ae66e184 | ||
|
|
57acd4f41a | ||
|
|
594836b1bf | ||
|
|
978cf9d87f | ||
|
|
465ff074e1 | ||
|
|
9bdf670a14 | ||
|
|
31bdc4fb1e | ||
|
|
580550e5e2 | ||
|
|
bc09da9a35 | ||
|
|
818649b94f | ||
|
|
73cb34ed37 | ||
|
|
f185d892c7 | ||
|
|
b9caa2ee5d | ||
|
|
ab4707f9b4 | ||
|
|
b7f582b7f0 | ||
|
|
3a790e74f4 | ||
|
|
c7b4cf3d3f | ||
|
|
f3286402fb | ||
|
|
17bee8084e | ||
|
|
e4cac2d575 | ||
|
|
752e12116e | ||
|
|
9d694d2b67 | ||
|
|
e1bda864f7 | ||
|
|
bfc9de438a | ||
|
|
7fea0a3937 | ||
|
|
6bfad00229 | ||
|
|
910f47240d | ||
|
|
943767dc83 | ||
|
|
6dfe160c52 | ||
|
|
bd113eef06 | ||
|
|
dc7b07022c | ||
|
|
e87c9bb9a0 | ||
|
|
799054df00 | ||
|
|
7a8c8f7453 | ||
|
|
2c6b804fc9 | ||
|
|
7b870d13de | ||
|
|
28169c0f55 | ||
|
|
5bd258a557 | ||
|
|
3b7d5e869b | ||
|
|
48e7fad1c9 | ||
|
|
4a252380d9 | ||
|
|
bcab8805af | ||
|
|
db9d5b8110 | ||
|
|
bf3c283998 | ||
|
|
9f0db9d0d8 | ||
|
|
600541b476 | ||
|
|
bc8924b255 | ||
|
|
7db345942f | ||
|
|
027f95b7b2 | ||
|
|
0741be6a95 | ||
|
|
cb22f8efea | ||
|
|
69900f3652 | ||
|
|
302b1da9df | ||
|
|
4022c8167f | ||
|
|
ab6c99f155 | ||
|
|
cda16105f3 | ||
|
|
9ce3b93827 | ||
|
|
2762c1d439 | ||
|
|
28c9f94e11 | ||
|
|
4598f90183 | ||
|
|
e666c4edf7 | ||
|
|
3f7244da8d | ||
|
|
0454674ceb | ||
|
|
7475f734ac | ||
|
|
f23c07a08e | ||
|
|
b1a25bd176 | ||
|
|
906672e538 | ||
|
|
89145b121d | ||
|
|
1155c482f1 | ||
|
|
9c915d1e0a | ||
|
|
4d2bb891a9 | ||
|
|
0c32e590a8 | ||
|
|
0b908f5bce | ||
|
|
5a9c42061f | ||
|
|
16fbbde35c | ||
|
|
5af09d335c | ||
|
|
a3b9b0f1b4 | ||
|
|
efd1d0c738 | ||
|
|
7f9ea762ed | ||
|
|
fced6983d9 | ||
|
|
59a5862f2d | ||
|
|
432c5ccc82 | ||
|
|
b6abe7dbab | ||
|
|
5d067d505c | ||
|
|
64d89b3748 | ||
|
|
44b34154e8 | ||
|
|
1be0270796 | ||
|
|
7ff2568cfc | ||
|
|
09dee3d46a | ||
|
|
68acf37fd4 | ||
|
|
2682c07bd8 | ||
|
|
a172fffd76 | ||
|
|
513fdabd19 | ||
|
|
02324fbecb | ||
|
|
d97ce2e181 | ||
|
|
ec0a5cdfbc | ||
|
|
27652b94af | ||
|
|
44efcf3f52 | ||
|
|
1cbd1bda46 | ||
|
|
7d27667afc | ||
|
|
ae17a89191 | ||
|
|
b8a5669fda | ||
|
|
168256469e | ||
|
|
43f1c952c3 | ||
|
|
df9cab3864 | ||
|
|
8d9a778320 | ||
|
|
552d603782 | ||
|
|
aee547d28e | ||
|
|
a725147f17 | ||
|
|
28ad224207 | ||
|
|
1298fefa2f | ||
|
|
5f5ee18543 | ||
|
|
e8c1c228d0 | ||
|
|
ff3148ddd4 | ||
|
|
91b1fa8359 | ||
|
|
a638b6369a | ||
|
|
e42f6b1024 | ||
|
|
1da8ec7ddd | ||
|
|
892e162229 | ||
|
|
7f09da5d35 | ||
|
|
631626a3f9 | ||
|
|
b18aaa8711 | ||
|
|
8c3ae2fd90 | ||
|
|
dbda589088 | ||
|
|
0adfc0fe95 | ||
|
|
f02cc27735 | ||
|
|
cde3bcb3bd | ||
|
|
bce3cd2b8b | ||
|
|
c70dfa83fb | ||
|
|
4df7968630 | ||
|
|
39f969c777 | ||
|
|
4f41a86dd3 | ||
|
|
680ac48e3d | ||
|
|
49d525109f | ||
|
|
907c1ed9f9 | ||
|
|
0860d5210b | ||
|
|
d249aa10cc | ||
|
|
56352220af | ||
|
|
60a1ba3088 | ||
|
|
4f130a1a58 | ||
|
|
ee64253f0b | ||
|
|
6d7e989e3b | ||
|
|
c6688b94e6 | ||
|
|
090234cef2 | ||
|
|
817bea5a70 | ||
|
|
52adb3d8b2 | ||
|
|
1e2e940b98 | ||
|
|
78e0d88f55 | ||
|
|
897cbfec77 | ||
|
|
d9ae732bfd | ||
|
|
df934eccaf | ||
|
|
3541b0a88f | ||
|
|
f6c95de85d | ||
|
|
5d06be6333 | ||
|
|
144638e746 | ||
|
|
001460acc0 | ||
|
|
727f3de45b | ||
|
|
fe58105d04 | ||
|
|
0b4f4a559c | ||
|
|
b44a3770d9 | ||
|
|
1dba048d2e | ||
|
|
ba3d104619 | ||
|
|
9f1475f358 | ||
|
|
a57d6b723a | ||
|
|
6ea2a523d6 | ||
|
|
3462bbc8d4 | ||
|
|
93771ce6d0 | ||
|
|
a91fcd5cab | ||
|
|
309bc5da1f | ||
|
|
6bc7220ded | ||
|
|
ae862c38ff | ||
|
|
ac7e1a052c | ||
|
|
a959cd339c | ||
|
|
83b33c5046 | ||
|
|
948a18dfe2 | ||
|
|
ef0f38930f | ||
|
|
22062f1f86 | ||
|
|
2c056b6418 | ||
|
|
4d6c604322 | ||
|
|
6a1a36813f | ||
|
|
6faa409e96 | ||
|
|
b356ccf1e5 | ||
|
|
9ea9623de0 | ||
|
|
7ae12ab325 | ||
|
|
135ab02104 | ||
|
|
6293f28ad9 | ||
|
|
8a1bfe559d | ||
|
|
50c6fa3433 | ||
|
|
f2708dd26f | ||
|
|
3718841c7c | ||
|
|
19d976748c | ||
|
|
f944dce5c7 | ||
|
|
e47f3dda94 | ||
|
|
947f61e436 | ||
|
|
b1772089d1 | ||
|
|
642d768cdc | ||
|
|
b22bda74b8 | ||
|
|
e5057a5b6a | ||
|
|
0988b47fcd | ||
|
|
ee6ccc5e17 | ||
|
|
870f3590fe | ||
|
|
6ddc7a813c | ||
|
|
3a031c65e7 | ||
|
|
d215e283e6 | ||
|
|
8507e34995 | ||
|
|
0a005cbd16 | ||
|
|
48762c642c | ||
|
|
2d6068010b | ||
|
|
8038903c3e | ||
|
|
7ba37a3511 | ||
|
|
ccf513a2fc | ||
|
|
8d094cdfb1 | ||
|
|
64b0e6bc84 | ||
|
|
fe3fdb7d6a | ||
|
|
6d7e649bb1 | ||
|
|
7b2d76429f | ||
|
|
baff7a094c | ||
|
|
d6f5df39fc | ||
|
|
cdb74a75f2 | ||
|
|
253789f398 | ||
|
|
5500b87968 | ||
|
|
8683f45816 | ||
|
|
7892e62604 | ||
|
|
48444a5444 | ||
|
|
328f3c4ae8 | ||
|
|
f9a553a7f0 | ||
|
|
d0a76f3f38 | ||
|
|
e370ccf806 | ||
|
|
f713f52841 | ||
|
|
d8b1ef47cd | ||
|
|
fa085c18cd | ||
|
|
dfbe44143a | ||
|
|
d029227a8e | ||
|
|
b065bf799c | ||
|
|
0edf838474 | ||
|
|
f38aff7523 | ||
|
|
c8be80abd7 | ||
|
|
84a4755f53 | ||
|
|
2ed4ff7a55 | ||
|
|
1ff7bce01d | ||
|
|
ebfe3e2e62 | ||
|
|
355dd462d3 | ||
|
|
0916cd71a5 | ||
|
|
576a7f2488 | ||
|
|
d710713c09 | ||
|
|
3a16f5147d | ||
|
|
50dcececfb | ||
|
|
51a399d558 | ||
|
|
1deefbd8cd | ||
|
|
725e0a8cfe | ||
|
|
ce0d9a7272 | ||
|
|
2a1799f20f | ||
|
|
ddd3ea9727 | ||
|
|
c96ecec24c | ||
|
|
c308a2a01c | ||
|
|
3fded1d7af | ||
|
|
fb2392a1ed | ||
|
|
8fed1b1d80 | ||
|
|
dd40b870d5 | ||
|
|
357502e520 | ||
|
|
cf34f253cb | ||
|
|
59cc02de89 | ||
|
|
6ad970e311 | ||
|
|
df456589ab | ||
|
|
89569d9249 | ||
|
|
6986752578 | ||
|
|
c294a0fac4 | ||
|
|
85fd82818f | ||
|
|
6f2caffd32 | ||
|
|
00505d099a | ||
|
|
115850ad04 | ||
|
|
be7ed4077a | ||
|
|
601987ed01 | ||
|
|
cbb74e11d1 | ||
|
|
196fdfc31b | ||
|
|
f255094760 | ||
|
|
d66ac3fc39 | ||
|
|
4e53aa4a23 | ||
|
|
73b61b6b4e | ||
|
|
ac7c543dfe | ||
|
|
985681f1f6 | ||
|
|
3e39d54933 | ||
|
|
30e6bbd7a4 | ||
|
|
c7df7a4744 | ||
|
|
c5ab580562 | ||
|
|
24f3a36701 | ||
|
|
2007ed7cef | ||
|
|
65350348a8 | ||
|
|
f8b2629b18 | ||
|
|
3051ae7061 | ||
|
|
d2cba74c13 | ||
|
|
8d5d90e222 | ||
|
|
82ab92ca2a | ||
|
|
ad8b4c7698 | ||
|
|
bd50e3c0a5 | ||
|
|
4400eb1b5c | ||
|
|
4f4ec3146b | ||
|
|
97e16e6eed | ||
|
|
fb55b6dc60 | ||
|
|
ed818d6e7f | ||
|
|
75ff9fb096 | ||
|
|
c2e3d2b8ca | ||
|
|
f012655e53 | ||
|
|
fd64fb0a82 | ||
|
|
00be14b5d1 | ||
|
|
dcba580d89 | ||
|
|
392133f927 | ||
|
|
dbe978d926 | ||
|
|
871c60c8dd | ||
|
|
e0c987c1b2 | ||
|
|
24df1bc621 | ||
|
|
a52b46fab4 | ||
|
|
3c5a227ea0 | ||
|
|
cc563f77c5 | ||
|
|
2dfd01d56e | ||
|
|
863495cda0 | ||
|
|
3e3a411a42 | ||
|
|
976584a5bc | ||
|
|
6f9f103821 | ||
|
|
21c4654705 | ||
|
|
839ff5ce43 | ||
|
|
3ac191a812 | ||
|
|
3d3766f129 | ||
|
|
0ac66287d7 | ||
|
|
329839318d | ||
|
|
be7b0fb5ca | ||
|
|
18299970bd | ||
|
|
4d4258b4e2 | ||
|
|
a5fd46d306 | ||
|
|
45f897fbe7 | ||
|
|
159233059e | ||
|
|
46e89f56c7 | ||
|
|
55630a38ac | ||
|
|
bca3cc7915 | ||
|
|
22cdf0b258 | ||
|
|
c37191b582 | ||
|
|
562e3b119e | ||
|
|
19f8f8e122 | ||
|
|
238a6824ef | ||
|
|
ab92be4209 | ||
|
|
79ea663afe | ||
|
|
614c488f96 | ||
|
|
9dc8265a93 | ||
|
|
2b7dd39f3e | ||
|
|
e7ef73ffdc | ||
|
|
e7e6355cfe | ||
|
|
13db0db298 | ||
|
|
4fff20d66e | ||
|
|
1c7a5abd4e | ||
|
|
fdfd41dd8c | ||
|
|
e42178181d | ||
|
|
89bbf5d6be | ||
|
|
3b594fd86d | ||
|
|
eba3bd0291 | ||
|
|
ce198ef005 | ||
|
|
1ea53c18ac | ||
|
|
62856ff57a | ||
|
|
0224138dc9 | ||
|
|
0d44a801f2 | ||
|
|
603e231494 | ||
|
|
b2950b2997 | ||
|
|
7ada70f856 | ||
|
|
75e3ee86fb | ||
|
|
a2f8680514 | ||
|
|
c02d7808c1 | ||
|
|
50af835774 | ||
|
|
f2ccef1ce5 | ||
|
|
b8db4c4f4b | ||
|
|
53d767ec04 | ||
|
|
1963bcfa10 | ||
|
|
fe95e31f48 | ||
|
|
8085f5bde3 | ||
|
|
d656c68e75 | ||
|
|
c0ef815f9d | ||
|
|
0a648e80c9 | ||
|
|
420e8527c2 | ||
|
|
1624daa730 | ||
|
|
2b7f88ae3a | ||
|
|
c2163a29c0 | ||
|
|
36245941b3 | ||
|
|
da31ae589a | ||
|
|
461e5b337e | ||
|
|
4f713a3f6d | ||
|
|
b05e18871a | ||
|
|
1049a1d70a | ||
|
|
810059200c | ||
|
|
34f71eaba1 | ||
|
|
95db1d611b | ||
|
|
41dab17ec0 | ||
|
|
d956780d18 | ||
|
|
b95058399e | ||
|
|
952cfc0456 | ||
|
|
dc939c48ee | ||
|
|
babf550459 | ||
|
|
a102490b08 | ||
|
|
c63c39eb1f | ||
|
|
422fffdbfb | ||
|
|
45d61f24db | ||
|
|
f49f1ab3c8 | ||
|
|
cd2642c293 | ||
|
|
7ae7a9aa34 | ||
|
|
0d53afe3ce | ||
|
|
3cd91a19aa | ||
|
|
849b8df2da | ||
|
|
bbf0b0683a | ||
|
|
620d8cbf15 | ||
|
|
c8ba6b5265 | ||
|
|
1577075e52 | ||
|
|
d7026f80a4 | ||
|
|
ba51df918c | ||
|
|
9c9768f772 | ||
|
|
fe3f6c7d20 | ||
|
|
0e4612d7ab | ||
|
|
0f4566dd23 | ||
|
|
7f864578e0 | ||
|
|
4e8ac47f27 | ||
|
|
644061e881 | ||
|
|
ea89b7f783 | ||
|
|
d9fa561dd9 | ||
|
|
2cd1104d3d | ||
|
|
5133096a12 | ||
|
|
02f39e00bf | ||
|
|
e59dd9b12a | ||
|
|
1672465768 | ||
|
|
293f416e15 | ||
|
|
6cd0561014 | ||
|
|
2bd7d9dc24 | ||
|
|
2ac679c169 | ||
|
|
627bbaf4ec | ||
|
|
636a095377 | ||
|
|
c88feaa554 | ||
|
|
05def5b3f2 | ||
|
|
0128a88e25 | ||
|
|
1c8e773700 | ||
|
|
afa2f33dfd | ||
|
|
cf413bd472 | ||
|
|
883743e137 | ||
|
|
bd15cc68ce | ||
|
|
d913d04f44 | ||
|
|
bf89d678d8 | ||
|
|
f8bf945f9d | ||
|
|
e6054c6ace | ||
|
|
00e3708e78 | ||
|
|
a073010197 | ||
|
|
750f2a2b1b | ||
|
|
6b5f4fa773 | ||
|
|
6bc2750f3d | ||
|
|
7cf7c0e794 | ||
|
|
b4dcd657cf | ||
|
|
95e3e3e3dc | ||
|
|
8d64435def | ||
|
|
b9506d01ab | ||
|
|
2194632b7d | ||
|
|
e912c72a95 | ||
|
|
eff8caed85 | ||
|
|
16eb38a99e | ||
|
|
ad7ffcecb4 | ||
|
|
0a5ce3dcd5 | ||
|
|
8bee117445 | ||
|
|
0f9741bb14 | ||
|
|
fae03042cb | ||
|
|
bea1663052 | ||
|
|
fe1d0bb595 | ||
|
|
68bf4c9052 | ||
|
|
ab2c9d9a8d | ||
|
|
d42cbd1c14 | ||
|
|
79ee493a39 | ||
|
|
d2f0f4993e | ||
|
|
48595ddd19 | ||
|
|
3fa3b0238e | ||
|
|
9015bb8139 | ||
|
|
00ff2f71a4 | ||
|
|
e1808804c9 | ||
|
|
43b1cc1d56 | ||
|
|
e6572caf6c | ||
|
|
e8874bae37 | ||
|
|
1732cc71bd | ||
|
|
81cdb09363 | ||
|
|
e7882a38ee | ||
|
|
873f78b02a | ||
|
|
afc4c93119 | ||
|
|
db7dca65b2 | ||
|
|
0e5a1d2df7 | ||
|
|
3221bde4db | ||
|
|
d4b693c4b0 | ||
|
|
71db8555fe | ||
|
|
d73ebcdfd4 | ||
|
|
0ac0005697 | ||
|
|
0c38d47ef6 | ||
|
|
42fd07c5e7 | ||
|
|
2a1d516a28 | ||
|
|
68c1e122c0 | ||
|
|
af333ef4cc | ||
|
|
963b22e6ce | ||
|
|
726c0e9ed5 | ||
|
|
fb49ad7d93 | ||
|
|
2eca16dee6 | ||
|
|
46bcd3f5e3 | ||
|
|
bc443df11d | ||
|
|
ab17375248 | ||
|
|
9700f8577b | ||
|
|
ad84aa84b8 | ||
|
|
82ac3d1c44 | ||
|
|
a0418a2551 | ||
|
|
ebfc2169d5 | ||
|
|
5125407151 | ||
|
|
f95c588d87 | ||
|
|
ba82722264 | ||
|
|
96ed5a1e52 | ||
|
|
1f5002ae41 | ||
|
|
e48f2ffae3 | ||
|
|
3a0426482e | ||
|
|
90cf787759 | ||
|
|
249b6f919a | ||
|
|
b47540d6eb | ||
|
|
2341c83638 | ||
|
|
68e1549361 | ||
|
|
b436fac5c4 | ||
|
|
2d3116d505 | ||
|
|
e9d7dfaee3 | ||
|
|
618d8bb957 | ||
|
|
1676a5e73f | ||
|
|
9322c0bbd7 | ||
|
|
619139f871 | ||
|
|
a5517c2c3b | ||
|
|
68a21ee679 | ||
|
|
ad338c6a29 | ||
|
|
d18fcdbeea | ||
|
|
ca251423ea | ||
|
|
6f466a401e | ||
|
|
c42e303b7b | ||
|
|
a2841f285c | ||
|
|
03caddb4b5 | ||
|
|
f3e1760538 | ||
|
|
b6842d3e07 | ||
|
|
907f4f4b27 | ||
|
|
283c99dee8 | ||
|
|
b8283a8f29 | ||
|
|
acc9c9bf12 | ||
|
|
da42b422f0 | ||
|
|
00327a5776 | ||
|
|
d437fd31cf | ||
|
|
c947e172d6 | ||
|
|
7f4751e7c4 | ||
|
|
c36cc3b551 | ||
|
|
ce2cf382b3 | ||
|
|
d1d13f5c85 | ||
|
|
685d7b622c | ||
|
|
abc3f9e2fa | ||
|
|
71a4cd6a93 | ||
|
|
bbf7be7dfa | ||
|
|
4de1f4ce99 | ||
|
|
533d49d7d4 | ||
|
|
0d2b504bde | ||
|
|
41ead870b7 | ||
|
|
30f5e2943a | ||
|
|
ccffe09bca | ||
|
|
9956e43c8e | ||
|
|
a3cd539eac | ||
|
|
9083893d79 | ||
|
|
197c416642 | ||
|
|
487f3ea4f4 | ||
|
|
0d93ce9fbd | ||
|
|
dd71bb9e27 | ||
|
|
5f1e1b989b | ||
|
|
3ed5f4fb90 | ||
|
|
864126976f | ||
|
|
d0f2029fa6 | ||
|
|
9251fd01ce | ||
|
|
ecc35eecda | ||
|
|
fc74912a8f | ||
|
|
3e243a25d3 | ||
|
|
6b189cf3af | ||
|
|
2842b97776 | ||
|
|
28fce9ea34 | ||
|
|
afa5fa1758 | ||
|
|
b7f20956d7 | ||
|
|
675ea93bc3 | ||
|
|
71dd084667 | ||
|
|
78edc3b371 | ||
|
|
afde031267 | ||
|
|
b6d1cb88cd | ||
|
|
c247a3979b | ||
|
|
db1435910d | ||
|
|
bf78c441dd | ||
|
|
877eaab3c1 | ||
|
|
d53aabefb0 | ||
|
|
d48458b80f | ||
|
|
0e54d77025 | ||
|
|
3a8d4499d0 | ||
|
|
5619e97a39 | ||
|
|
78399a77ae | ||
|
|
a15b8e56c7 | ||
|
|
30d011c7ac | ||
|
|
cfc1f7f6ae | ||
|
|
040ea21b33 | ||
|
|
ad66991f36 | ||
|
|
b3a65a4ed6 | ||
|
|
2c55a65ddb | ||
|
|
dcd57277cd | ||
|
|
c5732efdb1 | ||
|
|
8fa3c24b12 | ||
|
|
3a2c449197 | ||
|
|
910b5a7ae6 | ||
|
|
e8cc571d6a | ||
|
|
f591542735 | ||
|
|
8e6427963b | ||
|
|
77346e3415 | ||
|
|
18dd59fe42 | ||
|
|
74c06f7a69 | ||
|
|
99af4a7d66 | ||
|
|
28b7b9f5d6 | ||
|
|
b069f818d9 | ||
|
|
95748f3721 | ||
|
|
3bbd4f46d2 | ||
|
|
93e3106404 | ||
|
|
703ac05400 | ||
|
|
afdb93b3d6 | ||
|
|
583906fe81 | ||
|
|
72340845e5 | ||
|
|
4386daf7a0 | ||
|
|
462adfbad3 | ||
|
|
204bdca555 | ||
|
|
81549e737e | ||
|
|
86f2836828 | ||
|
|
4d6cca72f4 | ||
|
|
27a0361afc | ||
|
|
8614d4b2a5 | ||
|
|
f0dd0cabdf | ||
|
|
e525e3b722 | ||
|
|
42bedbeee4 | ||
|
|
930f276828 | ||
|
|
13055f67d2 | ||
|
|
5e64d96272 | ||
|
|
25f25f5506 | ||
|
|
13e8a39f9f | ||
|
|
14fffb12af | ||
|
|
ea80677a79 | ||
|
|
d2a9f15e82 | ||
|
|
ef679e87c4 | ||
|
|
b5c200901b | ||
|
|
4e58de8cd6 | ||
|
|
dd6c158250 | ||
|
|
b541cfa89a | ||
|
|
7ec859d5a1 | ||
|
|
538df5f76b | ||
|
|
a8ee8e8759 | ||
|
|
6889743d5e | ||
|
|
df73f52454 | ||
|
|
159602b359 | ||
|
|
beb44b7bfa | ||
|
|
91a05be386 | ||
|
|
0ec5d3e8d7 | ||
|
|
7b24127de5 | ||
|
|
41924df875 | ||
|
|
47ecc934f1 | ||
|
|
78b18de1e1 | ||
|
|
5c9865fc3c | ||
|
|
e4641fe701 | ||
|
|
fd34c935a2 | ||
|
|
f49600af17 | ||
|
|
315ae22a7f | ||
|
|
9a57e7ab03 | ||
|
|
7144ead048 | ||
|
|
4e03c0b1a2 | ||
|
|
bd187540d3 | ||
|
|
e404361858 | ||
|
|
54045de5f1 | ||
|
|
f0c719cf71 | ||
|
|
60587c8d74 | ||
|
|
abde946864 | ||
|
|
0571958033 | ||
|
|
5132c9ade4 | ||
|
|
42f053eb9f | ||
|
|
701c0ca9c4 | ||
|
|
9fc5a752f8 | ||
|
|
3c64cfce4a | ||
|
|
ca873ac36e | ||
|
|
9ff798a8bc | ||
|
|
b84af789c6 | ||
|
|
c7103f8930 | ||
|
|
8607a2449c | ||
|
|
c8acc17d8e | ||
|
|
b32a40086e | ||
|
|
fd5c981d83 | ||
|
|
4b8f85d44a | ||
|
|
287c143c0e | ||
|
|
3283283b4d | ||
|
|
8d5949842c | ||
|
|
9173ded903 | ||
|
|
b7c1b6ebe6 | ||
|
|
c773ea4e49 | ||
|
|
e66311bdf5 | ||
|
|
6f7bd987b8 | ||
|
|
580f260933 | ||
|
|
6772222955 | ||
|
|
5e97d309bf | ||
|
|
417fd32721 | ||
|
|
76a5bec944 | ||
|
|
3a9d8fb518 | ||
|
|
7c0476a7a8 | ||
|
|
1ce2ce93c3 | ||
|
|
0e53b4fc44 | ||
|
|
5a5316dc66 | ||
|
|
2732cbb402 | ||
|
|
f554c88b97 | ||
|
|
cd25848bdc | ||
|
|
46807bf1c1 | ||
|
|
89e3396af6 | ||
|
|
c1171e6973 | ||
|
|
3306067d7b | ||
|
|
634a5bd737 | ||
|
|
151b98e0a2 | ||
|
|
fdd4cfc7cc | ||
|
|
358c40c355 | ||
|
|
7fb39b6dc0 | ||
|
|
5d4cd1fc28 | ||
|
|
e3173d1561 | ||
|
|
8b392f359a | ||
|
|
dad570a4ec | ||
|
|
35c800cc8f | ||
|
|
b052d59e46 | ||
|
|
6af71bf639 | ||
|
|
8726b23730 | ||
|
|
ee2172c1d5 | ||
|
|
2c8747995a | ||
|
|
be083b717e | ||
|
|
fe9911acc2 | ||
|
|
9fab8ed381 | ||
|
|
c93ed88daf | ||
|
|
9cfcb3452b | ||
|
|
59060b27e6 | ||
|
|
4f65378a57 | ||
|
|
799039588b | ||
|
|
79039f08a1 | ||
|
|
4e9a11d7a9 | ||
|
|
2c17eaed02 | ||
|
|
2c6cbb6675 | ||
|
|
3b3f5d831a | ||
|
|
44c1fc5b29 | ||
|
|
3a8f1ddbf9 | ||
|
|
042d7d1dbe | ||
|
|
c5174b4d93 | ||
|
|
2d68849027 | ||
|
|
3caf1f74cc | ||
|
|
47f35a942c | ||
|
|
76ab439033 | ||
|
|
b49870f12f | ||
|
|
dba7a1d06a | ||
|
|
68435f0619 | ||
|
|
94f067cc51 | ||
|
|
345d0da72b | ||
|
|
8571723ec1 | ||
|
|
6f31130726 | ||
|
|
b3d5197013 | ||
|
|
0164d3e7b5 | ||
|
|
fc58a0d5cf | ||
|
|
cffdb5f5f6 | ||
|
|
51a8feb562 | ||
|
|
8a8ba51c2b | ||
|
|
c7b632d854 | ||
|
|
6a09ca76df | ||
|
|
f51fecf726 | ||
|
|
fee5cade9e | ||
|
|
3e1568f536 | ||
|
|
3e2124e0bd | ||
|
|
4184e51ec3 | ||
|
|
404829a19d | ||
|
|
69bffc6279 | ||
|
|
2a00064646 | ||
|
|
718f0b9543 | ||
|
|
9c8e6eed24 | ||
|
|
57c086dc5f | ||
|
|
2000b62b36 | ||
|
|
21be3d3c77 | ||
|
|
7860828a5d | ||
|
|
d2473044e5 | ||
|
|
9325e1fbb5 | ||
|
|
ea3ac96f13 | ||
|
|
9cfd287020 | ||
|
|
385da190ba | ||
|
|
f018ccebed | ||
|
|
2c565ebfaf | ||
|
|
a0ffbdb208 | ||
|
|
d668ec8632 | ||
|
|
ba93a6e224 | ||
|
|
f50c910af3 | ||
|
|
a0995c6fe7 | ||
|
|
415260d028 | ||
|
|
45c936e1ad | ||
|
|
0921484ef6 | ||
|
|
b927b223bb | ||
|
|
8d0fc8e0a6 | ||
|
|
f9f7a568fc | ||
|
|
8e16abee96 | ||
|
|
3b7c5aa96a | ||
|
|
0113202c2f | ||
|
|
a6a9f08565 | ||
|
|
9d97dfc95a | ||
|
|
9c0e20947c | ||
|
|
7b2f4e3357 | ||
|
|
7de44fb9ac | ||
|
|
830cc64828 | ||
|
|
beb91913bb | ||
|
|
830ba058d9 | ||
|
|
e99dccc828 | ||
|
|
79990df5b2 | ||
|
|
8c39ddc48d | ||
|
|
7819dcb3d1 | ||
|
|
2253560631 | ||
|
|
7d9b8a9b5b | ||
|
|
14682ba2bf | ||
|
|
d09c26c7c1 | ||
|
|
4d6adfd289 | ||
|
|
0e6ff52c61 | ||
|
|
d93990822e | ||
|
|
d8ac7e97a1 | ||
|
|
90045db92d | ||
|
|
941fd2fe98 | ||
|
|
b82c318e96 | ||
|
|
470fbbb6d6 | ||
|
|
da990f544a | ||
|
|
4d47a05a81 | ||
|
|
3614b78973 | ||
|
|
8f8504810a | ||
|
|
8f5722d242 | ||
|
|
a122f0994e | ||
|
|
ecc604e6ac | ||
|
|
c9c1b19968 | ||
|
|
c2cf1badfd | ||
|
|
4d43867206 | ||
|
|
d66b765933 | ||
|
|
df368168ee | ||
|
|
60747afda4 | ||
|
|
8eb4c47f79 | ||
|
|
cb58bc5414 | ||
|
|
cd4a70cfb2 | ||
|
|
6ed6932e24 | ||
|
|
e020287307 | ||
|
|
e315fdafc6 | ||
|
|
f280349f0c | ||
|
|
d8af1a49ae | ||
|
|
506b425ca0 | ||
|
|
1a93f8638e | ||
|
|
002d8ce0af | ||
|
|
78eeee084f | ||
|
|
72688e1a6a | ||
|
|
a411968843 | ||
|
|
8e060182a7 | ||
|
|
925280c3e3 | ||
|
|
c9faa15ac7 | ||
|
|
4342bf39d4 | ||
|
|
c5ccfab658 | ||
|
|
4d0be3fc4c | ||
|
|
6afff4e087 | ||
|
|
a369ef2788 | ||
|
|
a789b1f396 | ||
|
|
d9b9d1d0a3 | ||
|
|
ffe2359926 | ||
|
|
1573735846 | ||
|
|
bdfa66c6d0 | ||
|
|
935d7c15a4 | ||
|
|
f9b3369187 | ||
|
|
6cff34ae3c | ||
|
|
ff7adf1cf7 | ||
|
|
b59f2940e3 | ||
|
|
d504406cfc | ||
|
|
41efef750f | ||
|
|
706682af55 | ||
|
|
e072c58460 | ||
|
|
4486b623f5 | ||
|
|
d3e0f46ff0 | ||
|
|
2157e0b682 | ||
|
|
e16211c4fb | ||
|
|
d122184b6b | ||
|
|
de19475ae0 | ||
|
|
d2147304c8 | ||
|
|
50646503cd | ||
|
|
ccc794229e | ||
|
|
1d8905d25a | ||
|
|
d7d170cab7 | ||
|
|
a89938ed01 | ||
|
|
70b44a6f69 | ||
|
|
e92e087aeb | ||
|
|
e13ab5791c | ||
|
|
35cf5f4709 | ||
|
|
559ed5f76f | ||
|
|
ae71087bcc | ||
|
|
d624f82ba3 | ||
|
|
eb500ecd24 | ||
|
|
10442e5634 | ||
|
|
212c672c2f | ||
|
|
05409ccc21 | ||
|
|
780565ff68 | ||
|
|
5a971ba097 | ||
|
|
f95822dcb7 | ||
|
|
93db5efe38 | ||
|
|
b1b94ccbd0 | ||
|
|
2b3418faf4 | ||
|
|
5201861190 | ||
|
|
01a640feec | ||
|
|
5b1c83b05e | ||
|
|
af70a34a66 | ||
|
|
190075d070 |
133
.eslintrc.json
Normal file
133
.eslintrc.json
Normal file
@@ -0,0 +1,133 @@
|
||||
{
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
"no-extra-parens": ["warn", "all", {
|
||||
"nestedBinaryExpressions": false
|
||||
}],
|
||||
"valid-jsdoc": ["error", {
|
||||
"requireReturn": false,
|
||||
"requireReturnDescription": false,
|
||||
"preferType": {
|
||||
"String": "string",
|
||||
"Number": "number",
|
||||
"Boolean": "boolean",
|
||||
"Function": "function",
|
||||
"object": "Object",
|
||||
"date": "Date",
|
||||
"error": "Error"
|
||||
},
|
||||
"prefer": {
|
||||
"return": "returns"
|
||||
}
|
||||
}],
|
||||
|
||||
"accessor-pairs": "warn",
|
||||
"array-callback-return": "error",
|
||||
"complexity": "warn",
|
||||
"consistent-return": "error",
|
||||
"curly": ["error", "multi-line", "consistent"],
|
||||
"dot-location": ["error", "property"],
|
||||
"dot-notation": "error",
|
||||
"eqeqeq": "error",
|
||||
"no-empty-function": "error",
|
||||
"no-floating-decimal": "error",
|
||||
"no-implied-eval": "error",
|
||||
"no-invalid-this": "error",
|
||||
"no-lone-blocks": "error",
|
||||
"no-multi-spaces": "error",
|
||||
"no-new-func": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-new": "error",
|
||||
"no-octal-escape": "error",
|
||||
"no-return-assign": "error",
|
||||
"no-self-compare": "error",
|
||||
"no-sequences": "error",
|
||||
"no-throw-literal": "error",
|
||||
"no-unmodified-loop-condition": "error",
|
||||
"no-unused-expressions": "error",
|
||||
"no-useless-call": "error",
|
||||
"no-useless-concat": "error",
|
||||
"no-useless-escape": "error",
|
||||
"no-void": "error",
|
||||
"no-warning-comments": "warn",
|
||||
"wrap-iife": "error",
|
||||
"yoda": "error",
|
||||
|
||||
"no-label-var": "error",
|
||||
"no-shadow": "error",
|
||||
"no-undef-init": "error",
|
||||
|
||||
"callback-return": "error",
|
||||
"handle-callback-err": "error",
|
||||
"no-mixed-requires": "error",
|
||||
"no-new-require": "error",
|
||||
"no-path-concat": "error",
|
||||
"no-process-env": "error",
|
||||
|
||||
"array-bracket-spacing": "error",
|
||||
"block-spacing": "error",
|
||||
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"comma-spacing": "error",
|
||||
"comma-style": "error",
|
||||
"computed-property-spacing": "error",
|
||||
"consistent-this": ["error", "$this"],
|
||||
"eol-last": "error",
|
||||
"func-names": "error",
|
||||
"func-style": ["error", "declaration", { "allowArrowFunctions": true }],
|
||||
"indent": ["error", 2, { "SwitchCase": 1 }],
|
||||
"key-spacing": "error",
|
||||
"keyword-spacing": "error",
|
||||
"max-depth": "error",
|
||||
"max-len": ["error", 120, 2],
|
||||
"max-nested-callbacks": ["error", { "max": 4 }],
|
||||
"max-statements-per-line": ["error", { "max": 2 }],
|
||||
"new-cap": "error",
|
||||
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 3 }],
|
||||
"no-array-constructor": "error",
|
||||
"no-inline-comments": "error",
|
||||
"no-lonely-if": "error",
|
||||
"no-mixed-operators": "error",
|
||||
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }],
|
||||
"no-new-object": "error",
|
||||
"no-spaced-func": "error",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-unneeded-ternary": "error",
|
||||
"no-whitespace-before-property": "error",
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"operator-assignment": "error",
|
||||
"operator-linebreak": ["error", "after"],
|
||||
"padded-blocks": ["error", "never"],
|
||||
"quote-props": ["error", "as-needed"],
|
||||
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
|
||||
"semi-spacing": "error",
|
||||
"semi": "error",
|
||||
"space-before-blocks": "error",
|
||||
"space-before-function-paren": ["error", "never"],
|
||||
"space-in-parens": "error",
|
||||
"space-infix-ops": "error",
|
||||
"space-unary-ops": "error",
|
||||
"spaced-comment": "error",
|
||||
"unicode-bom": "error",
|
||||
|
||||
"arrow-body-style": "error",
|
||||
"arrow-spacing": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
"no-useless-constructor": "error",
|
||||
"prefer-arrow-callback": "error",
|
||||
"prefer-rest-params": "error",
|
||||
"prefer-spread": "error",
|
||||
"prefer-template": "error",
|
||||
"rest-spread-spacing": "error",
|
||||
"template-curly-spacing": "error",
|
||||
"yield-star-spacing": "error"
|
||||
}
|
||||
}
|
||||
76
.gitignore
vendored
76
.gitignore
vendored
@@ -1,40 +1,38 @@
|
||||
# Created by https://www.gitignore.io
|
||||
|
||||
hydrabot/config.json
|
||||
hydrabot/authority.json
|
||||
hydrabot/tokencache.json
|
||||
|
||||
.tmp/
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||
node_modules
|
||||
test/auth.json
|
||||
examples/auth.json
|
||||
test/msgbot.js
|
||||
# Created by https://www.gitignore.io
|
||||
|
||||
.tmp/
|
||||
.vscode/
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
test/auth.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||
node_modules
|
||||
test/auth.json
|
||||
examples/auth.json
|
||||
docs/_build
|
||||
@@ -1,7 +0,0 @@
|
||||
.vscode/
|
||||
docs/
|
||||
examples/
|
||||
web-dist/
|
||||
src/
|
||||
.travis.yml
|
||||
TODO.md
|
||||
19
.travis.yml
19
.travis.yml
@@ -1,12 +1,7 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- stable
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
before_install: npm install -g grunt-cli eslint
|
||||
install: npm install
|
||||
before_script: grunt --dev
|
||||
language: node_js
|
||||
node_js:
|
||||
- "6"
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
install: npm install
|
||||
|
||||
30
.vscode/launch.json
vendored
30
.vscode/launch.json
vendored
@@ -1,30 +0,0 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"program": "./entrypoint.js",
|
||||
"stopOnEntry": false,
|
||||
"args": [],
|
||||
"cwd": ".",
|
||||
"runtimeExecutable": null,
|
||||
"runtimeArgs": [
|
||||
"--nolazy"
|
||||
],
|
||||
"env": {
|
||||
"NODE_ENV": "development"
|
||||
},
|
||||
"externalConsole": false,
|
||||
"sourceMaps": false,
|
||||
"outDir": null
|
||||
},
|
||||
{
|
||||
"name": "Attach",
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"port": 5858
|
||||
}
|
||||
]
|
||||
}
|
||||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -1,5 +0,0 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"editor.wrappingColumn": 0,
|
||||
"editor.formatOnType": true
|
||||
}
|
||||
220
.vscode/tasks.json
vendored
220
.vscode/tasks.json
vendored
@@ -1,220 +0,0 @@
|
||||
// Available variables which can be used inside of strings.
|
||||
// ${workspaceRoot}: the root folder of the team
|
||||
// ${file}: the current opened file
|
||||
// ${fileBasename}: the current opened file's basename
|
||||
// ${fileDirname}: the current opened file's dirname
|
||||
// ${fileExtname}: the current opened file's extension
|
||||
// ${cwd}: the current working directory of the spawned process
|
||||
|
||||
// A task runner that calls the Typescript compiler (tsc) and
|
||||
// Compiles a HelloWorld.ts program
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command" : "babel",
|
||||
"isShellCommand": true,
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "watch",
|
||||
"suppressTaskName": true,
|
||||
"isBuildCommand": true,
|
||||
"isWatching": true,
|
||||
"args": [
|
||||
"src", "--out-dir", "lib", "-w", "--loose=all"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
// A task runner that calls the Typescript compiler (tsc) and
|
||||
// compiles based on a tsconfig.json file that is present in
|
||||
// the root of the folder open in VSCode
|
||||
/*
|
||||
{
|
||||
"version": "0.1.0",
|
||||
|
||||
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
|
||||
"command": "tsc",
|
||||
|
||||
// The command is a shell script
|
||||
"isShellCommand": true,
|
||||
|
||||
// Show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
|
||||
// Tell the tsc compiler to use the tsconfig.json from the open folder.
|
||||
"args": ["-p", "."],
|
||||
|
||||
// use the standard tsc problem matcher to find compile problems
|
||||
// in the output.
|
||||
"problemMatcher": "$tsc"
|
||||
}
|
||||
*/
|
||||
|
||||
// A task runner configuration for gulp. Gulp provides a less task
|
||||
// which compiles less to css.
|
||||
/*
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "gulp",
|
||||
"isShellCommand": true,
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "less",
|
||||
// Make this the default build command.
|
||||
"isBuildCommand": true,
|
||||
// Show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
// Use the standard less compilation problem matcher.
|
||||
"problemMatcher": "$lessCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
// Uncomment the following section to use gulp in a watching mode that compiles a
|
||||
// less file. The gulp task prints "[hh:mm:ss] Starting 'clean-styles'" to the console
|
||||
// when existing css files get deleted and "[hh:mm:ss] Finished 'styles'" when the
|
||||
// overall less compilation has finished. When the clean pattern is detect internal less
|
||||
// problems are cleaned. When the finshed pattern is detected in the output less
|
||||
// problems are published.
|
||||
/*
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "gulp",
|
||||
"isShellCommand": true,
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "watch-less",
|
||||
// Make this the default build command.
|
||||
"isBuildCommand": true,
|
||||
// Show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
// Task is running in watching mode.
|
||||
"isWatching": true,
|
||||
"problemMatcher": {
|
||||
// Use the standard less compilation problem matcher as the base.
|
||||
"base": "$lessCompile",
|
||||
// A regular expression signalling that a watched task begins executing (usually triggered through file watching).
|
||||
"watchedTaskBeginsRegExp": "^\\[\\d+:\\d+:\\d+\\] Starting 'clean-styles'\\.\\.\\.$",
|
||||
// A regular expression signalling that a watched tasks ends executing.
|
||||
"watchedTaskEndsRegExp": "^\\[\\d+:\\d+:\\d+\\] Finished 'styles' after \\d+"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
// Uncomment the following section to use jake to build a workspace
|
||||
// cloned from https://github.com/Microsoft/TypeScript.git
|
||||
/*
|
||||
{
|
||||
"version": "0.1.0",
|
||||
// Task runner is jake
|
||||
"command": "jake",
|
||||
// Need to be executed in shell / cmd
|
||||
"isShellCommand": true,
|
||||
"showOutput": "silent",
|
||||
"tasks": [
|
||||
{
|
||||
// TS build command is local.
|
||||
"taskName": "local",
|
||||
// Make this the default build command.
|
||||
"isBuildCommand": true,
|
||||
// Show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
// Use the redefined Typescript output problem matcher.
|
||||
"problemMatcher": [
|
||||
"$tsc"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
// Uncomment the section below to use msbuild and generate problems
|
||||
// for csc, cpp, tsc and vb. The configuration assumes that msbuild
|
||||
// is available on the path and a solution file exists in the
|
||||
// workspace folder root.
|
||||
/*
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "msbuild",
|
||||
"args": [
|
||||
// Ask msbuild to generate full paths for file names.
|
||||
"/property:GenerateFullPaths=true"
|
||||
],
|
||||
"taskSelector": "/t:",
|
||||
"showOutput": "silent",
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "build",
|
||||
// Show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
// Use the standard MS compiler pattern to detect errors, warnings
|
||||
// and infos in the output.
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
// Uncomment the following section to use msbuild which compiles Typescript
|
||||
// and less files.
|
||||
/*
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "msbuild",
|
||||
"args": [
|
||||
// Ask msbuild to generate full paths for file names.
|
||||
"/property:GenerateFullPaths=true"
|
||||
],
|
||||
"taskSelector": "/t:",
|
||||
"showOutput": "silent",
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "build",
|
||||
// Show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
// Use the standard MS compiler pattern to detect errors, warnings
|
||||
// and infos in the output.
|
||||
"problemMatcher": [
|
||||
"$msCompile",
|
||||
"$lessCompile"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
// A task runner example that defines a problemMatcher inline instead of using
|
||||
// a predfined one.
|
||||
/*
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "tsc",
|
||||
"isShellCommand": true,
|
||||
"args": ["HelloWorld.ts"],
|
||||
"showOutput": "silent",
|
||||
"problemMatcher": {
|
||||
// The problem is owned by the typescript language service. Ensure that the problems
|
||||
// are merged with problems produced by Visual Studio's language service.
|
||||
"owner": "typescript",
|
||||
// The file name for reported problems is relative to the current working directory.
|
||||
"fileLocation": ["relative", "${cwd}"],
|
||||
// The actual pattern to match problems in the output.
|
||||
"pattern": {
|
||||
// The regular expression. Matches HelloWorld.ts(2,10): error TS2339: Property 'logg' does not exist on type 'Console'.
|
||||
"regexp": "^([^\\s].*)\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$",
|
||||
// The match group that denotes the file containing the problem.
|
||||
"file": 1,
|
||||
// The match group that denotes the problem location.
|
||||
"location": 2,
|
||||
// The match group that denotes the problem's severity. Can be omitted.
|
||||
"severity": 3,
|
||||
// The match group that denotes the problem code. Can be omitted.
|
||||
"code": 4,
|
||||
// The match group that denotes the problem's message.
|
||||
"message": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
14
CONTRIBUTING.md
Normal file
14
CONTRIBUTING.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Contributing
|
||||
If you wish to contribute to the discord.js codebase or documentation, feel free to fork the repository and submit a
|
||||
pull request. We use ESLint to enforce a consistent coding style, so having that set up in your editor of choice
|
||||
is a great boon to your coding process.
|
||||
|
||||
## Setup
|
||||
To get ready to work on the codebase, please do the following:
|
||||
|
||||
1. Fork & clone the repository
|
||||
2. Run `npm install`, or `npm install --no-optional` if you're not working on voice
|
||||
3. Code your heart out!
|
||||
4. Run `npm test` to run ESLint
|
||||
5. Run `npm run docs` to build any documentation changes
|
||||
6. [Submit a pull request](https://github.com/hydrabolt/discord.js/compare)
|
||||
1
LICENSE
1
LICENSE
@@ -199,4 +199,3 @@
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
150
README.md
150
README.md
@@ -1,94 +1,56 @@
|
||||
<p align="center">
|
||||
<a href="https://hydrabolt.github.io/discord.js">
|
||||
<img alt="discord.js" src="http://hydrabolt.github.io/discord.js/res/logo.png" width="546">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# Did v5.0.0 break your code? [Look here.](http://discordjs.readthedocs.org/en/latest/migrating.html)
|
||||
|
||||
[](https://travis-ci.org/hydrabolt/discord.js) [](http://discordjs.readthedocs.org/en/latest/?badge=latest)
|
||||
|
||||
[](https://nodei.co/npm/discord.js/)
|
||||
|
||||
|
||||
discord.js is a node module used as a way of interfacing with [Discord](https://discordapp.com/). It is a very useful module for creating bots.
|
||||
|
||||
**The examples in the repo are in ES6**
|
||||
|
||||
### Installation
|
||||
`npm install --save discord.js`
|
||||
|
||||
---
|
||||
|
||||
### Example: ping-pong
|
||||
```js
|
||||
var Discord = require("discord.js");
|
||||
|
||||
var mybot = new Discord.Client();
|
||||
|
||||
mybot.on("message", function(message){
|
||||
if(message.content === "ping")
|
||||
mybot.reply(message, "pong");
|
||||
});
|
||||
|
||||
mybot.login("email", "password");
|
||||
```
|
||||
---
|
||||
|
||||
### What's new in 5.0.0?
|
||||
|
||||
Stability in general! The API has been rewritten completely for much better stability, and it seems to have worked! There are now no random crashes and everything caches properly. The API is also a bit cleaner!
|
||||
|
||||
However, it is a breaking change if you are updating (potentially, basic code should be fine) you should look [here](http://discordjs.readthedocs.org/en/rewrite-docs/migrating.html) for help updating.
|
||||
|
||||
---
|
||||
|
||||
### Related Projects
|
||||
|
||||
Here is a list of other Discord APIs:
|
||||
|
||||
#### Java:
|
||||
[Discord4J](https://github.com/nerd/Discord4J)
|
||||
|
||||
#### .NET:
|
||||
[Discord.Net](https://github.com/RogueException/Discord.Net)
|
||||
|
||||
[DiscordSharp](https://github.com/Luigifan/DiscordSharp)
|
||||
|
||||
#### NodeJS
|
||||
[discord.io](https://github.com/izy521/node-discord) (similar to discord.js but lower level)
|
||||
|
||||
[discordie](https://github.com/qeled/discordie)
|
||||
|
||||
#### PHP
|
||||
[DiscordPHP](https://github.com/teamreflex/DiscordPHP)
|
||||
|
||||
#### Python
|
||||
[discord.py](https://github.com/Rapptz/discord.py)
|
||||
|
||||
#### Ruby
|
||||
[discordrb](https://github.com/meew0/discordrb)
|
||||
|
||||
---
|
||||
|
||||
### Links
|
||||
**[Documentation](http://discordjs.readthedocs.org/en/latest/)**
|
||||
|
||||
**[GitHub](https://github.com/discord-js/discord.js)**
|
||||
|
||||
**[Wiki](https://github.com/discord-js/discord.js/wiki)**
|
||||
|
||||
**[Website](http://discord-js.github.io/)**
|
||||
|
||||
**[NPM](http://npmjs.com/package/discord.js)**
|
||||
|
||||
---
|
||||
|
||||
### Contact
|
||||
|
||||
If you have an issue or want to know if a feature exists, [read the documentation](http://discordjs.readthedocs.org/en/latest/) before contacting me about any issues! If it's badly/wrongly implemented, let me know!
|
||||
|
||||
|
||||
If you would like to contact me, you can create an issue on the GitHub repo, e-mail me via the one available on my NPM profile.
|
||||
|
||||
Alternatively, you could just send a DM to **hydrabolt** in [**Discord API**](https://discord.gg/0SBTUU1wZTYd2XyW).
|
||||
<p align="center">
|
||||
<a href="https://hydrabolt.github.io/discord.js">
|
||||
<img alt="discord.js" src="http://i.imgur.com/sPOLh9y.png" width="546"><br />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
[](https://discord.gg/bRCvFy9)
|
||||
[](https://www.npmjs.com/package/discord.js)
|
||||
[](https://www.npmjs.com/package/discord.js)
|
||||
[](https://travis-ci.org/hydrabolt/discord.js)
|
||||
[](https://david-dm.org/hydrabolt/discord.js)
|
||||
|
||||
[](https://nodei.co/npm/discord.js/)
|
||||
|
||||
discord.js is a powerful node.js module that allows you to interact with the [Discord API](https://discordapp.com/developers/docs/intro).
|
||||
|
||||
## Installation
|
||||
**Node.js 6.0.0 or newer is required.**
|
||||
With voice support: `npm install --save discord.js --production`
|
||||
Without voice support: `npm install --save discord.js --production --no-optional`
|
||||
|
||||
By default, discord.js uses [opusscript](https://www.npmjs.com/package/opusscript) when playing audio over voice connections.
|
||||
If you're looking to play over multiple voice connections, it might be better to install [node-opus](https://www.npmjs.com/package/node-opus).
|
||||
discord.js will automatically prefer node-opus over opusscript.
|
||||
|
||||
## Example Usage
|
||||
```js
|
||||
const Discord = require('discord.js');
|
||||
const client = new Discord.Client();
|
||||
|
||||
client.on('ready', () => {
|
||||
console.log('I am ready!');
|
||||
});
|
||||
|
||||
client.on('message', message => {
|
||||
if (message.content === 'ping') {
|
||||
message.reply('pong');
|
||||
}
|
||||
});
|
||||
|
||||
client.login('your token');
|
||||
```
|
||||
|
||||
## Links
|
||||
* [Website](http://hydrabolt.github.io/discord.js/)
|
||||
* [Discord Server](https://discord.gg/bRCvFy9)
|
||||
* [Documentation](http://hydrabolt.github.io/discord.js/#!/docs/tag/master)
|
||||
* [Legacy Documentation](http://discordjs.readthedocs.io/en/8.1.0/docs_client.html)
|
||||
* [GitHub](https://github.com/hydrabolt/discord.js)
|
||||
* [NPM](https://www.npmjs.com/package/discord.js)
|
||||
* [Examples](https://github.com/hydrabolt/discord.js/tree/master/docs/custom/examples)
|
||||
* [Related Libraries](https://discordapi.com/unofficial/libs.html)
|
||||
|
||||
## Contact
|
||||
Before reporting an issue, please read the [documentation](http://hydrabolt.github.io/discord.js/#!/docs/tag/master).
|
||||
If you can't find help there, you can ask in the official [Discord.js Server](https://discord.gg/bRCvFy9).
|
||||
|
||||
8
TODO.md
8
TODO.md
@@ -1,8 +0,0 @@
|
||||
# Things yet to be implemented:
|
||||
|
||||
* Unbanning
|
||||
* Re-ordering of roles (no effect, just aesthetics)
|
||||
* Normalising attachments and embeds of messages
|
||||
* Normalising parameter types
|
||||
* More Documentation
|
||||
* Voice Chat
|
||||
192
docs/Makefile
192
docs/Makefile
@@ -1,192 +0,0 @@
|
||||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = _build
|
||||
|
||||
# User-friendly check for sphinx-build
|
||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||
endif
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " applehelp to make an Apple Help Book"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " xml to make Docutils-native XML files"
|
||||
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
@echo " coverage to run coverage check of the documentation (if enabled)"
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/discordjs.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/discordjs.qhc"
|
||||
|
||||
applehelp:
|
||||
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
|
||||
@echo
|
||||
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
|
||||
@echo "N.B. You won't be able to view it unless you put it in" \
|
||||
"~/Library/Documentation/Help or install it in your application" \
|
||||
"bundle."
|
||||
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/discordjs"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/discordjs"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
latexpdfja:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
||||
|
||||
coverage:
|
||||
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
|
||||
@echo "Testing of coverage in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/coverage/python.txt."
|
||||
|
||||
xml:
|
||||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||
@echo
|
||||
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||
|
||||
pseudoxml:
|
||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||
@echo
|
||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
||||
292
docs/conf.py
292
docs/conf.py
@@ -1,292 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# discord.js documentation build configuration file, created by
|
||||
# sphinx-quickstart on Fri Sep 25 17:25:49 2015.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import shlex
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = []
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
# source_suffix = ['.rst', '.md']
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'discord.js'
|
||||
copyright = u'2015, hydrabolt'
|
||||
author = u'hydrabolt'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '5.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '5.0.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||
#keep_warnings = False
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = False
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'default'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
#html_static_path = ['_static']
|
||||
|
||||
# Add any extra paths that contain custom files (such as robots.txt or
|
||||
# .htaccess) here, relative to this directory. These files are copied
|
||||
# directly to the root of the documentation.
|
||||
#html_extra_path = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Language to be used for generating the HTML full-text search index.
|
||||
# Sphinx supports the following languages:
|
||||
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
|
||||
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
|
||||
#html_search_language = 'en'
|
||||
|
||||
# A dictionary with options for the search language support, empty by default.
|
||||
# Now only 'ja' uses this config value
|
||||
#html_search_options = {'type': 'default'}
|
||||
|
||||
# The name of a javascript file (relative to the configuration directory) that
|
||||
# implements a search results scorer. If empty, the default will be used.
|
||||
#html_search_scorer = 'scorer.js'
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'discordjsdoc'
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#'figure_align': 'htbp',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'discordjs.tex', u'discord.js Documentation',
|
||||
u'hydrabolt', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'discordjs', u'discord.js Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'discordjs', u'discord.js Documentation',
|
||||
author, 'discordjs', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
||||
|
||||
if not os.environ.get('READTHEDOCS', None) == 'True':
|
||||
try:
|
||||
import sphinx_rtd_theme
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
except ImportError:
|
||||
print("sphinx_rtd_theme not found! Do 'pip install sphinx_rtd_theme' to make local builds use the RTD theme.")
|
||||
10
docs/custom/avatar.js
Normal file
10
docs/custom/avatar.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
category: 'Examples',
|
||||
name: 'Avatars',
|
||||
data:
|
||||
`\`\`\`js
|
||||
${fs.readFileSync('./docs/custom/examples/avatar.js').toString('utf-8')}
|
||||
\`\`\``,
|
||||
};
|
||||
40
docs/custom/documents/updating.md
Normal file
40
docs/custom/documents/updating.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# About Version 9
|
||||
The version 9 (v9) rewrite takes a much more object-oriented approach than previous versions,
|
||||
which allows your code to be much more readable and manageable.
|
||||
It's been rebuilt from the ground up and should be much more stable, fixing caching issues that affected
|
||||
older versions. It also has support for newer Discord Features, such as emojis.
|
||||
|
||||
## Upgrading your code
|
||||
Version 9, while containing a sizable number of breaking changes, does not require much change in your code's logic -
|
||||
most of the concepts are still the same, but loads of functions have been moved around.
|
||||
The vast majority of methods you're used to using have been moved out of the Client class,
|
||||
into other more relevant classes where they belong.
|
||||
Because of this, you will need to convert most of your calls over to the new methods.
|
||||
|
||||
Here are a few examples of methods that have changed:
|
||||
* `Client.sendMessage(channel, message)` ==> `TextChannel.sendMessage(message)`
|
||||
* `Client.sendMessage(user, message)` ==> `User.sendMessage(message)`
|
||||
* `Client.updateMessage(message, "New content")` ==> `Message.edit("New Content")`
|
||||
* `Client.getChannelLogs(channel, limit)` ==> `TextChannel.fetchMessages({options})`
|
||||
* `Server.detailsOfUser(User)` ==> `Server.members.get(User).properties` (retrieving a member gives a GuildMember object)
|
||||
* `Client.joinVoiceChannel(voicechannel)` => `VoiceChannel.join()`
|
||||
|
||||
A couple more important details:
|
||||
* `Client.loginWithToken("token")` ==> `client.login("token")`
|
||||
* `Client.servers.length` ==> `client.guilds.size` (all instances of `server` are now `guild`)
|
||||
|
||||
## Callbacks
|
||||
Version 9 eschews callbacks in favour of Promises. This means all code relying on callbacks must be changed.
|
||||
For example, the following code:
|
||||
|
||||
```js
|
||||
client.getChannelLogs(channel, 100, function(messages) {
|
||||
console.log(`${messages.length} messages found`);
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
channel.fetchMessages({limit: 100}).then(messages => {
|
||||
console.log(`${messages.size} messages found`);
|
||||
});
|
||||
```
|
||||
46
docs/custom/documents/welcome.md
Normal file
46
docs/custom/documents/welcome.md
Normal file
@@ -0,0 +1,46 @@
|
||||
<p align="center">
|
||||
<a href="https://hydrabolt.github.io/discord.js">
|
||||
<img alt="discord.js" src="http://i.imgur.com/sPOLh9y.png" width="546"><br />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
[](https://discord.gg/bRCvFy9)
|
||||
[](https://www.npmjs.com/package/discord.js)
|
||||
[](https://www.npmjs.com/package/discord.js)
|
||||
[](https://travis-ci.org/hydrabolt/discord.js)
|
||||
[](https://david-dm.org/hydrabolt/discord.js)
|
||||
|
||||
[](https://nodei.co/npm/discord.js/)
|
||||
|
||||
discord.js is a powerful node.js module that allows you to interact with the [Discord API](https://discordapp.com/developers/docs/intro).
|
||||
|
||||
# Welcome!
|
||||
Welcome to the discord.js v9 documentation. The v9 rewrite has taken a lot of time, but it should be much more
|
||||
stable and performant than previous versions.
|
||||
|
||||
## Installation
|
||||
**Node.js 6.0.0 or newer is required.**
|
||||
With voice support: `npm install --save discord.js --production`
|
||||
Without voice support: `npm install --save discord.js --production --no-optional`
|
||||
|
||||
By default, discord.js uses [opusscript](https://www.npmjs.com/package/opusscript) when playing audio over voice connections.
|
||||
If you're looking to play over multiple voice connections, it might be better to install [node-opus](https://www.npmjs.com/package/node-opus).
|
||||
discord.js will automatically prefer node-opus over opusscript.
|
||||
|
||||
## Guides
|
||||
* [LuckyEvie's general guide](https://eslachance.gitbooks.io/discord-js-bot-guide/content/)
|
||||
* [York's v9 upgrade guide](https://yorkaargh.wordpress.com/2016/09/03/updating-discord-js-bots/)
|
||||
|
||||
## Links
|
||||
* [Website](http://hydrabolt.github.io/discord.js/)
|
||||
* [Discord Server](https://discord.gg/bRCvFy9)
|
||||
* [Documentation](http://hydrabolt.github.io/discord.js/#!/docs/tag/master)
|
||||
* [Legacy Documentation](http://discordjs.readthedocs.io/en/8.1.0/docs_client.html)
|
||||
* [GitHub](https://github.com/hydrabolt/discord.js)
|
||||
* [NPM](https://www.npmjs.com/package/discord.js)
|
||||
* [Examples](https://github.com/hydrabolt/discord.js/tree/master/docs/custom/examples)
|
||||
* [Related Libraries](https://discordapi.com/unofficial/libs.html)
|
||||
|
||||
## Help
|
||||
If you don't understand something in this documentation, you are experiencing problems, or you just need a gentle
|
||||
nudge in the right direction, please don't hesitate to join our official [Discord.js Server](https://discord.gg/bRCvFy9).
|
||||
30
docs/custom/examples/avatar.js
Normal file
30
docs/custom/examples/avatar.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
Send a user a link to their avatar
|
||||
*/
|
||||
|
||||
// import the discord.js module
|
||||
const Discord = require('discord.js');
|
||||
|
||||
// create an instance of a Discord Client, and call it bot
|
||||
const bot = new Discord.Client();
|
||||
|
||||
// the token of your bot - https://discordapp.com/developers/applications/me
|
||||
const token = 'your bot token here';
|
||||
|
||||
// the ready event is vital, it means that your bot will only start reacting to information
|
||||
// from Discord _after_ ready is emitted.
|
||||
bot.on('ready', () => {
|
||||
console.log('I am ready!');
|
||||
});
|
||||
|
||||
// create an event listener for messages
|
||||
bot.on('message', message => {
|
||||
// if the message is "what is my avatar",
|
||||
if (message.content === 'what is my avatar') {
|
||||
// send the user's avatar URL
|
||||
message.reply(message.author.avatarURL);
|
||||
}
|
||||
});
|
||||
|
||||
// log our bot in
|
||||
bot.login(token);
|
||||
30
docs/custom/examples/ping_pong.js
Normal file
30
docs/custom/examples/ping_pong.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
A ping pong bot, whenever you send "ping", it replies "pong".
|
||||
*/
|
||||
|
||||
// import the discord.js module
|
||||
const Discord = require('discord.js');
|
||||
|
||||
// create an instance of a Discord Client, and call it bot
|
||||
const bot = new Discord.Client();
|
||||
|
||||
// the token of your bot - https://discordapp.com/developers/applications/me
|
||||
const token = 'your bot token here';
|
||||
|
||||
// the ready event is vital, it means that your bot will only start reacting to information
|
||||
// from Discord _after_ ready is emitted.
|
||||
bot.on('ready', () => {
|
||||
console.log('I am ready!');
|
||||
});
|
||||
|
||||
// create an event listener for messages
|
||||
bot.on('message', message => {
|
||||
// if the message is "ping",
|
||||
if (message.content === 'ping') {
|
||||
// send "pong" to the same channel.
|
||||
message.channel.sendMessage('pong');
|
||||
}
|
||||
});
|
||||
|
||||
// log our bot in
|
||||
bot.login(token);
|
||||
17
docs/custom/index.js
Normal file
17
docs/custom/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const files = [
|
||||
require('./welcome'),
|
||||
require('./updating'),
|
||||
require('./ping_pong'),
|
||||
require('./avatar'),
|
||||
];
|
||||
|
||||
const categories = {};
|
||||
for (const file of files) {
|
||||
file.category = file.category.toLowerCase();
|
||||
if (!categories[file.category]) {
|
||||
categories[file.category] = [];
|
||||
}
|
||||
categories[file.category].push(file);
|
||||
}
|
||||
|
||||
module.exports = categories;
|
||||
10
docs/custom/ping_pong.js
Normal file
10
docs/custom/ping_pong.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
category: 'Examples',
|
||||
name: 'Ping Pong',
|
||||
data:
|
||||
`\`\`\`js
|
||||
${fs.readFileSync('./docs/custom/examples/ping_pong.js').toString('utf-8')}
|
||||
\`\`\``,
|
||||
};
|
||||
7
docs/custom/updating.js
Normal file
7
docs/custom/updating.js
Normal file
@@ -0,0 +1,7 @@
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
category: 'General',
|
||||
name: 'Updating your code',
|
||||
data: fs.readFileSync('./docs/custom/documents/updating.md').toString('utf-8'),
|
||||
};
|
||||
7
docs/custom/welcome.js
Normal file
7
docs/custom/welcome.js
Normal file
@@ -0,0 +1,7 @@
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
category: 'General',
|
||||
name: 'Welcome',
|
||||
data: fs.readFileSync('./docs/custom/documents/welcome.md').toString('utf-8'),
|
||||
};
|
||||
1
docs/docs.json
Normal file
1
docs/docs.json
Normal file
File diff suppressed because one or more lines are too long
@@ -1,51 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Cache
|
||||
=====
|
||||
|
||||
**extends Array**
|
||||
|
||||
A Cache object extends an Array (so it can be used like a regular array) but introduces helper functions to make it more useful when developing with discord.js. Unlike a regular array, it doesn't care about the instance or prototype of an object, it works purely on properties.
|
||||
|
||||
**Examples:**
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
client.users.get("id", 11238414);
|
||||
|
||||
client.channels.getAll("name", "general");
|
||||
|
||||
--------
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
get(key, value)
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Returns a contained object where ``object[key] == value``. Returns the first object found that matches the criteria.
|
||||
|
||||
getAll(key, value)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Similar to ``cache.get(key, value)``, but returns a Cache of any objects that meet the criteria.
|
||||
|
||||
has(key, value)
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Returns `true` if there is an object that meets the condition ``object[key] == value`` in the cache
|
||||
|
||||
add(data)
|
||||
~~~~~~~~~
|
||||
|
||||
Adds an object to the Cache as long as all the other objects in the cache don't have the same ID as it.
|
||||
|
||||
update(old, data)
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Updates an old object in the Cache (if it exists) with the new one.
|
||||
|
||||
remove(data)
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Removes an object from the cache if it exists.
|
||||
@@ -1,28 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Channel
|
||||
=======
|
||||
|
||||
**extends** Equality_
|
||||
|
||||
The Channel class is the base class for all types of channel.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
id
|
||||
~~
|
||||
|
||||
The ID of the channel, a `String`.
|
||||
|
||||
client
|
||||
~~~~~~
|
||||
|
||||
The Client_ that cached the channel.
|
||||
|
||||
isPrivate
|
||||
~~~~~~~~~
|
||||
|
||||
Indicates whether the channel is PM channel, is `Boolean`.
|
||||
@@ -1,42 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
ChannelPermissions
|
||||
==================
|
||||
|
||||
ChannelPermissions is used to represent the final permissions of a user in a channel, to see exactly what they are and aren't allowed to do.
|
||||
|
||||
**Examples:**
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
var user_permissions = channel.permissionsOf(user);
|
||||
|
||||
var can_mention_everyone = user_permissions.hasPermission("mentionEveryone");
|
||||
|
||||
--------
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
serialize()
|
||||
~~~~~~~~~~~
|
||||
|
||||
**Aliases:** `serialise`
|
||||
|
||||
Returns an object containing permission names and values. E.g:
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
{
|
||||
createInstantInvite : true,
|
||||
kickMembers : false
|
||||
}
|
||||
|
||||
For more on valid permission names, see `Permission Constants`_.
|
||||
|
||||
hasPermission(permission)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sees whether the user has the permission given.
|
||||
|
||||
- **permission** - See `Permission Constants`_ for valid permission names.
|
||||
@@ -1,652 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Client
|
||||
======
|
||||
|
||||
**extends** EventEmitter_
|
||||
|
||||
This page contains documentation on the `Discord.Client` class. This should be used when you want to start creating things with the API.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
users
|
||||
~~~~~
|
||||
|
||||
A Cache_ of User_ objects that the client has cached.
|
||||
|
||||
channels
|
||||
~~~~~~~~
|
||||
|
||||
A Cache_ of ServerChannel_ objects that the client has cached.
|
||||
|
||||
privateChannels
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
A Cache_ of PMChannel_ objects that the client has cached. These are all the Private/Direct Chats the client is in.
|
||||
|
||||
servers
|
||||
~~~~~~~
|
||||
|
||||
A Cache_ of Server_ objects that the client has cached.
|
||||
|
||||
voiceConnection
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
A VoiceConnection_ object that is the current voice connection (if any).
|
||||
|
||||
readyTime
|
||||
~~~~~~~~~
|
||||
|
||||
A `Number` unix timestamp dating to when the Client emitted `ready`.
|
||||
|
||||
uptime
|
||||
~~~~~~
|
||||
|
||||
A `Number` in milliseconds representing how long the Client has been ready for.
|
||||
|
||||
user
|
||||
~~~~
|
||||
|
||||
A User_ object representing the logged in client's user.
|
||||
|
||||
-----
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
.. note :: Any functions used here that take callbacks as an optional parameter can also be used as Promises_. Promises take the exact same parameters for each use case, except errors are moved to catch statements instead of then. For example, you can do:
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
bot.login(email, password).then(success).catch(err);
|
||||
|
||||
function success(token){
|
||||
// handle success
|
||||
}
|
||||
|
||||
function err(error){
|
||||
// handle error
|
||||
}
|
||||
|
||||
or use callbacks:
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
bot.login(email, password, function(error, token){
|
||||
// handle error and success
|
||||
});
|
||||
|
||||
login(email, password, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Logs the client in so it can begin initialising. Use this `after` registering your events to ensure they are called!
|
||||
|
||||
- **email** - The e-mail used to sign in, `String`.
|
||||
- **password** - The password used to sign in, `String`.
|
||||
- **callback** - `function` that takes the following parameters:
|
||||
- **error** - An error if any occurred
|
||||
- **token** - The token received after logging in, `String`.
|
||||
|
||||
logout(`callback`)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Logs the client out and closes the WebSocket connections.
|
||||
|
||||
- **callback** - `function` that takes the following parameter:
|
||||
- **error** - An error if any occurred
|
||||
|
||||
sendMessage(channel, content, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sends a message to the specified channel.
|
||||
|
||||
- **channel** - a `Channel Resolvable`_
|
||||
- **content** - a `String Resolvable`_ - the message you want to send
|
||||
- **options** - `object` containing:
|
||||
- **tts** - `Boolean`, should message be text-to-speech
|
||||
- **callback** - `function` that takes the following parameters:
|
||||
- **error** - error object if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
sendFile(channel, attachment, name, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sends a file to the specified channel.
|
||||
|
||||
- **channel** - a `Channel Resolvable`_
|
||||
- **attachment** - A ReadableStream, String or Buffer
|
||||
- **name** - `String`, name of the file containing the extension
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
reply(message, content, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Shortcut to `sendMessage` but prepends a mention to the sender of the original message to the start of your message.
|
||||
|
||||
- **message** - The Message_ to reply to
|
||||
- **content** - a `String Resolvable`_ - the message you want to send
|
||||
- **options** - `object` containing:
|
||||
- **tts** - `Boolean`, should message be text-to-speech
|
||||
- **callback** - `function` that takes the following parameters:
|
||||
- **error** - error object if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
updateMessage(message, content, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Updates the content of a previously sent message
|
||||
|
||||
- **message** - The Message_ to update
|
||||
- **content** - a `String Resolvable`_ - the content you want to update the message with
|
||||
- **options** - `object` containing:
|
||||
- **tts** - `Boolean`, should message be text-to-speech
|
||||
- **callback** - `function` that takes the following parameters:
|
||||
- **error** - error object if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
deleteMessage(message, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Attempts to delete a message
|
||||
|
||||
- **message** - The Message_ to delete
|
||||
- **options** - `object` containing the following:
|
||||
- **wait** - Milliseconds as a `number` to wait before deleting the message
|
||||
- **callback**
|
||||
- **error** - error object if any occurred
|
||||
|
||||
getChannelLogs(channel, `limit`, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Gets a list of previously sent messages in a channel.
|
||||
|
||||
- **channel** - The Channel_ to get messages from
|
||||
- **limit** - The maximum amount of messages to retrieve - defaults to 500. A `Number`
|
||||
- **options** - An `object` containing either of the following:
|
||||
- **before** - A `Message Resolvable`_ - gets messages before this message.
|
||||
- **after** - A `Message Resolvable`_ - gets messages after this message.
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **messages** - `array` of Message_ objects sent in channel
|
||||
|
||||
getBans(server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Gets a list of banned users in a server.
|
||||
|
||||
- **server** - `Server Resolvable`_ - The server to get banned users of
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **users** - `array` of banned users in the server
|
||||
|
||||
joinServer(invite, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Joins a server from the given invite
|
||||
|
||||
- **invite** - an `Invite Resolvable`_
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **server** - the joined Server_
|
||||
|
||||
createServer(name, region, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Creates a server
|
||||
|
||||
- **name** - `String`, name of the server
|
||||
- **region** - `String`, region of the server, currently **us-west, us-east, singapore, london, sydney** or **amsterdam**
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **server** - the created Server_
|
||||
|
||||
leaveServer(server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Leaves/deletes a server that the client is in
|
||||
|
||||
- **server** - a `Server Resolvable`_
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
createChannel(server, name, `type`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Creates a channel in a server
|
||||
|
||||
- **server** - a `Server Resolvable`_
|
||||
- **name** - `String`, name of the channel. Spaces not allowed.
|
||||
- **type** - defaults to `text`, but can also be `voice`
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **channel** - the created ServerChannel_
|
||||
|
||||
deleteChannel(channel, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Deletes a channel in a server.
|
||||
|
||||
- **channel** - a `Channel Resolvable`_ to delete
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
banMember(user, server, `length`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Bans a user from a server.
|
||||
|
||||
- **user** - A `User Resolvable`_ to ban
|
||||
- **server** - A `Server Resolvable`_ to ban the user from
|
||||
- **length** - `Number`, how many days to go back and delete messages from that user
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
unbanMember(user, server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Unbans a user from a server.
|
||||
|
||||
- **user** - A `User Resolvable`_ to unban
|
||||
- **server** - A `Server Resolvable`_ to unban the user from
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
kickMember(user, server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Removes a user from a server
|
||||
|
||||
- **user** - A `User Resolvable`_ to kick
|
||||
- **server** - A `Server Resolvable`_ to kick the user from
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
createInvite(channel, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Creates an invite for the specified channel (or server)
|
||||
|
||||
- **channel** - A `Channel Resolvable`_
|
||||
- **options** - `object` containing:
|
||||
- **maxAge** - `Number` for maximum time in seconds for invite's validity
|
||||
- **maxUses** - `Number`, maximum uses of invite
|
||||
- **temporary** - `Boolean`, whether the invite should be temporary
|
||||
- **xkcd** - `Boolean`, whether the invite should be human-readable-friendly.
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **invite** - the created Invite_
|
||||
|
||||
deleteInvite(invite, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Deletes an invite
|
||||
|
||||
- **invite** - An `Invite ID Resolvable`_
|
||||
- **callback** - a `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
setStatus(status, `game`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sets the Discord Status of the Client
|
||||
|
||||
- **status** - `String`, either ``online, here, active, available`` or ``idle, away``
|
||||
- **game** - `String/Number`, ID of Discord Game being played
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
setStatusIdle()
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
**Alias:** `setStatusAway`
|
||||
|
||||
Sets the status of the Client to Idle/Away
|
||||
|
||||
setStatusOnline()
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
**Aliases:** `setStatusHere`, `setStatusActive`, `setStatusAvailable`
|
||||
|
||||
Sets the status of the Client to Online
|
||||
|
||||
setTopic(channel, topic, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sets the topic of a channel
|
||||
|
||||
- **channel** - A `Channel Resolvable`_
|
||||
- **topic** - A `String`
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
setChannelName(channel, name, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sets the name of a channel
|
||||
|
||||
- **channel** - A `Channel Resolvable`_
|
||||
- **name** - A `String`
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
setChannelNameAndTopic(channel, name, topic, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sets the name and topic of a channel
|
||||
|
||||
- **channel** - A `Channel Resolvable`_
|
||||
- **name** - A `String`
|
||||
- **topic** - A `String`
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
startTyping(channel, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Marks the client as typing in a channel.
|
||||
|
||||
- **channel** - A `Channel Resolvable`_
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
stopTyping(channel, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Marks the client as not typing in a channel (takes a few seconds to go active).
|
||||
|
||||
- **channel** - A `Channel Resolvable`_
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
updateDetails(details, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Updates the details of the client
|
||||
|
||||
- **details** - `object` containing any of the following:
|
||||
- **avatar** - `Base64 Resolvable`_, new avatar of the client
|
||||
- **email** - `String`, new email of the client
|
||||
- **newPassword** - `String`, new password of the client
|
||||
- **username** - `String`, new username of the client
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
setAvatar(avatar, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sets the avatar of the client
|
||||
|
||||
- **avatar** - `Base64 Resolvable`_, new avatar of the client
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
setUsername(name, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sets the username of the client
|
||||
|
||||
- **username** - `String`, new username of the Client
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
joinVoiceChannel(channel, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Joins a Voice Channel to begin transmitting audio
|
||||
|
||||
- **channel** - A `VoiceChannel Resolvable`_
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
- **connection** - VoiceConnection_, the created Voice Connection.
|
||||
|
||||
leaveVoiceChannel(`callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Leaves the currently connected Voice Channel if connected
|
||||
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
createRole(server, `data`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Creates a new role in a server.
|
||||
|
||||
- **server** - a `Server Resolvable`_
|
||||
- **data** - `object` containing the structure below
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
- **role** - the created Role_
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
// structure of data parameter (all attrs optional):
|
||||
{
|
||||
color : 0xFF0000,
|
||||
hoist : false,
|
||||
name : "A New Role!",
|
||||
permissions : [
|
||||
// see the constants documentation for full permissions
|
||||
"attachFiles", "sendMessages"
|
||||
]
|
||||
}
|
||||
|
||||
updateRole(role, data, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Updates a role in a server.
|
||||
|
||||
- **role** - a Role_
|
||||
- **data** - an `object` taking the structure shown below
|
||||
- **callback** - a `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **role** - the updated Role_
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
// structure of data parameter (all attrs optional):
|
||||
{
|
||||
color : 0xFF0000,
|
||||
hoist : false,
|
||||
name : "A New Role!",
|
||||
permissions : [
|
||||
// see the constants documentation for full permissions
|
||||
"attachFiles", "sendMessages"
|
||||
]
|
||||
}
|
||||
|
||||
deleteRole(role, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Deletes a role from a server
|
||||
|
||||
- **role** - The Role_ to delete
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
addMemberToRole(member, role, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Aliases** : `addUserToRole`
|
||||
|
||||
Adds a member of a server to a role in the server
|
||||
|
||||
- **member** - A `User Resolvable`_
|
||||
- **role** - A Role_
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
removeMemberFromRole(member, role, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Aliases** : `removeUserFromRole`
|
||||
|
||||
Removes a member of a server from a role in the server
|
||||
|
||||
- **member** - A `User Resolvable`_
|
||||
- **role** - A Role_
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
overwritePermissions(channel, roleOrUser, options, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Overwrites the permissions of a role or a user in a channel
|
||||
|
||||
- **channel** - a `Channel Resolvable`_
|
||||
- **roleOrUser** - a Role_ or a User_ object
|
||||
- **options** - an `object` containing a structure as shown below
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
{
|
||||
"sendMessages" : false,
|
||||
"attachFiles" : true
|
||||
}
|
||||
|
||||
Events
|
||||
------
|
||||
|
||||
`Discord.Client` is an EventEmitter, so you can use `.on()` and `.off()` to add and remove events.
|
||||
|
||||
ready
|
||||
~~~~~
|
||||
|
||||
Emitted when the client is ready to use
|
||||
|
||||
debug
|
||||
~~~~~
|
||||
|
||||
Emitted when the client debugs or wants to log something internally
|
||||
|
||||
message
|
||||
~~~~~~~
|
||||
|
||||
Emitted when the client receives a message, supplies a Message_ object.
|
||||
|
||||
warn
|
||||
~~~~
|
||||
|
||||
Emitted when the client has encountered a small error that can be avoided.
|
||||
|
||||
messageDeleted
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a message has been deleted and the Client finds out, supplies a Message_ object IF available, and a Channel_ object.
|
||||
|
||||
messageUpdated
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a message has been updated and the client finds out. Supplies two Message_ objects, the first being the new updated messages, the latter being the old message.
|
||||
|
||||
disconnected
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Emitted when the client is disconnected from the Discord server.
|
||||
|
||||
error
|
||||
~~~~~
|
||||
|
||||
Emitted when the client runs into a big problem, supplies an error object.
|
||||
|
||||
raw
|
||||
~~~
|
||||
|
||||
Emitted when a message over WebSocket is received, it supplies one `object` containing the raw data from the WebSocket.
|
||||
|
||||
serverCreated
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a server is joined by the Client, supplies a Server_ object.
|
||||
|
||||
serverDeleted
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Emitted when the client leaves a server, supplies a Server_ object.
|
||||
|
||||
serverUpdated
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a server is updated (e.g. name change). Supplies two Server_ objects, the first being the server before the update, the second being the new, updated server.
|
||||
|
||||
channelCreated
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a channel is created, supplies a Channel_ object (includes PM chats as well as server channels).
|
||||
|
||||
channelDeleted
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a channel is deleted, supplies a Channel_ object.
|
||||
|
||||
channelUpdated
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a channel is updated (e.g. name/topic change). Supplies a Channel_ object.
|
||||
|
||||
serverRoleCreated
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a role is created in a server, supplies a Role_ object.
|
||||
|
||||
serverRoleDeleted
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a role is deleted from a server, supplies a Role_ object.
|
||||
|
||||
serverRoleUpdated
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a role is updated in a server, supplies two Role_ objects. The first is the old role, the second is the updated role.
|
||||
|
||||
serverNewMember
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a user joins a server, supplies a Server_ object and a User_ object.
|
||||
|
||||
serverMemberRemoved
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a member is removed from a server. Supplies a Server_ object and a User_ object.
|
||||
|
||||
serverMemberUpdated
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a member in a server is updated. Supplies a Server_ object and a User_ object.
|
||||
|
||||
presence
|
||||
~~~~~~~~
|
||||
|
||||
Emitted when a user goes online/offline/idle or starts/stops playing a game. Supplies 3 parameters, the first being the User_ object, the second being the status, the third being the game ID they are playing.
|
||||
|
||||
userUpdated
|
||||
~~~~~~~~~~~
|
||||
|
||||
Emitted when a user changes their name, avatar or similar. Supplies two User_ objects, the first being the user before being updated, the second being the updated user.
|
||||
|
||||
userTypingStarted
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a user starts typing in a channel. Supplies two parameters, a User_ object and a Channel_ object.
|
||||
|
||||
userTypingStopped
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Emitted when a user stop typing in a channel. Supplies two parameters, a User_ object and a Channel_ object.
|
||||
|
||||
userBanned
|
||||
~~~~~~~~~~
|
||||
|
||||
Emitted when a user is banned from a server. Supplies two parameters, a User_ object and a Server_ object.
|
||||
|
||||
userUnbanned
|
||||
~~~~~~~~~~
|
||||
|
||||
Emitted when a user is unbanned from a server. Supplies two parameters, a User_ object and a Server_ object.
|
||||
@@ -1,26 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Equality
|
||||
========
|
||||
|
||||
The Equality class is used to see if two objects are equal, based on ``object_1.id === object_2.id``.
|
||||
|
||||
If any class in Discord extends equality, it means you should never the default equality operands (``==`` & ``===``) as they could potentially be different instances and therefore appear not to be equal. Instead, use ``equalityObject.equals()`` as shown below.
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
object1.equals(object2); // GOOD ✓
|
||||
|
||||
object1 == object2; // BAD ✖
|
||||
|
||||
--------
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
equals(object)
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Returns true if the specified object is the same as this one.
|
||||
|
||||
- **object** - Any `object` with an ``id`` property.
|
||||
@@ -1,66 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Invite
|
||||
======
|
||||
|
||||
Used to represent data of an invite.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
maxAge
|
||||
~~~~~~
|
||||
|
||||
`Number`, how long (in seconds) the invite has since creation before expiring.
|
||||
|
||||
code
|
||||
~~~~
|
||||
|
||||
`String`, the invite code.
|
||||
|
||||
server
|
||||
~~~~~~
|
||||
|
||||
The Server_ the invite is for.
|
||||
|
||||
channel
|
||||
~~~~~~~
|
||||
|
||||
The ServerChannel_ the invite is for.
|
||||
|
||||
revoked
|
||||
~~~~~~~
|
||||
|
||||
`Boolean`, whether the invite has been revoked or not.
|
||||
|
||||
createdAt
|
||||
~~~~~~~~~
|
||||
|
||||
`Number`, timestamp of when the invite was created.
|
||||
|
||||
temporary
|
||||
~~~~~~~~~
|
||||
|
||||
`Boolean`, whether the invite is temporary or not.
|
||||
|
||||
uses
|
||||
~~~~
|
||||
|
||||
`Number`, uses of the invite remaining.
|
||||
|
||||
maxUses
|
||||
~~~~~~~
|
||||
|
||||
`Number`, maximum uses of the invite.
|
||||
|
||||
inviter
|
||||
~~~~~~~
|
||||
|
||||
User_ who sent/created the invite.
|
||||
|
||||
xkcd
|
||||
~~~~
|
||||
|
||||
`Boolean`, whether the invite is intended to be easy to read and remember by a human.
|
||||
@@ -1,85 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Message
|
||||
=======
|
||||
|
||||
**extends** Equality_
|
||||
|
||||
A Message object is used to represent the data of a message.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
channel
|
||||
~~~~~~~
|
||||
|
||||
The channel the message sent in, either a TextChannel_ or PMChannel_.
|
||||
|
||||
client
|
||||
~~~~~~
|
||||
|
||||
The Client_ that cached the message.
|
||||
|
||||
attachments
|
||||
~~~~~~~~~~~
|
||||
|
||||
A raw array of attachment objects.
|
||||
|
||||
tts
|
||||
~~~
|
||||
|
||||
`Boolean`, true if the message was text-to-speech.
|
||||
|
||||
embeds
|
||||
~~~~~~
|
||||
|
||||
A raw array of embed objects.
|
||||
|
||||
timestamp
|
||||
~~~~~~~~~
|
||||
|
||||
`Number`, timestamp of when the message was sent.
|
||||
|
||||
everyoneMentioned
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
`Boolean`, true if ``@everyone`` was mentioned.
|
||||
|
||||
id
|
||||
~~
|
||||
|
||||
`String`, ID of the message.
|
||||
|
||||
editedTimestamp
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Timestamp on when the message was last edited, `Number`. Potentially null.
|
||||
|
||||
author
|
||||
~~~~~~
|
||||
|
||||
**Alias:** `sender`
|
||||
|
||||
The User_ that sent the message.
|
||||
|
||||
content
|
||||
~~~~~~~
|
||||
|
||||
`String`, content of the message.
|
||||
|
||||
mentions
|
||||
~~~~~~~~
|
||||
|
||||
A Cache_ of User_ objects that were mentioned in the message.
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
isMentioned(user)
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Returns true if the given user was mentioned in the message.
|
||||
|
||||
- **user** : A `User Resolvable`_
|
||||
@@ -1,55 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Permission Constants
|
||||
====================
|
||||
|
||||
In discord.js, you can handle permissions in two ways. The preferred way is to just use the string name of the permission, alternatively you can use ``Discord.Constants.Permissions["permission name"]``.
|
||||
|
||||
--------
|
||||
|
||||
Valid Permission Names
|
||||
----------------------
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
{
|
||||
// general
|
||||
createInstantInvite,
|
||||
kickMembers,
|
||||
banMembers,
|
||||
manageRoles,
|
||||
managePermissions,
|
||||
manageChannels,
|
||||
manageChannel,
|
||||
manageServer,
|
||||
// text
|
||||
readMessages,
|
||||
sendMessages,
|
||||
sendTTSMessages,
|
||||
manageMessages,
|
||||
embedLinks,
|
||||
attachFiles,
|
||||
readMessageHistory,
|
||||
mentionEveryone,
|
||||
// voice
|
||||
voiceConnect,
|
||||
voiceSpeak,
|
||||
voiceMuteMembers,
|
||||
voiceDeafenMembers,
|
||||
voiceMoveMembers,
|
||||
voiceUseVAD
|
||||
};
|
||||
|
||||
Preferred Way
|
||||
-------------
|
||||
|
||||
The preferred way of using permissions in discord.js is to just use the name. E.g:
|
||||
|
||||
``role.hasPermission("voiceUseVAD")``
|
||||
|
||||
Alternative
|
||||
-----------
|
||||
|
||||
You can also go the long way round and use the numerical permission like so:
|
||||
|
||||
``role.hasPermission( Discord.Constants.Permissions.voiceUseVAD )``
|
||||
@@ -1,31 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
PermissionOverwrite
|
||||
===================
|
||||
|
||||
PermissionOverwrite is used to represent data about permission overwrites for roles or users in channels.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
id
|
||||
~~
|
||||
|
||||
`String`, the ID of the PermissionOverwrite. If ``overwrite.type`` is ``role``, this is the role's ID. Otherwise, it is a User_ overwrite.
|
||||
|
||||
type
|
||||
~~~~
|
||||
|
||||
`String`, type of the overwrite. Either ``member`` or ``role``.
|
||||
|
||||
allowed
|
||||
~~~~~~~
|
||||
|
||||
Returns the permissions explicitly allowed by the overwrite. An `Array` of Strings, which are names of permissions. More can be found at `Permission Constants`_
|
||||
|
||||
denied
|
||||
~~~~~~
|
||||
|
||||
Returns the permissions explicitly denied by the overwrite. An `Array` of Strings, which are names of permissions. More can be found at `Permission Constants`_
|
||||
@@ -1,28 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
PMChannel
|
||||
=========
|
||||
|
||||
**extends** Channel_
|
||||
|
||||
A PMChannel is a Private/Direct channel between the Client and another user.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
messages
|
||||
~~~~~~~~
|
||||
|
||||
A Cache_ of Message_ objects.
|
||||
|
||||
recipient
|
||||
~~~~~~~~~
|
||||
|
||||
The User_ that is the recipient of the Channel.
|
||||
|
||||
lastMessage
|
||||
~~~~~~~~~~~
|
||||
|
||||
The last Message_ sent in the channel, may be null if no messages have been sent during the time the bound Client_ has been online.
|
||||
@@ -1,81 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Resolvables
|
||||
===========
|
||||
|
||||
In discord.js, the aim is to allow the end developer to have freedom in what sort of data types they supply. References to any sort of resolvable basically mean what types of data you can provide. The different resolvables are shown before:
|
||||
|
||||
--------
|
||||
|
||||
Channel Resolvable
|
||||
------------------
|
||||
|
||||
A Channel Resolvable allows:
|
||||
|
||||
- Channel_
|
||||
- Server_
|
||||
- Message_
|
||||
- User_ (in some instances)
|
||||
- String of Channel ID
|
||||
|
||||
Voice Channel Resolvable
|
||||
------------------------
|
||||
|
||||
A Voice Channel Resolvable allows:
|
||||
|
||||
- VoiceChannel_
|
||||
|
||||
Message Resolvable
|
||||
------------------
|
||||
|
||||
A Message Resolvable allows:
|
||||
|
||||
- Message_
|
||||
- TextChannel_
|
||||
- PMChannel_
|
||||
|
||||
User Resolvable
|
||||
---------------
|
||||
|
||||
A User Resolvable allows:
|
||||
|
||||
- User_
|
||||
- Message_
|
||||
- TextChannel_
|
||||
- PMChannel_
|
||||
- Server_
|
||||
- String of User ID
|
||||
|
||||
String Resolvable
|
||||
-----------------
|
||||
|
||||
A String Resolvable allows:
|
||||
|
||||
- Array
|
||||
- String
|
||||
|
||||
Server Resolvable
|
||||
-----------------
|
||||
|
||||
A Server Resolvable allows:
|
||||
|
||||
- Server_
|
||||
- ServerChannel_
|
||||
- Message_ (only for messages from server channels)
|
||||
- String of Server ID
|
||||
|
||||
Invite ID Resolvable
|
||||
--------------------
|
||||
|
||||
An Invite ID Resolvable allows:
|
||||
|
||||
- Invite_
|
||||
- String_ containing either a http link to the invite or the invite code on its own.
|
||||
|
||||
Base64 Resolvable
|
||||
-----------------
|
||||
|
||||
A Base64 Resolvable allows:
|
||||
|
||||
- Buffer
|
||||
- String
|
||||
@@ -1,73 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Role
|
||||
====
|
||||
|
||||
Represents data for a Server Role.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
position
|
||||
~~~~~~~~
|
||||
|
||||
`Number`, position of the role when viewing the roles of a server.
|
||||
|
||||
name
|
||||
~~~~
|
||||
|
||||
`String`, name of the role.
|
||||
|
||||
managed
|
||||
~~~~~~~
|
||||
|
||||
`Boolean`, whether Discord has created the role itself. Currently only used for Twitch integration.
|
||||
|
||||
id
|
||||
~~
|
||||
|
||||
`String`, ID of the role.
|
||||
|
||||
hoist
|
||||
~~~~~
|
||||
|
||||
`Boolean`, whether the role should be displayed as a separate category in the users section.
|
||||
|
||||
color
|
||||
~~~~~
|
||||
|
||||
`Number`, a base 10 colour. Use ``role.colorAsHex()`` to get a hex colour instead.
|
||||
|
||||
server
|
||||
~~~~~~
|
||||
|
||||
The Server_ the role belongs to.
|
||||
|
||||
client
|
||||
~~~~~~
|
||||
|
||||
The Client_ that cached the role.
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
serialise()
|
||||
~~~~~~~~~~~
|
||||
|
||||
**Aliases:** `serialize`
|
||||
|
||||
Makes an object with the permission names found in `Permission Constants`_ and a boolean value for them.
|
||||
|
||||
hasPermission(permission)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sees whether the role has the permission given.
|
||||
|
||||
- **permission** - See `Permission Constants`_ for valid permission names.
|
||||
|
||||
colorAsHex()
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Returns the role's colour as hex, e.g. ``#FF0000``.
|
||||
@@ -1,88 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Server
|
||||
======
|
||||
|
||||
**extends** Equality_
|
||||
|
||||
Stores information about a Discord Server.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
client
|
||||
~~~~~~
|
||||
|
||||
The Client_ that cached the Server.
|
||||
|
||||
region
|
||||
~~~~~~
|
||||
|
||||
`String`, region of the server.
|
||||
|
||||
name
|
||||
~~~~
|
||||
|
||||
`String`, name of the server.
|
||||
|
||||
id
|
||||
~~
|
||||
|
||||
`String`, ID of the server - never changes.
|
||||
|
||||
members
|
||||
~~~~~~~
|
||||
|
||||
Members of the server, a Cache_ of User_ objects.
|
||||
|
||||
channels
|
||||
~~~~~~~~
|
||||
|
||||
Channels in the server, a Cache_ of ServerChannel_ objects.
|
||||
|
||||
roles
|
||||
~~~~~
|
||||
|
||||
Roles of the server, a Cache_ of Role_ objects.
|
||||
|
||||
icon
|
||||
~~~~
|
||||
|
||||
ID/Hash of server icon, use ``server.iconURL`` for an URL to the icon.
|
||||
|
||||
afkTimeout
|
||||
~~~~~~~~~~
|
||||
|
||||
`Number`, the AFK timeout in seconds before a user is classed as AFK. If there isn't an AFK timeout, this will be null.
|
||||
|
||||
afkChannel
|
||||
~~~~~~~~~~
|
||||
|
||||
The channel where AFK users are moved to, ServerChannel_ object. If one isn't set, this will be null.
|
||||
|
||||
defaultChannel
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
The ``#general`` ServerChannel_ of the server.
|
||||
|
||||
owner
|
||||
~~~~~
|
||||
|
||||
The founder of the server, a User_ object.
|
||||
|
||||
iconURL
|
||||
~~~~~~~
|
||||
|
||||
The URL of the Server's icon. If the server doesn't have an icon, this will be null.
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
rolesOfUser(user)
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Aliases**: `rolesOf`
|
||||
|
||||
Returns an array of the roles affecting a user server-wide.
|
||||
@@ -1,53 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
ServerChannel
|
||||
=============
|
||||
|
||||
**extends** Channel_
|
||||
|
||||
A ServerChannel is a Channel_ that belongs to a Server_.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
name
|
||||
~~~~
|
||||
|
||||
`String`, name of the channel.
|
||||
|
||||
type
|
||||
~~~~
|
||||
|
||||
`String`, either ``voice`` or ``text``.
|
||||
|
||||
position
|
||||
~~~~~~~~
|
||||
|
||||
`Number`, position in the channel list.
|
||||
|
||||
permissionOverwrites
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Cache_ of all the PermissionOverwrite_ objects affecting the channel.
|
||||
|
||||
server
|
||||
~~~~~~
|
||||
|
||||
Server_ the channel belongs to.
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
permissionsOf(user)
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Aliases:** permsOf
|
||||
|
||||
Returns a ChannelPermissions_ object of a user's permissions in that channel.
|
||||
|
||||
mention()
|
||||
~~~~~~~~~
|
||||
|
||||
Returns a `string` that can be used in discord messages to mention a channel. ``serverChannel.toString()` defaults to this.
|
||||
@@ -1,28 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
TextChannel
|
||||
===========
|
||||
|
||||
**extends** ServerChannel_
|
||||
|
||||
A text channel of a server.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
topic
|
||||
~~~~~
|
||||
|
||||
The topic of the channel, a `String`.
|
||||
|
||||
lastMessage
|
||||
~~~~~~~~~~~
|
||||
|
||||
Last Message_ sent in the channel. May be null if no messages sent whilst the Client was online.
|
||||
|
||||
messages
|
||||
~~~~~~~~
|
||||
|
||||
A Cache_ of Message_ objects.
|
||||
@@ -1,73 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
User
|
||||
====
|
||||
|
||||
**extends** Equality_
|
||||
|
||||
Stores information about users.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
client
|
||||
~~~~~~
|
||||
|
||||
The Client_ that created the user.
|
||||
|
||||
username
|
||||
~~~~~~~~
|
||||
|
||||
`String`, username of the User.
|
||||
|
||||
discriminator
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
`Integer` from 0-9999, don't use this to identify users. Used to separate the user from the 9998 others that may have the same username. Made redundant by ``user.id``.
|
||||
|
||||
id
|
||||
~~
|
||||
|
||||
`String` (do not parse to an Integer, will become inaccurate). The ID of a user, never changes.
|
||||
|
||||
avatar
|
||||
~~~~~~
|
||||
|
||||
`String`, the ID/hash of a user's avatar. To get a path to their avatar, see ``user.avatarURL``.
|
||||
|
||||
status
|
||||
~~~~~~
|
||||
|
||||
The status of a user, `String`. Either ``online``, ``offline`` or ``idle``.
|
||||
|
||||
gameID
|
||||
~~~~~~
|
||||
|
||||
The ID of the game a user is playing, `Number`.
|
||||
|
||||
typing
|
||||
~~~~~~
|
||||
|
||||
`Object` containing the following values;
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
{
|
||||
since : 1448038288519, //timestamp of when
|
||||
channel : <Channel Object> // channel they are typing in.
|
||||
}
|
||||
|
||||
avatarURL
|
||||
~~~~~~~~~
|
||||
|
||||
A valid URL to the user's avatar if they have one, otherwise null.
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
mention()
|
||||
~~~~~~~~~
|
||||
|
||||
Returns a valid string that can be sent in a message to mention the user. By default, ``user.toString()`` does this so by adding a user object to a string, e.g. ``user + ""``, their mention code will be retrieved.
|
||||
@@ -1,10 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
VoiceChannel
|
||||
============
|
||||
|
||||
**extends** ServerChannel_
|
||||
|
||||
A voice channel of a server. Currently, the voice channel class has no differences to the ServerChannel class.
|
||||
|
||||
--------
|
||||
@@ -1,25 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
VoiceConnection
|
||||
===============
|
||||
|
||||
**Warning! Still experimental!**
|
||||
|
||||
As of discord.js v5.0.0, voice support has been added. This means you can stream audio but not yet receive.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
voiceChannel
|
||||
~~~~~~~~~~~~
|
||||
|
||||
VoiceChannel_ that the connection is for
|
||||
|
||||
client
|
||||
~~~~~~
|
||||
|
||||
Client_ the connection belongs to
|
||||
|
||||
more docs coming soon :O
|
||||
4
docs/generator/config.json
Normal file
4
docs/generator/config.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"GEN_VERSION": 12,
|
||||
"COMPRESS": false
|
||||
}
|
||||
24
docs/generator/doc-scanner.js
Normal file
24
docs/generator/doc-scanner.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/* eslint no-console:0 no-return-assign:0 */
|
||||
const parse = require('jsdoc-parse');
|
||||
|
||||
module.exports = class DocumentationScanner {
|
||||
constructor(generator) {
|
||||
this.generator = generator;
|
||||
}
|
||||
|
||||
scan(directory) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const stream = parse({
|
||||
src: [`${directory}*.js`, `${directory}**/*.js`],
|
||||
});
|
||||
|
||||
let json = '';
|
||||
stream.on('data', chunk => json += chunk.toString('utf-8'));
|
||||
stream.on('error', reject);
|
||||
stream.on('end', () => {
|
||||
json = JSON.parse(json);
|
||||
resolve(json);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
114
docs/generator/documentation.js
Normal file
114
docs/generator/documentation.js
Normal file
@@ -0,0 +1,114 @@
|
||||
const DocumentedClass = require('./types/DocumentedClass');
|
||||
const DocumentedInterface = require('./types/DocumentedInterface');
|
||||
const DocumentedTypeDef = require('./types/DocumentedTypeDef');
|
||||
const DocumentedConstructor = require('./types/DocumentedConstructor');
|
||||
const DocumentedMember = require('./types/DocumentedMember');
|
||||
const DocumentedFunction = require('./types/DocumentedFunction');
|
||||
const DocumentedEvent = require('./types/DocumentedEvent');
|
||||
const GEN_VERSION = require('./config.json').GEN_VERSION;
|
||||
|
||||
class Documentation {
|
||||
constructor(items, custom) {
|
||||
this.classes = new Map();
|
||||
this.interfaces = new Map();
|
||||
this.typedefs = new Map();
|
||||
this.custom = custom;
|
||||
this.parse(items);
|
||||
}
|
||||
|
||||
registerRoots(data) {
|
||||
for (const item of data) {
|
||||
switch (item.kind) {
|
||||
case 'class':
|
||||
this.classes.set(item.name, new DocumentedClass(this, item));
|
||||
break;
|
||||
case 'interface':
|
||||
this.interfaces.set(item.name, new DocumentedInterface(this, item));
|
||||
break;
|
||||
case 'typedef':
|
||||
this.typedefs.set(item.name, new DocumentedTypeDef(this, item));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
findParent(item) {
|
||||
if (['constructor', 'member', 'function', 'event'].indexOf(item.kind) > -1) {
|
||||
if (this.classes.get(item.memberof)) {
|
||||
return this.classes.get(item.memberof);
|
||||
}
|
||||
if (this.interfaces.get(item.memberof)) {
|
||||
return this.interfaces.get(item.memberof);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
parse(items) {
|
||||
this.registerRoots(
|
||||
items.filter(
|
||||
item => ['class', 'interface', 'typedef'].indexOf(item.kind) > -1
|
||||
)
|
||||
);
|
||||
|
||||
const members = items.filter(
|
||||
item => ['class', 'interface', 'typedef'].indexOf(item.kind) === -1
|
||||
);
|
||||
|
||||
const unknowns = new Map();
|
||||
for (const member of members) {
|
||||
let item;
|
||||
switch (member.kind) {
|
||||
case 'constructor':
|
||||
item = new DocumentedConstructor(this, member);
|
||||
break;
|
||||
case 'member':
|
||||
item = new DocumentedMember(this, member);
|
||||
break;
|
||||
case 'function':
|
||||
item = new DocumentedFunction(this, member);
|
||||
break;
|
||||
case 'event':
|
||||
item = new DocumentedEvent(this, member);
|
||||
break;
|
||||
default:
|
||||
unknowns.set(member.kind, member);
|
||||
break;
|
||||
}
|
||||
if (!item) {
|
||||
continue;
|
||||
}
|
||||
const parent = this.findParent(member);
|
||||
if (!parent) {
|
||||
console.log(new Error(`${member.name || member.directData.name} has no accessible parent`));
|
||||
continue;
|
||||
}
|
||||
parent.add(item);
|
||||
}
|
||||
if (unknowns.size > 0) {
|
||||
Array.from(unknowns.keys()).map(
|
||||
k => console.log(`Unknown documentation kind ${k} - \n${JSON.stringify(unknowns.get(k))}\n`
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
serialize() {
|
||||
const meta = {
|
||||
version: GEN_VERSION,
|
||||
date: Date.now(),
|
||||
};
|
||||
|
||||
const serialized = {
|
||||
meta,
|
||||
classes: Array.from(this.classes.values()).map(c => c.serialize()),
|
||||
interfaces: Array.from(this.interfaces.values()).map(i => i.serialize()),
|
||||
typedefs: Array.from(this.typedefs.values()).map(t => t.serialize()),
|
||||
custom: this.custom,
|
||||
};
|
||||
return serialized;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Documentation;
|
||||
30
docs/generator/generator.js
Normal file
30
docs/generator/generator.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/* eslint no-console:0 no-return-assign:0 */
|
||||
const GEN_VERSION = require('./config.json').GEN_VERSION;
|
||||
const compress = require('./config.json').COMPRESS;
|
||||
const DocumentationScanner = require('./doc-scanner');
|
||||
const Documentation = require('./documentation');
|
||||
const fs = require('fs-extra');
|
||||
const zlib = require('zlib');
|
||||
const custom = require('../custom/index');
|
||||
|
||||
const docScanner = new DocumentationScanner(this);
|
||||
|
||||
function parseDocs(json) {
|
||||
console.log(`${json.length} items found`);
|
||||
const documentation = new Documentation(json, custom);
|
||||
console.log('serializing');
|
||||
let output = JSON.stringify(documentation.serialize(), null, 0);
|
||||
if (compress) {
|
||||
console.log('compressing');
|
||||
output = zlib.deflateSync(output).toString('utf8');
|
||||
}
|
||||
console.log('writing to docs.json');
|
||||
fs.writeFileSync('./docs/docs.json', output);
|
||||
}
|
||||
|
||||
console.log(`using format version ${GEN_VERSION}`);
|
||||
console.log('scanning for documentation');
|
||||
|
||||
docScanner.scan('./src/')
|
||||
.then(parseDocs)
|
||||
.catch(console.error);
|
||||
83
docs/generator/types/DocumentedClass.js
Normal file
83
docs/generator/types/DocumentedClass.js
Normal file
@@ -0,0 +1,83 @@
|
||||
const DocumentedItem = require('./DocumentedItem');
|
||||
const DocumentedItemMeta = require('./DocumentedItemMeta');
|
||||
const DocumentedConstructor = require('./DocumentedConstructor');
|
||||
const DocumentedFunction = require('./DocumentedFunction');
|
||||
const DocumentedMember = require('./DocumentedMember');
|
||||
const DocumentedEvent = require('./DocumentedEvent');
|
||||
|
||||
/*
|
||||
{ id: 'VoiceChannel',
|
||||
longname: 'VoiceChannel',
|
||||
name: 'VoiceChannel',
|
||||
scope: 'global',
|
||||
kind: 'class',
|
||||
augments: [ 'GuildChannel' ],
|
||||
description: 'Represents a Server Voice Channel on Discord.',
|
||||
meta:
|
||||
{ lineno: 7,
|
||||
filename: 'VoiceChannel.js',
|
||||
path: 'src/structures' },
|
||||
order: 232 }
|
||||
*/
|
||||
|
||||
class DocumentedClass extends DocumentedItem {
|
||||
|
||||
constructor(docParent, data) {
|
||||
super(docParent, data);
|
||||
this.props = new Map();
|
||||
this.methods = new Map();
|
||||
this.events = new Map();
|
||||
}
|
||||
|
||||
add(item) {
|
||||
if (item instanceof DocumentedConstructor) {
|
||||
if (this.classConstructor) {
|
||||
throw new Error(`Doc ${this.directData.name} already has constructor - ${this.directData.classConstructor}`);
|
||||
}
|
||||
this.classConstructor = item;
|
||||
} else if (item instanceof DocumentedFunction) {
|
||||
if (this.methods.get(item.directData.name)) {
|
||||
throw new Error(`Doc ${this.directData.name} already has method ${item.directData.name}`);
|
||||
}
|
||||
this.methods.set(item.directData.name, item);
|
||||
} else if (item instanceof DocumentedMember) {
|
||||
if (this.props.get(item.directData.name)) {
|
||||
throw new Error(`Doc ${this.directData.name} already has prop ${item.directData.name}`);
|
||||
}
|
||||
this.props.set(item.directData.name, item);
|
||||
} else if (item instanceof DocumentedEvent) {
|
||||
if (this.events.get(item.directData.name)) {
|
||||
throw new Error(`Doc ${this.directData.name} already has event ${item.directData.name}`);
|
||||
}
|
||||
this.events.set(item.directData.name, item);
|
||||
}
|
||||
}
|
||||
|
||||
registerMetaInfo(data) {
|
||||
super.registerMetaInfo(data);
|
||||
this.directData = data;
|
||||
this.directData.meta = new DocumentedItemMeta(this, data.meta);
|
||||
}
|
||||
|
||||
serialize() {
|
||||
super.serialize();
|
||||
const { id, name, description, meta, augments, access } = this.directData;
|
||||
const serialized = {
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
meta: meta.serialize(),
|
||||
extends: augments,
|
||||
access,
|
||||
};
|
||||
if (this.classConstructor) {
|
||||
serialized.classConstructor = this.classConstructor.serialize();
|
||||
}
|
||||
serialized.methods = Array.from(this.methods.values()).map(m => m.serialize());
|
||||
serialized.properties = Array.from(this.props.values()).map(p => p.serialize());
|
||||
serialized.events = Array.from(this.events.values()).map(e => e.serialize());
|
||||
return serialized;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DocumentedClass;
|
||||
46
docs/generator/types/DocumentedConstructor.js
Normal file
46
docs/generator/types/DocumentedConstructor.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const DocumentedItem = require('./DocumentedItem');
|
||||
const DocumentedParam = require('./DocumentedParam');
|
||||
|
||||
/*
|
||||
{ id: 'Client()',
|
||||
longname: 'Client',
|
||||
name: 'Client',
|
||||
kind: 'constructor',
|
||||
description: 'Creates an instance of Client.',
|
||||
memberof: 'Client',
|
||||
params:
|
||||
[ { type: [Object],
|
||||
optional: true,
|
||||
description: 'options to pass to the client',
|
||||
name: 'options' } ],
|
||||
order: 10 }
|
||||
*/
|
||||
|
||||
class DocumentedConstructor extends DocumentedItem {
|
||||
|
||||
registerMetaInfo(data) {
|
||||
super.registerMetaInfo(data);
|
||||
this.directData = data;
|
||||
const newParams = [];
|
||||
for (const param of data.params) {
|
||||
newParams.push(new DocumentedParam(this, param));
|
||||
}
|
||||
this.directData.params = newParams;
|
||||
}
|
||||
|
||||
serialize() {
|
||||
super.serialize();
|
||||
const { id, name, description, memberof, access, params } = this.directData;
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
memberof,
|
||||
access,
|
||||
params: params.map(p => p.serialize()),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = DocumentedConstructor;
|
||||
80
docs/generator/types/DocumentedEvent.js
Normal file
80
docs/generator/types/DocumentedEvent.js
Normal file
@@ -0,0 +1,80 @@
|
||||
const DocumentedItem = require('./DocumentedItem');
|
||||
const DocumentedItemMeta = require('./DocumentedItemMeta');
|
||||
const DocumentedParam = require('./DocumentedParam');
|
||||
|
||||
/*
|
||||
{
|
||||
"id":"Client#event:guildMemberRolesUpdate",
|
||||
"longname":"Client#event:guildMemberRolesUpdate",
|
||||
"name":"guildMemberRolesUpdate",
|
||||
"scope":"instance",
|
||||
"kind":"event",
|
||||
"description":"Emitted whenever a Guild Member's Roles change - i.e. new role or removed role",
|
||||
"memberof":"Client",
|
||||
"params":[
|
||||
{
|
||||
"type":{
|
||||
"names":[
|
||||
"Guild"
|
||||
]
|
||||
},
|
||||
"description":"the guild that the update affects",
|
||||
"name":"guild"
|
||||
},
|
||||
{
|
||||
"type":{
|
||||
"names":[
|
||||
"Array.<Role>"
|
||||
]
|
||||
},
|
||||
"description":"the roles before the update",
|
||||
"name":"oldRoles"
|
||||
},
|
||||
{
|
||||
"type":{
|
||||
"names":[
|
||||
"Guild"
|
||||
]
|
||||
},
|
||||
"description":"the roles after the update",
|
||||
"name":"newRoles"
|
||||
}
|
||||
],
|
||||
"meta":{
|
||||
"lineno":91,
|
||||
"filename":"Guild.js",
|
||||
"path":"src/structures"
|
||||
},
|
||||
"order":110
|
||||
}
|
||||
*/
|
||||
|
||||
class DocumentedEvent extends DocumentedItem {
|
||||
|
||||
registerMetaInfo(data) {
|
||||
this.directData = data;
|
||||
this.directData.meta = new DocumentedItemMeta(this, data.meta);
|
||||
const newParams = [];
|
||||
data.params = data.params || [];
|
||||
for (const param of data.params) {
|
||||
newParams.push(new DocumentedParam(this, param));
|
||||
}
|
||||
this.directData.params = newParams;
|
||||
}
|
||||
|
||||
serialize() {
|
||||
super.serialize();
|
||||
const { id, name, description, memberof, meta, params } = this.directData;
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
memberof,
|
||||
meta: meta.serialize(),
|
||||
params: params.map(p => p.serialize()),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = DocumentedEvent;
|
||||
91
docs/generator/types/DocumentedFunction.js
Normal file
91
docs/generator/types/DocumentedFunction.js
Normal file
@@ -0,0 +1,91 @@
|
||||
const DocumentedItem = require('./DocumentedItem');
|
||||
const DocumentedItemMeta = require('./DocumentedItemMeta');
|
||||
const DocumentedVarType = require('./DocumentedVarType');
|
||||
const DocumentedParam = require('./DocumentedParam');
|
||||
|
||||
/*
|
||||
{
|
||||
"id":"ClientUser#sendTTSMessage",
|
||||
"longname":"ClientUser#sendTTSMessage",
|
||||
"name":"sendTTSMessage",
|
||||
"scope":"instance",
|
||||
"kind":"function",
|
||||
"inherits":"User#sendTTSMessage",
|
||||
"inherited":true,
|
||||
"implements":[
|
||||
"TextBasedChannel#sendTTSMessage"
|
||||
],
|
||||
"description":"Send a text-to-speech message to this channel",
|
||||
"memberof":"ClientUser",
|
||||
"params":[
|
||||
{
|
||||
"type":{
|
||||
"names":[
|
||||
"String"
|
||||
]
|
||||
},
|
||||
"description":"the content to send",
|
||||
"name":"content"
|
||||
}
|
||||
],
|
||||
"examples":[
|
||||
"// send a TTS message..."
|
||||
],
|
||||
"returns":[
|
||||
{
|
||||
"type":{
|
||||
"names":[
|
||||
"Promise.<Message>"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"meta":{
|
||||
"lineno":38,
|
||||
"filename":"TextBasedChannel.js",
|
||||
"path":src/structures/interface"
|
||||
},
|
||||
"order":293
|
||||
}
|
||||
*/
|
||||
|
||||
class DocumentedFunction extends DocumentedItem {
|
||||
|
||||
registerMetaInfo(data) {
|
||||
super.registerMetaInfo(data);
|
||||
this.directData = data;
|
||||
this.directData.meta = new DocumentedItemMeta(this, data.meta);
|
||||
this.directData.returns = new DocumentedVarType(this, data.returns ? data.returns[0].type : {
|
||||
names: ['null'],
|
||||
});
|
||||
const newParams = [];
|
||||
for (const param of data.params) {
|
||||
newParams.push(new DocumentedParam(this, param));
|
||||
}
|
||||
this.directData.params = newParams;
|
||||
}
|
||||
|
||||
serialize() {
|
||||
super.serialize();
|
||||
const {
|
||||
id, name, description, memberof, examples, inherits, inherited, meta, returns, params, access,
|
||||
} = this.directData;
|
||||
const serialized = {
|
||||
id,
|
||||
access,
|
||||
name,
|
||||
description,
|
||||
memberof,
|
||||
examples,
|
||||
inherits,
|
||||
inherited,
|
||||
meta: meta.serialize(),
|
||||
returns: returns.serialize(),
|
||||
params: params.map(p => p.serialize()),
|
||||
};
|
||||
serialized.implements = this.directData.implements;
|
||||
return serialized;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DocumentedFunction;
|
||||
32
docs/generator/types/DocumentedInterface.js
Normal file
32
docs/generator/types/DocumentedInterface.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const DocumentedClass = require('./DocumentedClass');
|
||||
|
||||
/*
|
||||
{ id: 'TextBasedChannel',
|
||||
longname: 'TextBasedChannel',
|
||||
name: 'TextBasedChannel',
|
||||
scope: 'global',
|
||||
kind: 'interface',
|
||||
classdesc: 'Interface for classes that have text-channel-like features',
|
||||
params: [],
|
||||
meta:
|
||||
{ lineno: 5,
|
||||
filename: 'TextBasedChannel.js',
|
||||
path: 'src/structures/interface' },
|
||||
order: 175 }
|
||||
*/
|
||||
|
||||
class DocumentedInterface extends DocumentedClass {
|
||||
registerMetaInfo(data) {
|
||||
super.registerMetaInfo(data);
|
||||
this.directData = data;
|
||||
// this.directData.meta = new DocumentedItemMeta(this, data.meta);
|
||||
}
|
||||
|
||||
serialize() {
|
||||
const serialized = super.serialize();
|
||||
serialized.description = this.directData.classdesc;
|
||||
return serialized;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DocumentedInterface;
|
||||
17
docs/generator/types/DocumentedItem.js
Normal file
17
docs/generator/types/DocumentedItem.js
Normal file
@@ -0,0 +1,17 @@
|
||||
class DocumentedItem {
|
||||
constructor(parent, info) {
|
||||
this.parent = parent;
|
||||
this.directData = {};
|
||||
this.registerMetaInfo(info);
|
||||
}
|
||||
|
||||
registerMetaInfo() {
|
||||
return;
|
||||
}
|
||||
|
||||
serialize() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DocumentedItem;
|
||||
29
docs/generator/types/DocumentedItemMeta.js
Normal file
29
docs/generator/types/DocumentedItemMeta.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const cwd = (`${process.cwd()}\\`).replace(/\\/g, '/');
|
||||
const backToForward = /\\/g;
|
||||
|
||||
const DocumentedItem = require('./DocumentedItem');
|
||||
|
||||
/*
|
||||
{ lineno: 7,
|
||||
filename: 'VoiceChannel.js',
|
||||
path: 'src/structures' },
|
||||
*/
|
||||
|
||||
class DocumentedItemMeta extends DocumentedItem {
|
||||
|
||||
registerMetaInfo(data) {
|
||||
super.registerMetaInfo(data);
|
||||
this.directData.line = data.lineno;
|
||||
this.directData.file = data.filename;
|
||||
this.directData.path = data.path.replace(backToForward, '/').replace(cwd, '');
|
||||
}
|
||||
|
||||
serialize() {
|
||||
super.serialize();
|
||||
const { line, file, path } = this.directData;
|
||||
return { line, file, path };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = DocumentedItemMeta;
|
||||
58
docs/generator/types/DocumentedMember.js
Normal file
58
docs/generator/types/DocumentedMember.js
Normal file
@@ -0,0 +1,58 @@
|
||||
const DocumentedItem = require('./DocumentedItem');
|
||||
const DocumentedItemMeta = require('./DocumentedItemMeta');
|
||||
const DocumentedVarType = require('./DocumentedVarType');
|
||||
const DocumentedParam = require('./DocumentedParam');
|
||||
|
||||
/*
|
||||
{ id: 'Client#rest',
|
||||
longname: 'Client#rest',
|
||||
name: 'rest',
|
||||
scope: 'instance',
|
||||
kind: 'member',
|
||||
description: 'The REST manager of the client',
|
||||
memberof: 'Client',
|
||||
type: { names: [ 'RESTManager' ] },
|
||||
access: 'private',
|
||||
meta:
|
||||
{ lineno: 32,
|
||||
filename: 'Client.js',
|
||||
path: 'src/client' },
|
||||
order: 11 }
|
||||
*/
|
||||
|
||||
class DocumentedMember extends DocumentedItem {
|
||||
|
||||
registerMetaInfo(data) {
|
||||
super.registerMetaInfo(data);
|
||||
this.directData = data;
|
||||
this.directData.meta = new DocumentedItemMeta(this, data.meta);
|
||||
this.directData.type = new DocumentedVarType(this, data.type);
|
||||
if (data.properties) {
|
||||
const newProps = [];
|
||||
for (const param of data.properties) {
|
||||
newProps.push(new DocumentedParam(this, param));
|
||||
}
|
||||
this.directData.properties = newProps;
|
||||
} else {
|
||||
data.properties = [];
|
||||
}
|
||||
}
|
||||
|
||||
serialize() {
|
||||
super.serialize();
|
||||
const { id, name, description, memberof, type, access, meta, properties } = this.directData;
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
memberof,
|
||||
type: type.serialize(),
|
||||
access,
|
||||
meta: meta.serialize(),
|
||||
props: properties.map(p => p.serialize()),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = DocumentedMember;
|
||||
36
docs/generator/types/DocumentedParam.js
Normal file
36
docs/generator/types/DocumentedParam.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const DocumentedItem = require('./DocumentedItem');
|
||||
const DocumentedVarType = require('./DocumentedVarType');
|
||||
|
||||
/*
|
||||
{
|
||||
"type":{
|
||||
"names":[
|
||||
"Guild"
|
||||
]
|
||||
},
|
||||
"description":"the roles after the update",
|
||||
"name":"newRoles"
|
||||
}
|
||||
*/
|
||||
|
||||
class DocumentedParam extends DocumentedItem {
|
||||
|
||||
registerMetaInfo(data) {
|
||||
super.registerMetaInfo(data);
|
||||
this.directData = data;
|
||||
this.directData.type = new DocumentedVarType(this, data.type);
|
||||
}
|
||||
|
||||
serialize() {
|
||||
super.serialize();
|
||||
const { name, description, type, optional } = this.directData;
|
||||
return {
|
||||
name,
|
||||
description,
|
||||
optional,
|
||||
type: type.serialize(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DocumentedParam;
|
||||
44
docs/generator/types/DocumentedTypeDef.js
Normal file
44
docs/generator/types/DocumentedTypeDef.js
Normal file
@@ -0,0 +1,44 @@
|
||||
const DocumentedItem = require('./DocumentedItem');
|
||||
const DocumentedItemMeta = require('./DocumentedItemMeta');
|
||||
const DocumentedVarType = require('./DocumentedVarType');
|
||||
|
||||
/*
|
||||
{ id: 'StringResolvable',
|
||||
longname: 'StringResolvable',
|
||||
name: 'StringResolvable',
|
||||
scope: 'global',
|
||||
kind: 'typedef',
|
||||
description: 'Data that can be resolved to give a String...',
|
||||
type: { names: [ 'String', 'Array', 'Object' ] },
|
||||
meta:
|
||||
{ lineno: 142,
|
||||
filename: 'ClientDataResolver.js',
|
||||
path: 'src/client' },
|
||||
order: 37 }
|
||||
*/
|
||||
|
||||
class DocumentedTypeDef extends DocumentedItem {
|
||||
|
||||
registerMetaInfo(data) {
|
||||
super.registerMetaInfo(data);
|
||||
this.directData = data;
|
||||
this.directData.meta = new DocumentedItemMeta(this, data.meta);
|
||||
this.directData.type = new DocumentedVarType(this, data.type);
|
||||
}
|
||||
|
||||
serialize() {
|
||||
super.serialize();
|
||||
const { id, name, description, type, access, meta } = this.directData;
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
type: type.serialize(),
|
||||
access,
|
||||
meta: meta.serialize(),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = DocumentedTypeDef;
|
||||
50
docs/generator/types/DocumentedVarType.js
Normal file
50
docs/generator/types/DocumentedVarType.js
Normal file
@@ -0,0 +1,50 @@
|
||||
const DocumentedItem = require('./DocumentedItem');
|
||||
|
||||
/*
|
||||
{
|
||||
"names":[
|
||||
"String"
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
const regex = /([\w]+)([^\w]+)/;
|
||||
const regexG = /([\w]+)([^\w]+)/g;
|
||||
|
||||
function splitVarName(str) {
|
||||
if (str === '*') {
|
||||
return ['*', ''];
|
||||
}
|
||||
const matches = str.match(regexG);
|
||||
const output = [];
|
||||
if (matches) {
|
||||
for (const match of matches) {
|
||||
const groups = match.match(regex);
|
||||
output.push([groups[1], groups[2]]);
|
||||
}
|
||||
} else {
|
||||
output.push([str.match(/(\w+)/g)[0], '']);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
class DocumentedVarType extends DocumentedItem {
|
||||
|
||||
registerMetaInfo(data) {
|
||||
super.registerMetaInfo(data);
|
||||
this.directData = data;
|
||||
}
|
||||
|
||||
serialize() {
|
||||
super.serialize();
|
||||
const names = [];
|
||||
for (const name of this.directData.names) {
|
||||
names.push(splitVarName(name));
|
||||
}
|
||||
return {
|
||||
types: names,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DocumentedVarType;
|
||||
@@ -1,61 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Welcome to discord.js's documentation!
|
||||
======================================
|
||||
|
||||
discord.js is an easy-to-use and intuitive JavaScript API for Discord_. It's fairly high level, so if you're
|
||||
looking for something low level, check out `discord.io`_.
|
||||
|
||||
Feel free to make any contributions you want, whether it be through creating an issue, giving a suggestion or making a pull request!
|
||||
|
||||
.. note:: This documentation is still a work-in-progress, apologies if something isn't yet documented!
|
||||
|
||||
.. _docs:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: General
|
||||
|
||||
installing
|
||||
migrating
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Documentation
|
||||
|
||||
docs_client
|
||||
docs_server
|
||||
docs_user
|
||||
docs_message
|
||||
docs_invite
|
||||
docs_voiceconnection
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Channel Documentation
|
||||
|
||||
docs_channel
|
||||
docs_pmchannel
|
||||
docs_serverchannel
|
||||
docs_textchannel
|
||||
docs_voicechannel
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Permission Documentation
|
||||
|
||||
docs_permissionconstants
|
||||
docs_role
|
||||
docs_permissionoverwrite
|
||||
docs_channelpermissions
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Utility Documentation
|
||||
|
||||
docs_cache
|
||||
docs_equality
|
||||
docs_resolvables
|
||||
|
||||
.. _Discord : https://discordapp.com/
|
||||
.. _discord.io : https://github.com/izy521/discord.io
|
||||
@@ -1,51 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Installing discord.js
|
||||
=====================
|
||||
|
||||
To install discord.js, you need a few dependencies.
|
||||
|
||||
.. warning:: **When installing with any of these methods, you'll encounter some errors.** This is because an optional dependency isn't working properly, but discord.js should still work fine.
|
||||
|
||||
-----------
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
||||
------------
|
||||
|
||||
- You need `Visual Studio`_ and `Python 2.7`_.
|
||||
|
||||
Your Visual Studio installation ideally has to be recent, but you can try installing without it first. You can use **Express, Community, Enteprise** or any others apart from ``VS Code``.
|
||||
|
||||
After you have installed these things, to install just run: ``npm install --save --msvs_version=2015 discord.js`` to install the latest version of discord.js for your project.
|
||||
|
||||
Additional Audio Support
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- Install `ffmpeg`_ and add it to your PATH.
|
||||
|
||||
-----------
|
||||
|
||||
Linux
|
||||
-----
|
||||
|
||||
-----------
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ apt-get install make build-essentials
|
||||
$ npm install --save discord.js
|
||||
|
||||
|
||||
|
||||
Additional Audio Support
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ apt-get install libav-tools
|
||||
|
||||
.. _Visual Studio : https://www.visualstudio.com/downloads/download-visual-studio-vs
|
||||
.. _Python 2.7 : https://www.python.org/download/releases/2.7.8/
|
||||
.. _ffmpeg : https://www.ffmpeg.org/download.html
|
||||
263
docs/make.bat
263
docs/make.bat
@@ -1,263 +0,0 @@
|
||||
@ECHO OFF
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set BUILDDIR=_build
|
||||
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
|
||||
set I18NSPHINXOPTS=%SPHINXOPTS% .
|
||||
if NOT "%PAPER%" == "" (
|
||||
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
if "%1" == "help" (
|
||||
:help
|
||||
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||
echo. html to make standalone HTML files
|
||||
echo. dirhtml to make HTML files named index.html in directories
|
||||
echo. singlehtml to make a single large HTML file
|
||||
echo. pickle to make pickle files
|
||||
echo. json to make JSON files
|
||||
echo. htmlhelp to make HTML files and a HTML help project
|
||||
echo. qthelp to make HTML files and a qthelp project
|
||||
echo. devhelp to make HTML files and a Devhelp project
|
||||
echo. epub to make an epub
|
||||
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||
echo. text to make text files
|
||||
echo. man to make manual pages
|
||||
echo. texinfo to make Texinfo files
|
||||
echo. gettext to make PO message catalogs
|
||||
echo. changes to make an overview over all changed/added/deprecated items
|
||||
echo. xml to make Docutils-native XML files
|
||||
echo. pseudoxml to make pseudoxml-XML files for display purposes
|
||||
echo. linkcheck to check all external links for integrity
|
||||
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||
echo. coverage to run coverage check of the documentation if enabled
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "clean" (
|
||||
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||
del /q /s %BUILDDIR%\*
|
||||
goto end
|
||||
)
|
||||
|
||||
|
||||
REM Check if sphinx-build is available and fallback to Python version if any
|
||||
%SPHINXBUILD% 2> nul
|
||||
if errorlevel 9009 goto sphinx_python
|
||||
goto sphinx_ok
|
||||
|
||||
:sphinx_python
|
||||
|
||||
set SPHINXBUILD=python -m sphinx.__init__
|
||||
%SPHINXBUILD% 2> nul
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:sphinx_ok
|
||||
|
||||
|
||||
if "%1" == "html" (
|
||||
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "dirhtml" (
|
||||
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "singlehtml" (
|
||||
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pickle" (
|
||||
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the pickle files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "json" (
|
||||
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the JSON files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "htmlhelp" (
|
||||
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "qthelp" (
|
||||
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\discordjs.qhcp
|
||||
echo.To view the help file:
|
||||
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\discordjs.ghc
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "devhelp" (
|
||||
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "epub" (
|
||||
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latex" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latexpdf" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
cd %BUILDDIR%/latex
|
||||
make all-pdf
|
||||
cd %~dp0
|
||||
echo.
|
||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latexpdfja" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
cd %BUILDDIR%/latex
|
||||
make all-pdf-ja
|
||||
cd %~dp0
|
||||
echo.
|
||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "text" (
|
||||
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "man" (
|
||||
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "texinfo" (
|
||||
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "gettext" (
|
||||
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "changes" (
|
||||
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.The overview file is in %BUILDDIR%/changes.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "linkcheck" (
|
||||
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Link check complete; look for any errors in the above output ^
|
||||
or in %BUILDDIR%/linkcheck/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "doctest" (
|
||||
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of doctests in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/doctest/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "coverage" (
|
||||
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of coverage in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/coverage/python.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "xml" (
|
||||
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The XML files are in %BUILDDIR%/xml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pseudoxml" (
|
||||
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
|
||||
goto end
|
||||
)
|
||||
|
||||
:end
|
||||
@@ -1,45 +0,0 @@
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Updating to v5.0.0
|
||||
==================
|
||||
|
||||
If you're coming from versions below v5, you might find some changes. Here are the major changes:
|
||||
|
||||
Change 1
|
||||
--------
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
// OLD:
|
||||
|
||||
client.getUser();
|
||||
client.getServer();
|
||||
server.getMember(); // etc etc
|
||||
|
||||
// NEW:
|
||||
|
||||
client.users.get();
|
||||
client.servers.get();
|
||||
client.members.get();
|
||||
|
||||
Change 2
|
||||
--------
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
// OLD:
|
||||
|
||||
client.on("serverNewMember", (member, server) => {
|
||||
|
||||
});
|
||||
|
||||
// NEW:
|
||||
|
||||
client.on("serverNewMember", (server, user) => {
|
||||
|
||||
});
|
||||
|
||||
Change 3
|
||||
---------
|
||||
|
||||
The Member Class has been removed, meaning you can't use ``member.permissionsIn(channel)``. To get permissions, use ``channel.permissionsOf(user)``.
|
||||
@@ -1,10 +0,0 @@
|
||||
Troubleshooting
|
||||
===============
|
||||
|
||||
Occasionally, the API can stop working for whatever reason. If it was working previously and it stopped working on the same version, it means that there's been a change to the Discord API. In this case, please `make an issue`_ if one relating to a similar issue doesn't exist. Please post a stacktrace if there is one, and be as detailed as possible - *"the API isn't working"* doesn't help at all.
|
||||
|
||||
If there is already an issue, feel free to comment that you're also experiencing the same thing. This helps to see how widespread the bug is.
|
||||
|
||||
You can try reconnecting before submitting an issue, as sometimes some of the servers may be slightly different.
|
||||
|
||||
.. _make an issue : https://github.com/hydrabolt/discord.js/issues
|
||||
@@ -1,28 +0,0 @@
|
||||
.. _Client : ./docs_client.html
|
||||
.. _Cache : ./docs_cache.html
|
||||
.. _User : ./docs_user.html
|
||||
.. _Server : ./docs_server.html
|
||||
.. _Channel : ./docs_channel.html
|
||||
.. _ServerChannel : ./docs_serverchannel.html
|
||||
.. _TextChannel : ./docs_textchannel.html
|
||||
.. _VoiceChannel : ./docs_voicechannel.html
|
||||
.. _PMChannel : ./docs_pmchannel.html
|
||||
.. _Message : ./docs_message.html
|
||||
.. _Invite : ./docs_invite.html
|
||||
.. _Equality : ./docs_equality.html
|
||||
.. _Role : ./docs_role.html
|
||||
.. _ChannelPermissions : ./docs_channelpermissions.html
|
||||
.. _PermissionOverwrite : ./docs_permissionoverwrite.html
|
||||
.. _Permission Constants : ./docs_permissionconstants.html
|
||||
.. _Resolvables : ./docs_resolvables.html
|
||||
.. _VoiceConnection : ./docs_voiceconnection.html
|
||||
.. _Promises : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
||||
.. _EventEmitter : https://nodejs.org/api/events.html#events_class_events_eventemitter
|
||||
.. _Channel Resolvable : http://discordjs.readthedocs.org/en/rewrite-docs/docs_resolvables.html#channel-resolvable
|
||||
.. _String Resolvable : http://discordjs.readthedocs.org/en/rewrite-docs/docs_resolvables.html#string-resolvable
|
||||
.. _Message Resolvable : http://discordjs.readthedocs.org/en/rewrite-docs/docs_resolvables.html#message-resolvable
|
||||
.. _Server Resolvable : http://discordjs.readthedocs.org/en/rewrite-docs/docs_resolvables.html#server-resolvable
|
||||
.. _Invite Resolvable : http://discordjs.readthedocs.org/en/rewrite-docs/docs_resolvables.html#invite-id-resolvable
|
||||
.. _User Resolvable : http://discordjs.readthedocs.org/en/rewrite-docs/docs_resolvables.html#user-resolvable
|
||||
.. _Base64 Resolvable : http://discordjs.readthedocs.org/en/rewrite-docs/docs_resolvables.html#base64-resolvable
|
||||
.. _VoiceChannel Resolvable : http://discordjs.readthedocs.org/en/rewrite-docs/docs_resolvables.html#voice-channel-resolvable
|
||||
@@ -1,29 +0,0 @@
|
||||
/* global process */
|
||||
/*
|
||||
this is the entrypoint file, when node finally catches
|
||||
up with all ES6 drafts etc, the entrypoint file will stop
|
||||
using the transpiled ES5 and switch straight to the ES6
|
||||
code. This allows for easier debugging and potentially
|
||||
faster execution!
|
||||
*/
|
||||
var v = process.version;
|
||||
if(v.charAt(0) === "v"){
|
||||
v = v.substring(1);
|
||||
}
|
||||
|
||||
v = v.split(".");
|
||||
|
||||
var major = parseInt(v[0]),
|
||||
minor = parseInt(v[1]),
|
||||
patch = parseInt(v[2]);
|
||||
|
||||
// at the moment no node version has full ES6 support
|
||||
use5();
|
||||
|
||||
function use6(){
|
||||
module.exports = require("./src/index.js");
|
||||
}
|
||||
|
||||
function use5(){
|
||||
module.exports = require("./lib/index.js");
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
# Warning!
|
||||
|
||||
### These examples are not updated to v5.0.0, may not work!
|
||||
@@ -1,3 +0,0 @@
|
||||
# Analysis Bot
|
||||
|
||||
Analysis Bot provides Analysis and Utility to Discord Users!
|
||||
@@ -1,165 +0,0 @@
|
||||
/* global process */
|
||||
|
||||
var Discord = require("../../");
|
||||
var bot = new Discord.Client();
|
||||
var auth = require("../auth.json");
|
||||
var request = require("superagent");
|
||||
|
||||
var loose = false;
|
||||
|
||||
bot.on("message", msg => {
|
||||
|
||||
if (~msg.content.indexOf("https://discord.gg/")) {
|
||||
bot.joinServer(msg.content.substr(msg.content.indexOf("https://discord.gg/"), "https://discord.gg/".length + 16));
|
||||
}
|
||||
|
||||
if (!msg.content.startsWith("$")) return;
|
||||
|
||||
msg.content = msg.content.substr(1);
|
||||
|
||||
if (msg.content === "stats") {
|
||||
msg.reply([
|
||||
"I am connected/have access to:",
|
||||
`${bot.servers.length} servers`,
|
||||
`${bot.channels.length} channels`,
|
||||
`${bot.users.length} users`,
|
||||
].join("\n"));
|
||||
}
|
||||
|
||||
if (msg.content.startsWith("startplaying")) {
|
||||
var game = msg.content.split(" ").slice(1).join(" ");
|
||||
bot.setPlayingGame(game);
|
||||
}
|
||||
|
||||
if (msg.content.startsWith("setname") && loose) {
|
||||
bot.setUsername(msg.content.split(" ").slice(1).join(" ")).then(() => {
|
||||
msg.reply("done!");
|
||||
});
|
||||
}
|
||||
|
||||
if (msg.content === "updateav") {
|
||||
request
|
||||
.get("https://api.github.com/search/repositories?q=discord.js")
|
||||
.end((err, res) => {
|
||||
if (err) {
|
||||
return;
|
||||
}
|
||||
|
||||
var text = res.body.items[0].stargazers_count
|
||||
|
||||
bot.updateDetails({
|
||||
username : "d.js star bot - " + text,
|
||||
avatar: getStars(text)
|
||||
}).then(() => {
|
||||
msg.reply("success!");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (msg.content.startsWith("setavatar") && loose) {
|
||||
request
|
||||
.get(msg.content.split(" ")[1])
|
||||
.end((err, res) => {
|
||||
bot.updateDetails({
|
||||
avatar: getStars(text)
|
||||
}).then(() => {
|
||||
|
||||
msg.reply("done!");
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (msg.content === "away") {
|
||||
bot.setStatusIdle();
|
||||
}
|
||||
|
||||
if (msg.content === "here") {
|
||||
bot.setStatusOnline();
|
||||
}
|
||||
|
||||
if (msg.content === "randomUser") {
|
||||
var random = bot.users.random();
|
||||
msg.reply([
|
||||
random.username,
|
||||
"avatar: ", random.avatarURL
|
||||
].join("\n"));
|
||||
}
|
||||
|
||||
if (msg.content.startsWith("mimic") && loose) {
|
||||
var toMimic = msg.mentions[0];
|
||||
|
||||
if (!toMimic) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!toMimic.avatar) {
|
||||
bot.updateDetails({
|
||||
username: toMimic.username,
|
||||
avatar: null
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
request
|
||||
.get(toMimic.avatarURL)
|
||||
.end((err, res) => {
|
||||
bot.updateDetails({
|
||||
username: toMimic.username,
|
||||
avatar: res.body
|
||||
}).then(() => {
|
||||
|
||||
msg.reply("done!");
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
|
||||
request
|
||||
.get("https://api.github.com/search/repositories?q=discord.js")
|
||||
.end((err, res) => {
|
||||
if (err) {
|
||||
return;
|
||||
}
|
||||
|
||||
var text = res.body.items[0].stargazers_count
|
||||
|
||||
bot.updateDetails({
|
||||
username : "d.js star bot - " + text,
|
||||
avatar: getStars(text)
|
||||
}).then(() => {
|
||||
console.log("many successes");
|
||||
});
|
||||
});
|
||||
|
||||
}, 60000);
|
||||
|
||||
bot.on("disconnected", () => {
|
||||
console.log("Disconnected, exiting!");
|
||||
process.exit();
|
||||
})
|
||||
|
||||
bot.login(auth.email, auth.password);
|
||||
|
||||
function getStars(text) {
|
||||
var Canvas = require('canvas')
|
||||
, Image = Canvas.Image
|
||||
, canvas = new Canvas(90, 90)
|
||||
, ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = "black";
|
||||
ctx.fillRect(0, 0, 90, 90);
|
||||
|
||||
ctx.font = '45px Arial';
|
||||
ctx.fillStyle = "white";
|
||||
ctx.fillText(text, (ctx.measureText(text).width / 2) - 5, 60);
|
||||
|
||||
ctx.strokeStyle = 'rgb(255,255,255)';
|
||||
|
||||
return canvas.toDataURL();
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"email" : "your discord email here",
|
||||
"password" : "your discord password here"
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
this bot is an avatar bot, and will give a user their avatar's URL
|
||||
*/
|
||||
|
||||
var Discord = require("../");
|
||||
|
||||
var AuthDetails = require("./auth.json");
|
||||
|
||||
var bot = new Discord.Client();
|
||||
|
||||
bot.on("ready", () => {
|
||||
console.log("Ready to begin! Serving in " + bot.channels.length + " channels");
|
||||
});
|
||||
|
||||
bot.on("disconnected", () => {
|
||||
|
||||
console.log("Disconnected!");
|
||||
process.exit(1); //exit node.js with an error
|
||||
|
||||
});
|
||||
|
||||
bot.on("message", (msg) => {
|
||||
|
||||
if( msg.content === "avatar" ){
|
||||
// if the message was avatar
|
||||
bot.reply( msg, msg.sender.avatarURL );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
bot.login(AuthDetails.email, AuthDetails.password);
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES6"
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
this bot is a permissions bot and is currently working
|
||||
with the experimental additions. Some functions may
|
||||
change in the future.
|
||||
*/
|
||||
|
||||
var Discord = require("../../");
|
||||
|
||||
// Get the email and password
|
||||
var AuthDetails = require("../auth.json");
|
||||
|
||||
var bot = new Discord.Client();
|
||||
|
||||
bot.on("ready", function () {
|
||||
console.log("Ready to begin! Serving in " + bot.channels.length + " channels");
|
||||
});
|
||||
|
||||
bot.on("disconnected", function () {
|
||||
|
||||
console.log("Disconnected!");
|
||||
process.exit(1); //exit node.js with an error
|
||||
|
||||
});
|
||||
|
||||
bot.on("message", function (msg) {
|
||||
if (msg.content === "skype") {
|
||||
|
||||
//stop the user from speaking in the channel:
|
||||
bot.overwritePermissions(msg.channel, msg.sender, {
|
||||
sendMessages: false
|
||||
});
|
||||
|
||||
// send a barely funny message ;)
|
||||
bot.reply(msg, "how dare you mention that!");
|
||||
|
||||
}
|
||||
|
||||
if (msg.content === "discord") {
|
||||
|
||||
// if the role doesn't exist, make it
|
||||
bot.createRoleIfNotExists(msg.channel.server, {
|
||||
name: "good people",
|
||||
color: Discord.Colors.BLUE, // colour of blue
|
||||
hoist: true // make a seperate category in the users list
|
||||
}).then(addUserToList).catch(console.log);
|
||||
|
||||
function addUserToList(role, alreadyExists) {
|
||||
console.log(arguments);
|
||||
bot.addMemberToRole(msg.sender, role);
|
||||
bot.reply(msg, "welcome to the good people! " + alreadyExists);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (msg.content === "remove me") {
|
||||
// remove the user from the good people list, if it exists
|
||||
var found = false;
|
||||
|
||||
for (var role of msg.channel.server.roles) {
|
||||
if (role.name === "good people") {
|
||||
found = role;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
// if the role exists
|
||||
|
||||
if (msg.sender.hasRole(role)) {
|
||||
// remove the member from the role
|
||||
bot.removeMemberFromRole(msg.sender, role);
|
||||
bot.reply(msg, "removed!")
|
||||
} else {
|
||||
bot.reply(msg, "you're not in the role!");
|
||||
}
|
||||
|
||||
} else {
|
||||
// role doesn't exist
|
||||
bot.reply(msg, "the role doesn't even exist!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
bot.login(AuthDetails.email, AuthDetails.password);
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
this bot will demonstrate the different ways you
|
||||
can create colors in Discord.
|
||||
*/
|
||||
|
||||
var Discord = require("../../");
|
||||
|
||||
// Get the email and password
|
||||
var AuthDetails = require("../auth.json");
|
||||
|
||||
var bot = new Discord.Client();
|
||||
|
||||
bot.on("ready", function () {
|
||||
console.log("Ready to begin! Serving in " + bot.channels.length + " channels");
|
||||
});
|
||||
|
||||
bot.on("disconnected", function () {
|
||||
|
||||
console.log("Disconnected!");
|
||||
process.exit(1); //exit node.js with an error
|
||||
|
||||
});
|
||||
|
||||
bot.on("message", function (msg) {
|
||||
|
||||
// to use this example, you first have to send 'create role'
|
||||
// you can then change colors afterwards.
|
||||
|
||||
if (msg.content === "create role") {
|
||||
// create the role and add the user to it
|
||||
|
||||
bot.createRoleIfNotExists(msg.channel.server, {
|
||||
name: "Custom Colors",
|
||||
hoist: true, // so it is visible in the members list
|
||||
}).then(function (permission) {
|
||||
// this is executed when the role has been created or exists
|
||||
|
||||
// adds the sender to the role
|
||||
bot.addMemberToRole(msg.sender, permission).then(function () {
|
||||
bot.reply(msg, "added you to the role!");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (msg.content.indexOf("preset color") === 0) {
|
||||
|
||||
// set the role to a preset color
|
||||
var colorName = msg.content.split(" ")[2];
|
||||
|
||||
// get the role by its name
|
||||
var role = msg.channel.server.getRole("name", "Custom Colors");
|
||||
|
||||
// if the color exists as a preset
|
||||
if (Discord.Color[colorName]) {
|
||||
|
||||
// update the role with the new color
|
||||
bot.updateRole(role, {
|
||||
color: Discord.Color[colorName]
|
||||
}).then(function (role) {
|
||||
// this executes if the change was correct
|
||||
bot.reply(msg, "done! using the color " + Discord.Color.toHex(role.color));
|
||||
});
|
||||
|
||||
} else {
|
||||
bot.reply(msg, "that color isn't a preset color!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (msg.content.indexOf("custom color") === 0) {
|
||||
|
||||
// valid custom colors must follow the format of any of the following:
|
||||
/*
|
||||
#ff0000 <- valid 7 digit hex (including #)
|
||||
ff0000 <- valid 6 digit hex
|
||||
16711680 <- valid decimal number (this if #ff0000 as a decimal)
|
||||
*/
|
||||
|
||||
var colorName = msg.content.split(" ")[2];
|
||||
|
||||
// get the role by its name
|
||||
var role = msg.channel.server.getRole("name", "Custom Colors");
|
||||
|
||||
// updates the role with the given color
|
||||
bot.updateRole(role, {
|
||||
color: colorName
|
||||
}).then(function (role) {
|
||||
|
||||
// this executes if the change was successful
|
||||
bot.reply(msg, "done! using the color " + Discord.Color.toHex(role.color));
|
||||
|
||||
}).catch(function (e) {
|
||||
|
||||
// this executes if it wasn't successful
|
||||
bot.reply(msg, "an error occurred. Was that a valid hex/dec color?");
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
bot.login(AuthDetails.email, AuthDetails.password);
|
||||
@@ -1,50 +0,0 @@
|
||||
/* this bot will see if a user can send TTS messages */
|
||||
|
||||
var Discord = require("../../");
|
||||
|
||||
Discord.patchStrings();
|
||||
|
||||
var AuthDetails = require("../auth.json");
|
||||
|
||||
var bot = new Discord.Client();
|
||||
|
||||
bot.on("ready", () => {
|
||||
console.log("Ready to begin!");
|
||||
});
|
||||
|
||||
bot.on("message", (msg) => {
|
||||
|
||||
if(msg.content === "can I tts?"){
|
||||
|
||||
var user = msg.sender;
|
||||
|
||||
// get the evaluated permissions for a user in the channel they asked
|
||||
var permissions = msg.channel.permissionsOf(user);
|
||||
|
||||
if(permissions.sendTTSMessages){
|
||||
bot.reply(msg, "You " + "can".italic.bold + " send TTS messages.");
|
||||
}else{
|
||||
bot.reply(msg, "You " + "can't".italic.bold + " send TTS messages.");
|
||||
}
|
||||
|
||||
}else if(msg.content === "what are my full permissions?"){
|
||||
|
||||
var user = msg.sender;
|
||||
|
||||
// get the serialised permissions of the user
|
||||
var permissions = msg.channel.permissionsOf(user).serialise();
|
||||
|
||||
// if you want to stringify permissions, they need to be serialised first.
|
||||
|
||||
bot.reply(msg, JSON.stringify(permissions, null, 4).replace(/true/g, "**true**"));
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
for a list of more permissions, go to
|
||||
https://github.com/hydrabolt/discord.js/blob/master/src/EvaluatedPermissions.js
|
||||
*/
|
||||
|
||||
})
|
||||
|
||||
bot.login(AuthDetails.email, AuthDetails.password);
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
this bot is a ping pong bot, and every time a message
|
||||
beginning with "ping" is sent, it will reply with
|
||||
"pong!".
|
||||
*/
|
||||
|
||||
var Discord = require("../");
|
||||
|
||||
// Get the email and password
|
||||
var AuthDetails = require("./auth.json");
|
||||
|
||||
var bot = new Discord.Client();
|
||||
|
||||
//when the bot is ready
|
||||
bot.on("ready", function () {
|
||||
console.log("Ready to begin! Serving in " + bot.channels.length + " channels");
|
||||
});
|
||||
|
||||
//when the bot disconnects
|
||||
bot.on("disconnected", function () {
|
||||
//alert the console
|
||||
console.log("Disconnected!");
|
||||
|
||||
//exit node.js with an error
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
//when the bot receives a message
|
||||
bot.on("message", function (msg) {
|
||||
//if message begins with "ping"
|
||||
if (msg.content.indexOf("ping") === 0) {
|
||||
//send a message to the channel the ping message was sent in.
|
||||
bot.sendMessage(msg.channel, "pong!");
|
||||
|
||||
//alert the console
|
||||
console.log("pong-ed " + msg.author.username);
|
||||
}
|
||||
});
|
||||
|
||||
bot.login(AuthDetails.email, AuthDetails.password);
|
||||
@@ -1,33 +0,0 @@
|
||||
/* this bot will send an image to a channel */
|
||||
|
||||
var Discord = require("../");
|
||||
|
||||
var AuthDetails = require("./auth.json");
|
||||
|
||||
var bot = new Discord.Client();
|
||||
|
||||
bot.on("ready", () => {
|
||||
console.log("Ready to begin!");
|
||||
});
|
||||
|
||||
bot.on("message", (msg) => {
|
||||
|
||||
if (msg.content === "photos") {
|
||||
|
||||
bot.sendFile( msg.channel, "./test/image.png", "photo.png", (err, msg) => {
|
||||
if(err)
|
||||
console.log("couldn't send image:", err);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if( msg.content === "file" ) {
|
||||
bot.sendFile( msg.channel, new Buffer("Text in a file!"), "file.txt", (err, msg) => {
|
||||
if(err)
|
||||
console.log("couldn't send file:", err);
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
bot.login(AuthDetails.email, AuthDetails.password);
|
||||
53
gruntfile.js
53
gruntfile.js
@@ -1,53 +0,0 @@
|
||||
module.exports = function (grunt) {
|
||||
|
||||
require('load-grunt-tasks')(grunt);
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON("package.json"),
|
||||
// define source files and their destinations
|
||||
babel: {
|
||||
options: {
|
||||
loose: "all",
|
||||
compact: !grunt.option('dev')
|
||||
},
|
||||
dist: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: "src/",
|
||||
src: ["**/**.*"],
|
||||
dest: "lib/",
|
||||
ext: ".js"
|
||||
}]
|
||||
}
|
||||
},
|
||||
browserify: {
|
||||
dist: {
|
||||
files: {
|
||||
'web-dist/discord.<%= pkg.version %>.js': ["lib/index.js"],
|
||||
},
|
||||
options: {
|
||||
browserifyOptions: {
|
||||
standalone: "Discord"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
min: {
|
||||
files: {
|
||||
"./web-dist/discord.min.<%= pkg.version %>.js": "./web-dist/discord.<%= pkg.version %>.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// load plugins
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
|
||||
// register at least this one task
|
||||
grunt.registerTask('default', ['babel']);
|
||||
grunt.registerTask('web', ['browserify', "uglify"]);
|
||||
grunt.registerTask("dist", ["babel", "browserify", "uglify"])
|
||||
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES6",
|
||||
"module": "commonjs"
|
||||
}
|
||||
}
|
||||
@@ -1,633 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _InternalClient = require("./InternalClient");
|
||||
|
||||
var _InternalClient2 = _interopRequireDefault(_InternalClient);
|
||||
|
||||
var _events = require("events");
|
||||
|
||||
var _events2 = _interopRequireDefault(_events);
|
||||
|
||||
function errCB(callback) {
|
||||
return function (error) {
|
||||
callback(error);
|
||||
throw error;
|
||||
};
|
||||
}
|
||||
|
||||
var Client = (function (_EventEmitter) {
|
||||
_inherits(Client, _EventEmitter);
|
||||
|
||||
/*
|
||||
this class is an interface for the internal
|
||||
client.
|
||||
*/
|
||||
|
||||
function Client(options) {
|
||||
_classCallCheck(this, Client);
|
||||
|
||||
_EventEmitter.call(this);
|
||||
this.options = options || {};
|
||||
this.internal = new _InternalClient2["default"](this);
|
||||
}
|
||||
|
||||
// def login
|
||||
|
||||
Client.prototype.login = function login(email, password) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err, token*/{} : arguments[2];
|
||||
|
||||
return this.internal.login(email, password).then(function (token) {
|
||||
callback(null, token);
|
||||
return token;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def logout
|
||||
|
||||
Client.prototype.logout = function logout() {
|
||||
var callback = arguments.length <= 0 || arguments[0] === undefined ? function () /*err*/{} : arguments[0];
|
||||
|
||||
return this.internal.logout().then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
// def sendMessage
|
||||
|
||||
Client.prototype.sendMessage = function sendMessage(where, content) {
|
||||
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*e, m*/{} : arguments[3];
|
||||
|
||||
if (typeof options === "function") {
|
||||
// options is the callback
|
||||
callback = options;
|
||||
}
|
||||
|
||||
return this.internal.sendMessage(where, content, options).then(function (m) {
|
||||
callback(null, m);
|
||||
return m;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def sendTTSMessage
|
||||
|
||||
Client.prototype.sendTTSMessage = function sendTTSMessage(where, content) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*e, m*/{} : arguments[2];
|
||||
|
||||
return this.sendMessage(where, content, { tts: true }).then(function (m) {
|
||||
callback(null, m);
|
||||
return m;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def reply
|
||||
|
||||
Client.prototype.reply = function reply(where, content) {
|
||||
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*e, m*/{} : arguments[3];
|
||||
|
||||
if (typeof options === "function") {
|
||||
// options is the callback
|
||||
callback = options;
|
||||
}
|
||||
|
||||
var msg = this.internal.resolver.resolveMessage(where);
|
||||
if (msg) {
|
||||
content = msg.author + ", " + content;
|
||||
return this.internal.sendMessage(msg, content, options).then(function (m) {
|
||||
callback(null, m);
|
||||
return m;
|
||||
}, errCB(callback));
|
||||
}
|
||||
var err = new Error("Destination not resolvable to a message!");
|
||||
callback(err);
|
||||
return Promise.reject(err);
|
||||
};
|
||||
|
||||
// def replyTTS
|
||||
|
||||
Client.prototype.replyTTS = function replyTTS(where, content) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /**/{} : arguments[2];
|
||||
|
||||
return this.reply(where, content, { tts: true }).then(function (m) {
|
||||
callback(null, m);
|
||||
return m;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def deleteMessage
|
||||
|
||||
Client.prototype.deleteMessage = function deleteMessage(msg) {
|
||||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*e*/{} : arguments[2];
|
||||
|
||||
if (typeof options === "function") {
|
||||
// options is the callback
|
||||
callback = options;
|
||||
}
|
||||
|
||||
return this.internal.deleteMessage(msg, options).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def updateMessage
|
||||
|
||||
Client.prototype.updateMessage = function updateMessage(msg, content) {
|
||||
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err, msg*/{} : arguments[3];
|
||||
|
||||
if (typeof options === "function") {
|
||||
// options is the callback
|
||||
callback = options;
|
||||
}
|
||||
|
||||
return this.internal.updateMessage(msg, content, options).then(function (msg) {
|
||||
callback(null, msg);
|
||||
return msg;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def getChannelLogs
|
||||
|
||||
Client.prototype.getChannelLogs = function getChannelLogs(where) {
|
||||
var limit = arguments.length <= 1 || arguments[1] === undefined ? 500 : arguments[1];
|
||||
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err, logs*/{} : arguments[3];
|
||||
|
||||
if (typeof options === "function") {
|
||||
// options is the callback
|
||||
callback = options;
|
||||
}
|
||||
|
||||
return this.internal.getChannelLogs(where, limit, options).then(function (logs) {
|
||||
callback(null, logs);
|
||||
return logs;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def getBans
|
||||
|
||||
Client.prototype.getBans = function getBans(where) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err, bans*/{} : arguments[1];
|
||||
|
||||
return this.internal.getBans(where).then(function (bans) {
|
||||
callback(null, bans);
|
||||
return bans;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def sendFile
|
||||
|
||||
Client.prototype.sendFile = function sendFile(where, attachment) {
|
||||
var name = arguments.length <= 2 || arguments[2] === undefined ? "image.png" : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err, m*/{} : arguments[3];
|
||||
|
||||
return this.internal.sendFile(where, attachment, name).then(function (m) {
|
||||
callback(null, m);
|
||||
return m;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def joinServer
|
||||
|
||||
Client.prototype.joinServer = function joinServer(invite) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err, srv*/{} : arguments[1];
|
||||
|
||||
return this.internal.joinServer(invite).then(function (srv) {
|
||||
callback(null, srv);
|
||||
return srv;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def createServer
|
||||
|
||||
Client.prototype.createServer = function createServer(name) {
|
||||
var region = arguments.length <= 1 || arguments[1] === undefined ? "london" : arguments[1];
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err, srv*/{} : arguments[2];
|
||||
|
||||
return this.internal.createServer(name, region).then(function (srv) {
|
||||
callback(null, srv);
|
||||
return srv;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def leaveServer
|
||||
|
||||
Client.prototype.leaveServer = function leaveServer(server) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.leaveServer(server).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
// def deleteServer
|
||||
|
||||
Client.prototype.deleteServer = function deleteServer(server) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.leaveServer(server).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
// def createChannel
|
||||
|
||||
Client.prototype.createChannel = function createChannel(server, name) {
|
||||
var type = arguments.length <= 2 || arguments[2] === undefined ? "text" : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err, channel*/{} : arguments[3];
|
||||
|
||||
if (typeof type === "function") {
|
||||
// options is the callback
|
||||
callback = type;
|
||||
}
|
||||
return this.internal.createChannel(server, name, type).then(function (channel) {
|
||||
callback(channel);
|
||||
return channel;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def deleteChannel
|
||||
|
||||
Client.prototype.deleteChannel = function deleteChannel(channel) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.deleteChannel(channel).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def banMember
|
||||
|
||||
Client.prototype.banMember = function banMember(user, server) {
|
||||
var length = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err*/{} : arguments[3];
|
||||
|
||||
if (typeof length === "function") {
|
||||
// length is the callback
|
||||
callback = length;
|
||||
}
|
||||
return this.internal.banMember(user, server, length).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def unbanMember
|
||||
|
||||
Client.prototype.unbanMember = function unbanMember(user, server) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2];
|
||||
|
||||
return this.internal.unbanMember(user, server).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def kickMember
|
||||
|
||||
Client.prototype.kickMember = function kickMember(user, server) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2];
|
||||
|
||||
return this.internal.kickMember(user, server).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def createRole
|
||||
|
||||
Client.prototype.createRole = function createRole(server) {
|
||||
var data = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err, res*/{} : arguments[2];
|
||||
|
||||
if (typeof data === "function") {
|
||||
// data is the callback
|
||||
callback = data;
|
||||
}
|
||||
return this.internal.createRole(server, data).then(function (role) {
|
||||
callback(null, role);
|
||||
return role;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
//def updateRole
|
||||
|
||||
Client.prototype.updateRole = function updateRole(role) {
|
||||
var data = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err, res*/{} : arguments[2];
|
||||
|
||||
if (typeof data === "function") {
|
||||
// data is the callback
|
||||
callback = data;
|
||||
}
|
||||
return this.internal.updateRole(role, data).then(function (role) {
|
||||
callback(null, role);
|
||||
return role;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
//def deleteRole
|
||||
|
||||
Client.prototype.deleteRole = function deleteRole(role) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.deleteRole(role).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def addMemberToRole
|
||||
|
||||
Client.prototype.addMemberToRole = function addMemberToRole(member, role) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2];
|
||||
|
||||
return this.internal.addMemberToRole(member, role).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
// def addUserToRole
|
||||
|
||||
Client.prototype.addUserToRole = function addUserToRole(member, role) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2];
|
||||
|
||||
return this.addMemberToRole(member, role, callback);
|
||||
};
|
||||
|
||||
// def removeMemberFromRole
|
||||
|
||||
Client.prototype.removeMemberFromRole = function removeMemberFromRole(member, role) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2];
|
||||
|
||||
return this.internal.removeMemberFromRole(member, role).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
// def removeUserFromRole
|
||||
|
||||
Client.prototype.removeUserFromRole = function removeUserFromRole(member, role) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2];
|
||||
|
||||
return this.removeMemberFromRole(member, role, callback);
|
||||
};
|
||||
|
||||
// def createInvite
|
||||
|
||||
Client.prototype.createInvite = function createInvite(chanServ, options) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err, invite*/{} : arguments[2];
|
||||
|
||||
if (typeof options === "function") {
|
||||
// length is the callback
|
||||
callback = options;
|
||||
}
|
||||
|
||||
return this.internal.createInvite(chanServ, options).then(function (invite) {
|
||||
callback(null, invite);
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def deleteInvite
|
||||
|
||||
Client.prototype.deleteInvite = function deleteInvite(invite) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.deleteInvite(invite).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
// def overwritePermissions
|
||||
|
||||
Client.prototype.overwritePermissions = function overwritePermissions(channel, role) {
|
||||
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err*/{} : arguments[3];
|
||||
|
||||
return this.internal.overwritePermissions(channel, role, options).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def setStatus
|
||||
|
||||
Client.prototype.setStatus = function setStatus(idleStatus, gameID) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2];
|
||||
|
||||
if (typeof gameID === "function") {
|
||||
// gameID is the callback
|
||||
callback = gameID;
|
||||
} else if (typeof idleStatus === "function") {
|
||||
// idleStatus is the callback
|
||||
callback = idleStatus;
|
||||
}
|
||||
|
||||
return this.internal.setStatus(idleStatus, gameID).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def sendTyping
|
||||
|
||||
Client.prototype.sendTyping = function sendTyping(channel) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.sendTyping(channel).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
// def setTopic
|
||||
|
||||
Client.prototype.setTopic = function setTopic(channel, topic) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2];
|
||||
|
||||
return this.internal.setTopic(channel, topic).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def setChannelName
|
||||
|
||||
Client.prototype.setChannelName = function setChannelName(channel, name) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2];
|
||||
|
||||
return this.internal.setChannelName(channel, name).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def setChannelNameAndTopic
|
||||
|
||||
Client.prototype.setChannelNameAndTopic = function setChannelNameAndTopic(channel, name, topic) {
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err*/{} : arguments[3];
|
||||
|
||||
return this.internal.setChannelNameAndTopic(channel, name, topic).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def updateChannel
|
||||
|
||||
Client.prototype.updateChannel = function updateChannel(channel, data) {
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2];
|
||||
|
||||
return this.internal.updateChannel(channel, data).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def startTyping
|
||||
|
||||
Client.prototype.startTyping = function startTyping(channel) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.startTyping(channel).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def stopTyping
|
||||
|
||||
Client.prototype.stopTyping = function stopTyping(channel) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.stopTyping(channel).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def updateDetails
|
||||
|
||||
Client.prototype.updateDetails = function updateDetails(details) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.updateDetails(details).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def setUsername
|
||||
|
||||
Client.prototype.setUsername = function setUsername(name) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.setUsername(name).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def setAvatar
|
||||
|
||||
Client.prototype.setAvatar = function setAvatar(avatar) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.setAvatar(avatar).then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
//def joinVoiceChannel
|
||||
|
||||
Client.prototype.joinVoiceChannel = function joinVoiceChannel(channel) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err*/{} : arguments[1];
|
||||
|
||||
return this.internal.joinVoiceChannel(channel).then(function (chan) {
|
||||
callback(null, chan);
|
||||
return chan;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
// def leaveVoiceChannel
|
||||
|
||||
Client.prototype.leaveVoiceChannel = function leaveVoiceChannel() {
|
||||
var callback = arguments.length <= 0 || arguments[0] === undefined ? function () /*err*/{} : arguments[0];
|
||||
|
||||
return this.internal.leaveVoiceChannel().then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
// def awaitResponse
|
||||
|
||||
Client.prototype.awaitResponse = function awaitResponse(msg) {
|
||||
var toSend = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
|
||||
|
||||
var _this = this;
|
||||
|
||||
var options = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*e, newMsg*/{} : arguments[3];
|
||||
|
||||
var ret;
|
||||
|
||||
if (toSend) {
|
||||
if (typeof toSend === "function") {
|
||||
// (msg, callback)
|
||||
callback = toSend;
|
||||
} else {
|
||||
// (msg, toSend, ...)
|
||||
if (options) {
|
||||
if (typeof options === "function") {
|
||||
//(msg, toSend, callback)
|
||||
callback = options;
|
||||
ret = this.sendMessage(msg, toSend);
|
||||
} else {
|
||||
//(msg, toSend, options, callback)
|
||||
ret = this.sendMessage(msg, toSend, options);
|
||||
}
|
||||
} else {
|
||||
// (msg, toSend) promise
|
||||
ret = this.sendMessage(msg, toSend);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
ret = Promise.resolve();
|
||||
}
|
||||
// (msg) promise
|
||||
return ret.then(function () {
|
||||
return _this.internal.awaitResponse(msg);
|
||||
}).then(function (newMsg) {
|
||||
callback(null, newMsg);
|
||||
return newMsg;
|
||||
}, errCB(callback));
|
||||
};
|
||||
|
||||
Client.prototype.setStatusIdle = function setStatusIdle() {
|
||||
var callback = arguments.length <= 0 || arguments[0] === undefined ? function () /*err*/{} : arguments[0];
|
||||
|
||||
return this.internal.setStatus("idle").then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
Client.prototype.setStatusOnline = function setStatusOnline() {
|
||||
var callback = arguments.length <= 0 || arguments[0] === undefined ? function () /*err*/{} : arguments[0];
|
||||
|
||||
return this.internal.setStatus("online").then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
Client.prototype.setStatusActive = function setStatusActive(callback) {
|
||||
return this.setStatusOnline(callback);
|
||||
};
|
||||
|
||||
Client.prototype.setStatusHere = function setStatusHere(callback) {
|
||||
return this.setStatusOnline(callback);
|
||||
};
|
||||
|
||||
Client.prototype.setStatusAvailable = function setStatusAvailable(callback) {
|
||||
return this.setStatusOnline(callback);
|
||||
};
|
||||
|
||||
Client.prototype.setStatusAway = function setStatusAway(callback) {
|
||||
return this.setStatusIdle(callback);
|
||||
};
|
||||
|
||||
Client.prototype.setPlayingGame = function setPlayingGame(game) {
|
||||
return this.setStatus(null, game);
|
||||
};
|
||||
|
||||
_createClass(Client, [{
|
||||
key: "users",
|
||||
get: function get() {
|
||||
return this.internal.users;
|
||||
}
|
||||
}, {
|
||||
key: "channels",
|
||||
get: function get() {
|
||||
return this.internal.channels;
|
||||
}
|
||||
}, {
|
||||
key: "servers",
|
||||
get: function get() {
|
||||
return this.internal.servers;
|
||||
}
|
||||
}, {
|
||||
key: "privateChannels",
|
||||
get: function get() {
|
||||
return this.internal.private_channels;
|
||||
}
|
||||
}, {
|
||||
key: "voiceConnection",
|
||||
get: function get() {
|
||||
return this.internal.voiceConnection;
|
||||
}
|
||||
}, {
|
||||
key: "readyTime",
|
||||
get: function get() {
|
||||
return this.internal.readyTime;
|
||||
}
|
||||
}, {
|
||||
key: "uptime",
|
||||
get: function get() {
|
||||
return this.internal.uptime;
|
||||
}
|
||||
}, {
|
||||
key: "user",
|
||||
get: function get() {
|
||||
return this.internal.user;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Client;
|
||||
})(_events2["default"]);
|
||||
|
||||
exports["default"] = Client;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,11 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = {
|
||||
IDLE: 0,
|
||||
LOGGING_IN: 1,
|
||||
LOGGED_IN: 2,
|
||||
READY: 3,
|
||||
DISCONNECTED: 4
|
||||
};
|
||||
module.exports = exports["default"];
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,248 +0,0 @@
|
||||
"use strict";
|
||||
/* global Buffer */
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var _fs = require("fs");
|
||||
|
||||
var _fs2 = _interopRequireDefault(_fs);
|
||||
|
||||
var _StructuresUser = require("../../Structures/User");
|
||||
|
||||
var _StructuresUser2 = _interopRequireDefault(_StructuresUser);
|
||||
|
||||
var _StructuresChannel = require("../../Structures/Channel");
|
||||
|
||||
var _StructuresChannel2 = _interopRequireDefault(_StructuresChannel);
|
||||
|
||||
var _StructuresTextChannel = require("../../Structures/TextChannel");
|
||||
|
||||
var _StructuresTextChannel2 = _interopRequireDefault(_StructuresTextChannel);
|
||||
|
||||
var _StructuresVoiceChannel = require("../../Structures/VoiceChannel");
|
||||
|
||||
var _StructuresVoiceChannel2 = _interopRequireDefault(_StructuresVoiceChannel);
|
||||
|
||||
var _StructuresServerChannel = require("../../Structures/ServerChannel");
|
||||
|
||||
var _StructuresServerChannel2 = _interopRequireDefault(_StructuresServerChannel);
|
||||
|
||||
var _StructuresPMChannel = require("../../Structures/PMChannel");
|
||||
|
||||
var _StructuresPMChannel2 = _interopRequireDefault(_StructuresPMChannel);
|
||||
|
||||
var _StructuresServer = require("../../Structures/Server");
|
||||
|
||||
var _StructuresServer2 = _interopRequireDefault(_StructuresServer);
|
||||
|
||||
var _StructuresMessage = require("../../Structures/Message");
|
||||
|
||||
var _StructuresMessage2 = _interopRequireDefault(_StructuresMessage);
|
||||
|
||||
var _StructuresInvite = require("../../Structures/Invite");
|
||||
|
||||
var _StructuresInvite2 = _interopRequireDefault(_StructuresInvite);
|
||||
|
||||
var _refGameMap = require("../../../ref/gameMap");
|
||||
|
||||
var _refGameMap2 = _interopRequireDefault(_refGameMap);
|
||||
|
||||
var Resolver = (function () {
|
||||
function Resolver(internal) {
|
||||
_classCallCheck(this, Resolver);
|
||||
|
||||
this.internal = internal;
|
||||
}
|
||||
|
||||
Resolver.prototype.resolveGameID = function resolveGameID(resource) {
|
||||
if (!isNaN(resource) && parseInt(resource) % 1 === 0) {
|
||||
return resource;
|
||||
}
|
||||
if (typeof resource === "string" || resource instanceof String) {
|
||||
var gameName = resource.toLowerCase();
|
||||
var found = _refGameMap2["default"].find(function (game) {
|
||||
return game.name.toLowerCase() === gameName;
|
||||
});
|
||||
if (found) {
|
||||
return found.id;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveToBase64 = function resolveToBase64(resource) {
|
||||
if (resource instanceof Buffer) {
|
||||
resource = resource.toString("base64");
|
||||
resource = "data:image/jpg;base64," + resource;
|
||||
}
|
||||
return resource;
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveInviteID = function resolveInviteID(resource) {
|
||||
if (resource instanceof _StructuresInvite2["default"]) {
|
||||
return resource.id;
|
||||
}
|
||||
if (typeof resource === "string" || resource instanceof String) {
|
||||
if (resource.indexOf("http") === 0) {
|
||||
var split = resource.split("/");
|
||||
return split.pop();
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveServer = function resolveServer(resource) {
|
||||
if (resource instanceof _StructuresServer2["default"]) {
|
||||
return resource;
|
||||
}
|
||||
if (resource instanceof _StructuresServerChannel2["default"]) {
|
||||
return resource.server;
|
||||
}
|
||||
if (resource instanceof String || typeof resource === "string") {
|
||||
return this.internal.servers.get("id", resource);
|
||||
}
|
||||
if (resource instanceof _StructuresMessage2["default"]) {
|
||||
if (resource.channel instanceof _StructuresTextChannel2["default"]) {
|
||||
return resource.server;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveFile = function resolveFile(resource) {
|
||||
if (typeof resource === "string" || resource instanceof String) {
|
||||
return _fs2["default"].createReadStream(resource);
|
||||
}
|
||||
return resource;
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveMentions = function resolveMentions(resource) {
|
||||
// resource is a string
|
||||
var _mentions = [];
|
||||
for (var _iterator = resource.match(/<@[^>]*>/g) || [], _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var mention = _ref;
|
||||
|
||||
_mentions.push(mention.substring(2, mention.length - 1));
|
||||
}
|
||||
return _mentions;
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveString = function resolveString(resource) {
|
||||
|
||||
// accepts Array, Channel, Server, User, Message, String and anything
|
||||
// toString()-able
|
||||
|
||||
var final = resource;
|
||||
if (resource instanceof Array) {
|
||||
final = resource.join("\n");
|
||||
}
|
||||
|
||||
return final.toString();
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveUser = function resolveUser(resource) {
|
||||
/*
|
||||
accepts a Message, Channel, Server, String ID, User, PMChannel
|
||||
*/
|
||||
if (resource instanceof _StructuresUser2["default"]) {
|
||||
return resource;
|
||||
}
|
||||
if (resource instanceof _StructuresMessage2["default"]) {
|
||||
return resource.author;
|
||||
}
|
||||
if (resource instanceof _StructuresTextChannel2["default"]) {
|
||||
var lmsg = resource.lastMessage;
|
||||
if (lmsg) {
|
||||
return lmsg.author;
|
||||
}
|
||||
}
|
||||
if (resource instanceof _StructuresServer2["default"]) {
|
||||
return resource.owner;
|
||||
}
|
||||
if (resource instanceof _StructuresPMChannel2["default"]) {
|
||||
return resource.recipient;
|
||||
}
|
||||
if (resource instanceof String || typeof resource === "string") {
|
||||
return this.client.internal.users.get("id", resource);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveMessage = function resolveMessage(resource) {
|
||||
// accepts a Message, PMChannel & TextChannel
|
||||
|
||||
if (resource instanceof _StructuresTextChannel2["default"] || resource instanceof _StructuresPMChannel2["default"]) {
|
||||
return resource.lastMessage;
|
||||
}
|
||||
if (resource instanceof _StructuresMessage2["default"]) {
|
||||
return resource;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveVoiceChannel = function resolveVoiceChannel(resource) {
|
||||
// resolveChannel will also work but this is more apt
|
||||
if (resource instanceof _StructuresVoiceChannel2["default"]) {
|
||||
return resource;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveChannel = function resolveChannel(resource) {
|
||||
/*
|
||||
accepts a Message, Channel, Server, String ID, User
|
||||
*/
|
||||
|
||||
if (resource instanceof _StructuresMessage2["default"]) {
|
||||
return Promise.resolve(resource.channel);
|
||||
}
|
||||
if (resource instanceof _StructuresChannel2["default"]) {
|
||||
return Promise.resolve(resource);
|
||||
}
|
||||
if (resource instanceof _StructuresServer2["default"]) {
|
||||
return Promise.resolve(resource.channels.get("id", resource.id));
|
||||
}
|
||||
if (resource instanceof String || typeof resource === "string") {
|
||||
return Promise.resolve(this.internal.channels.get("id", resource));
|
||||
}
|
||||
if (resource instanceof _StructuresUser2["default"]) {
|
||||
// see if a PM exists
|
||||
var chatFound = this.internal.private_channels.find(function (pmchat) {
|
||||
return pmchat.recipient.equals(resource);
|
||||
});
|
||||
if (chatFound) {
|
||||
// a PM already exists!
|
||||
return Promise.resolve(chatFound);
|
||||
}
|
||||
// PM does not exist :\
|
||||
return this.internal.startPM(resource);
|
||||
}
|
||||
var error = new Error("Could not resolve channel");
|
||||
error.resource = resource;
|
||||
return Promise.reject(error);
|
||||
};
|
||||
|
||||
return Resolver;
|
||||
})();
|
||||
|
||||
exports["default"] = Resolver;
|
||||
module.exports = exports["default"];
|
||||
130
lib/Constants.js
130
lib/Constants.js
@@ -1,130 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
var API = "https://discordapp.com/api";
|
||||
exports.API = API;
|
||||
var Endpoints = {
|
||||
// general endpoints
|
||||
LOGIN: API + "/auth/login",
|
||||
LOGOUT: API + "/auth/logout",
|
||||
ME: API + "/users/@me",
|
||||
GATEWAY: API + "/gateway",
|
||||
USER_CHANNELS: function USER_CHANNELS(userID) {
|
||||
return API + "/users/" + userID + "/channels";
|
||||
},
|
||||
AVATAR: function AVATAR(userID, avatar) {
|
||||
return API + "/users/" + userID + "/avatars/" + avatar + ".jpg";
|
||||
},
|
||||
INVITE: function INVITE(id) {
|
||||
return API + "/invite/" + id;
|
||||
},
|
||||
|
||||
// servers
|
||||
SERVERS: API + "/guilds",
|
||||
SERVER: function SERVER(serverID) {
|
||||
return Endpoints.SERVERS + "/" + serverID;
|
||||
},
|
||||
SERVER_ICON: function SERVER_ICON(serverID, hash) {
|
||||
return Endpoints.SERVER(serverID) + "/icons/" + hash + ".jpg";
|
||||
},
|
||||
SERVER_PRUNE: function SERVER_PRUNE(serverID) {
|
||||
return Endpoints.SERVER(serverID) + "/prune";
|
||||
},
|
||||
SERVER_EMBED: function SERVER_EMBED(serverID) {
|
||||
return Endpoints.SERVER(serverID) + "/embed";
|
||||
},
|
||||
SERVER_INVITES: function SERVER_INVITES(serverID) {
|
||||
return Endpoints.SERVER(serverID) + "/invites";
|
||||
},
|
||||
SERVER_ROLES: function SERVER_ROLES(serverID) {
|
||||
return Endpoints.SERVER(serverID) + "/roles";
|
||||
},
|
||||
SERVER_BANS: function SERVER_BANS(serverID) {
|
||||
return Endpoints.SERVER(serverID) + "/bans";
|
||||
},
|
||||
SERVER_INTEGRATIONS: function SERVER_INTEGRATIONS(serverID) {
|
||||
return Endpoints.SERVER(serverID) + "/integrations";
|
||||
},
|
||||
SERVER_MEMBERS: function SERVER_MEMBERS(serverID) {
|
||||
return Endpoints.SERVER(serverID) + "/members";
|
||||
},
|
||||
SERVER_CHANNELS: function SERVER_CHANNELS(serverID) {
|
||||
return Endpoints.SERVER(serverID) + "/channels";
|
||||
},
|
||||
|
||||
// channels
|
||||
CHANNELS: API + "/channels",
|
||||
CHANNEL: function CHANNEL(channelID) {
|
||||
return Endpoints.CHANNELS + "/" + channelID;
|
||||
},
|
||||
CHANNEL_MESSAGES: function CHANNEL_MESSAGES(channelID) {
|
||||
return Endpoints.CHANNEL(channelID) + "/messages";
|
||||
},
|
||||
CHANNEL_INVITES: function CHANNEL_INVITES(channelID) {
|
||||
return Endpoints.CHANNEL(channelID) + "/invites";
|
||||
},
|
||||
CHANNEL_TYPING: function CHANNEL_TYPING(channelID) {
|
||||
return Endpoints.CHANNEL(channelID) + "/typing";
|
||||
},
|
||||
CHANNEL_PERMISSIONS: function CHANNEL_PERMISSIONS(channelID) {
|
||||
return Endpoints.CHANNEL(channelID) + "/permissions";
|
||||
},
|
||||
CHANNEL_MESSAGE: function CHANNEL_MESSAGE(channelID, messageID) {
|
||||
return Endpoints.CHANNEL_MESSAGES(channelID) + "/" + messageID;
|
||||
}
|
||||
};
|
||||
|
||||
exports.Endpoints = Endpoints;
|
||||
var Permissions = {
|
||||
// general
|
||||
createInstantInvite: 1 << 0,
|
||||
kickMembers: 1 << 1,
|
||||
banMembers: 1 << 2,
|
||||
manageRoles: 1 << 3,
|
||||
managePermissions: 1 << 3,
|
||||
manageChannels: 1 << 4,
|
||||
manageChannel: 1 << 4,
|
||||
manageServer: 1 << 5,
|
||||
// text
|
||||
readMessages: 1 << 10,
|
||||
sendMessages: 1 << 11,
|
||||
sendTTSMessages: 1 << 12,
|
||||
manageMessages: 1 << 13,
|
||||
embedLinks: 1 << 14,
|
||||
attachFiles: 1 << 15,
|
||||
readMessageHistory: 1 << 16,
|
||||
mentionEveryone: 1 << 17,
|
||||
// voice
|
||||
voiceConnect: 1 << 20,
|
||||
voiceSpeak: 1 << 21,
|
||||
voiceMuteMembers: 1 << 22,
|
||||
voiceDeafenMembers: 1 << 23,
|
||||
voiceMoveMembers: 1 << 24,
|
||||
voiceUseVAD: 1 << 25
|
||||
|
||||
};
|
||||
|
||||
exports.Permissions = Permissions;
|
||||
var PacketType = {
|
||||
READY: "READY",
|
||||
MESSAGE_CREATE: "MESSAGE_CREATE",
|
||||
MESSAGE_UPDATE: "MESSAGE_UPDATE",
|
||||
MESSAGE_DELETE: "MESSAGE_DELETE",
|
||||
SERVER_CREATE: "GUILD_CREATE",
|
||||
SERVER_DELETE: "GUILD_DELETE",
|
||||
SERVER_UPDATE: "GUILD_UPDATE",
|
||||
CHANNEL_CREATE: "CHANNEL_CREATE",
|
||||
CHANNEL_DELETE: "CHANNEL_DELETE",
|
||||
CHANNEL_UPDATE: "CHANNEL_UPDATE",
|
||||
SERVER_ROLE_CREATE: "GUILD_ROLE_CREATE",
|
||||
SERVER_ROLE_DELETE: "GUILD_ROLE_DELETE",
|
||||
SERVER_ROLE_UPDATE: "GUILD_ROLE_UPDATE",
|
||||
SERVER_MEMBER_ADD: "GUILD_MEMBER_ADD",
|
||||
SERVER_MEMBER_REMOVE: "GUILD_MEMBER_REMOVE",
|
||||
SERVER_MEMBER_UPDATE: "GUILD_MEMBER_UPDATE",
|
||||
PRESENCE_UPDATE: "PRESENCE_UPDATE",
|
||||
TYPING: "TYPING_START",
|
||||
SERVER_BAN_ADD: "GUILD_BAN_ADD",
|
||||
SERVER_BAN_REMOVE: "GUILD_BAN_REMOVE"
|
||||
};
|
||||
exports.PacketType = PacketType;
|
||||
@@ -1,45 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _UtilEquality = require("../Util/Equality");
|
||||
|
||||
var _UtilEquality2 = _interopRequireDefault(_UtilEquality);
|
||||
|
||||
var _UtilArgumentRegulariser = require("../Util/ArgumentRegulariser");
|
||||
|
||||
var Channel = (function (_Equality) {
|
||||
_inherits(Channel, _Equality);
|
||||
|
||||
function Channel(data, client) {
|
||||
_classCallCheck(this, Channel);
|
||||
|
||||
_Equality.call(this);
|
||||
this.id = data.id;
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
Channel.prototype["delete"] = function _delete() {
|
||||
return this.client.deleteChannel.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
_createClass(Channel, [{
|
||||
key: "isPrivate",
|
||||
get: function get() {
|
||||
return !!this.server;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Channel;
|
||||
})(_UtilEquality2["default"]);
|
||||
|
||||
exports["default"] = Channel;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,78 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var _Constants = require("../Constants");
|
||||
|
||||
var ChannelPermissions = (function () {
|
||||
function ChannelPermissions(permissions) {
|
||||
_classCallCheck(this, ChannelPermissions);
|
||||
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
ChannelPermissions.prototype.serialise = function serialise(explicit) {
|
||||
var _this = this;
|
||||
|
||||
var hp = function hp(perm) {
|
||||
return _this.hasPermission(perm, explicit);
|
||||
};
|
||||
|
||||
return {
|
||||
// general
|
||||
createInstantInvite: hp(_Constants.Permissions.createInstantInvite),
|
||||
kickMembers: hp(_Constants.Permissions.kickMembers),
|
||||
banMembers: hp(_Constants.Permissions.banMembers),
|
||||
managePermissions: hp(_Constants.Permissions.managePermissions),
|
||||
manageChannel: hp(_Constants.Permissions.manageChannel),
|
||||
manageServer: hp(_Constants.Permissions.manageServer),
|
||||
// text
|
||||
readMessages: hp(_Constants.Permissions.readMessages),
|
||||
sendMessages: hp(_Constants.Permissions.sendMessages),
|
||||
sendTTSMessages: hp(_Constants.Permissions.sendTTSMessages),
|
||||
manageMessages: hp(_Constants.Permissions.manageMessages),
|
||||
embedLinks: hp(_Constants.Permissions.embedLinks),
|
||||
attachFiles: hp(_Constants.Permissions.attachFiles),
|
||||
readMessageHistory: hp(_Constants.Permissions.readMessageHistory),
|
||||
mentionEveryone: hp(_Constants.Permissions.mentionEveryone),
|
||||
// voice
|
||||
voiceConnect: hp(_Constants.Permissions.voiceConnect),
|
||||
voiceSpeak: hp(_Constants.Permissions.voiceSpeak),
|
||||
voiceMuteMembers: hp(_Constants.Permissions.voiceMuteMembers),
|
||||
voiceDeafenMembers: hp(_Constants.Permissions.voiceDeafenMembers),
|
||||
voiceMoveMembers: hp(_Constants.Permissions.voiceMoveMembers),
|
||||
voiceUseVAD: hp(_Constants.Permissions.voiceUseVAD)
|
||||
};
|
||||
};
|
||||
|
||||
ChannelPermissions.prototype.serialize = function serialize() {
|
||||
// ;n;
|
||||
return this.serialise();
|
||||
};
|
||||
|
||||
ChannelPermissions.prototype.hasPermission = function hasPermission(perm) {
|
||||
var explicit = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
|
||||
|
||||
if (perm instanceof String || typeof perm === "string") {
|
||||
perm = _Constants.Permissions[perm];
|
||||
}
|
||||
if (!perm) {
|
||||
return false;
|
||||
}
|
||||
if (!explicit) {
|
||||
// implicit permissions allowed
|
||||
if (!!(this.permissions & _Constants.Permissions.manageRoles)) {
|
||||
// manageRoles allowed, they have all permissions
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return !!(this.permissions & perm);
|
||||
};
|
||||
|
||||
return ChannelPermissions;
|
||||
})();
|
||||
|
||||
exports["default"] = ChannelPermissions;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,32 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Invite = (function () {
|
||||
function Invite(data, chan, client) {
|
||||
_classCallCheck(this, Invite);
|
||||
|
||||
this.maxAge = data.max_age;
|
||||
this.code = data.code;
|
||||
this.server = chan.server;
|
||||
this.channel = chan;
|
||||
this.revoked = data.revoked;
|
||||
this.createdAt = Date.parse(data.created_at);
|
||||
this.temporary = data.temporary;
|
||||
this.uses = data.uses;
|
||||
this.maxUses = data.uses;
|
||||
this.inviter = client.internal.users.get("id", data.inviter.id);
|
||||
this.xkcd = data.xkcdpass;
|
||||
}
|
||||
|
||||
Invite.prototype.toString = function toString() {
|
||||
return "https://discord.gg/" + this.code;
|
||||
};
|
||||
|
||||
return Invite;
|
||||
})();
|
||||
|
||||
exports["default"] = Invite;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,101 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _UtilCache = require("../Util/Cache");
|
||||
|
||||
var _UtilCache2 = _interopRequireDefault(_UtilCache);
|
||||
|
||||
var _User = require("./User");
|
||||
|
||||
var _User2 = _interopRequireDefault(_User);
|
||||
|
||||
var _UtilArgumentRegulariser = require("../Util/ArgumentRegulariser");
|
||||
|
||||
var _UtilEquality = require("../Util/Equality");
|
||||
|
||||
var _UtilEquality2 = _interopRequireDefault(_UtilEquality);
|
||||
|
||||
var Message = (function (_Equality) {
|
||||
_inherits(Message, _Equality);
|
||||
|
||||
function Message(data, channel, client) {
|
||||
var _this = this;
|
||||
|
||||
_classCallCheck(this, Message);
|
||||
|
||||
_Equality.call(this);
|
||||
this.channel = channel;
|
||||
this.client = client;
|
||||
this.nonce = data.nonce;
|
||||
this.attachments = data.attachments;
|
||||
this.tts = data.tts;
|
||||
this.embeds = data.embeds;
|
||||
this.timestamp = Date.parse(data.timestamp);
|
||||
this.everyoneMentioned = data.mention_everyone;
|
||||
this.id = data.id;
|
||||
|
||||
if (data.edited_timestamp) this.editedTimestamp = Date.parse(data.edited_timestamp);
|
||||
|
||||
if (data.author instanceof _User2["default"]) this.author = data.author;else this.author = client.internal.users.add(new _User2["default"](data.author, client));
|
||||
|
||||
this.content = data.content;
|
||||
this.mentions = new _UtilCache2["default"]();
|
||||
|
||||
data.mentions.forEach(function (mention) {
|
||||
// this is .add and not .get because it allows the bot to cache
|
||||
// users from messages from logs who may have left the server and were
|
||||
// not previously cached.
|
||||
if (mention instanceof _User2["default"]) _this.mentions.push(mention);else _this.mentions.add(client.internal.users.add(new _User2["default"](mention, client)));
|
||||
});
|
||||
}
|
||||
|
||||
Message.prototype.isMentioned = function isMentioned(user) {
|
||||
user = this.client.internal.resolver.resolveUser(user);
|
||||
if (user) {
|
||||
return this.mentions.has("id", user.id);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Message.prototype.toString = function toString() {
|
||||
return this.content;
|
||||
};
|
||||
|
||||
Message.prototype["delete"] = function _delete() {
|
||||
return this.client.deleteMessage.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
Message.prototype.update = function update() {
|
||||
return this.client.updateMessage.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
Message.prototype.reply = function reply() {
|
||||
return this.client.reply.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
Message.prototype.replyTTS = function replyTTS() {
|
||||
return this.client.replyTTS.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
_createClass(Message, [{
|
||||
key: "sender",
|
||||
get: function get() {
|
||||
return this.author;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Message;
|
||||
})(_UtilEquality2["default"]);
|
||||
|
||||
exports["default"] = Message;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,66 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _Channel2 = require("./Channel");
|
||||
|
||||
var _Channel3 = _interopRequireDefault(_Channel2);
|
||||
|
||||
var _User = require("./User");
|
||||
|
||||
var _User2 = _interopRequireDefault(_User);
|
||||
|
||||
var _UtilCache = require("../Util/Cache");
|
||||
|
||||
var _UtilCache2 = _interopRequireDefault(_UtilCache);
|
||||
|
||||
var _UtilArgumentRegulariser = require("../Util/ArgumentRegulariser");
|
||||
|
||||
var PMChannel = (function (_Channel) {
|
||||
_inherits(PMChannel, _Channel);
|
||||
|
||||
function PMChannel(data, client) {
|
||||
_classCallCheck(this, PMChannel);
|
||||
|
||||
_Channel.call(this, data, client);
|
||||
|
||||
this.type = data.type || "text";
|
||||
this.lastMessageId = data.last_message_id;
|
||||
this.messages = new _UtilCache2["default"]("id", 1000);
|
||||
this.recipient = this.client.internal.users.add(new _User2["default"](data.recipient, this.client));
|
||||
}
|
||||
|
||||
/* warning! may return null */
|
||||
|
||||
PMChannel.prototype.toString = function toString() {
|
||||
return this.recipient.toString();
|
||||
};
|
||||
|
||||
PMChannel.prototype.sendMessage = function sendMessage() {
|
||||
return this.client.sendMessage.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
PMChannel.prototype.sendTTSMessage = function sendTTSMessage() {
|
||||
return this.client.sendTTSMessage.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
_createClass(PMChannel, [{
|
||||
key: "lastMessage",
|
||||
get: function get() {
|
||||
return this.messages.get("id", this.lastMessageID);
|
||||
}
|
||||
}]);
|
||||
|
||||
return PMChannel;
|
||||
})(_Channel3["default"]);
|
||||
|
||||
exports["default"] = PMChannel;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,89 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var _Constants = require("../Constants");
|
||||
|
||||
var PermissionOverwrite = (function () {
|
||||
function PermissionOverwrite(data) {
|
||||
_classCallCheck(this, PermissionOverwrite);
|
||||
|
||||
this.id = data.id;
|
||||
this.type = data.type; // member or role
|
||||
this.deny = data.deny;
|
||||
this.allow = data.allow;
|
||||
}
|
||||
|
||||
// returns an array of allowed permissions
|
||||
|
||||
PermissionOverwrite.prototype.setAllowed = function setAllowed(allowedArray) {
|
||||
var _this = this;
|
||||
|
||||
allowedArray.forEach(function (permission) {
|
||||
if (permission instanceof String || typeof permission === "string") {
|
||||
permission = _Constants.Permissions[permission];
|
||||
}
|
||||
if (permission) {
|
||||
_this.allow |= 1 << permission;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
PermissionOverwrite.prototype.setDenied = function setDenied(deniedArray) {
|
||||
var _this2 = this;
|
||||
|
||||
deniedArray.forEach(function (permission) {
|
||||
if (permission instanceof String || typeof permission === "string") {
|
||||
permission = _Constants.Permissions[permission];
|
||||
}
|
||||
if (permission) {
|
||||
_this2.deny |= 1 << permission;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_createClass(PermissionOverwrite, [{
|
||||
key: "allowed",
|
||||
get: function get() {
|
||||
var allowed = [];
|
||||
for (var permName in _Constants.Permissions) {
|
||||
if (permName === "manageRoles" || permName === "manageChannels") {
|
||||
// these permissions do not exist in overwrites.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!!(this.allow & _Constants.Permissions[permName])) {
|
||||
allowed.push(permName);
|
||||
}
|
||||
}
|
||||
return allowed;
|
||||
}
|
||||
|
||||
// returns an array of denied permissions
|
||||
}, {
|
||||
key: "denied",
|
||||
get: function get() {
|
||||
var denied = [];
|
||||
for (var permName in _Constants.Permissions) {
|
||||
if (permName === "manageRoles" || permName === "manageChannels") {
|
||||
// these permissions do not exist in overwrites.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!!(this.deny & _Constants.Permissions[permName])) {
|
||||
denied.push(permName);
|
||||
}
|
||||
}
|
||||
return denied;
|
||||
}
|
||||
}]);
|
||||
|
||||
return PermissionOverwrite;
|
||||
})();
|
||||
|
||||
exports["default"] = PermissionOverwrite;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,142 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var _Constants = require("../Constants");
|
||||
|
||||
/*
|
||||
|
||||
example data
|
||||
|
||||
{ position: -1,
|
||||
permissions: 36953089,
|
||||
name: '@everyone',
|
||||
managed: false,
|
||||
id: '110007368451915776',
|
||||
hoist: false,
|
||||
color: 0 }
|
||||
*/
|
||||
|
||||
var DefaultRole = [_Constants.Permissions.createInstantInvite, _Constants.Permissions.readMessages, _Constants.Permissions.readMessageHistory, _Constants.Permissions.sendMessages, _Constants.Permissions.sendTTSMessages, _Constants.Permissions.embedLinks, _Constants.Permissions.attachFiles, _Constants.Permissions.readMessageHistory, _Constants.Permissions.mentionEveryone, _Constants.Permissions.voiceConnect, _Constants.Permissions.voiceSpeak, _Constants.Permissions.voiceUseVAD].reduce(function (previous, current) {
|
||||
return previous | current;
|
||||
}, 0);
|
||||
|
||||
var Role = (function () {
|
||||
function Role(data, server, client) {
|
||||
_classCallCheck(this, Role);
|
||||
|
||||
this.position = data.position || -1;
|
||||
this.permissions = data.permissions || (data.name === "@everyone" ? DefaultRole : 0);
|
||||
this.name = data.name || "@everyone";
|
||||
this.managed = data.managed || false;
|
||||
this.id = data.id;
|
||||
this.hoist = data.hoist || false;
|
||||
this.color = data.color || 0;
|
||||
this.server = server;
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
Role.prototype.serialise = function serialise(explicit) {
|
||||
var _this = this;
|
||||
|
||||
var hp = function hp(perm) {
|
||||
return _this.hasPermission(perm, explicit);
|
||||
};
|
||||
|
||||
return {
|
||||
// general
|
||||
createInstantInvite: hp(_Constants.Permissions.createInstantInvite),
|
||||
kickMembers: hp(_Constants.Permissions.kickMembers),
|
||||
banMembers: hp(_Constants.Permissions.banMembers),
|
||||
manageRoles: hp(_Constants.Permissions.manageRoles),
|
||||
manageChannels: hp(_Constants.Permissions.manageChannels),
|
||||
manageServer: hp(_Constants.Permissions.manageServer),
|
||||
// text
|
||||
readMessages: hp(_Constants.Permissions.readMessages),
|
||||
sendMessages: hp(_Constants.Permissions.sendMessages),
|
||||
sendTTSMessages: hp(_Constants.Permissions.sendTTSMessages),
|
||||
manageMessages: hp(_Constants.Permissions.manageMessages),
|
||||
embedLinks: hp(_Constants.Permissions.embedLinks),
|
||||
attachFiles: hp(_Constants.Permissions.attachFiles),
|
||||
readMessageHistory: hp(_Constants.Permissions.readMessageHistory),
|
||||
mentionEveryone: hp(_Constants.Permissions.mentionEveryone),
|
||||
// voice
|
||||
voiceConnect: hp(_Constants.Permissions.voiceConnect),
|
||||
voiceSpeak: hp(_Constants.Permissions.voiceSpeak),
|
||||
voiceMuteMembers: hp(_Constants.Permissions.voiceMuteMembers),
|
||||
voiceDeafenMembers: hp(_Constants.Permissions.voiceDeafenMembers),
|
||||
voiceMoveMembers: hp(_Constants.Permissions.voiceMoveMembers),
|
||||
voiceUseVAD: hp(_Constants.Permissions.voiceUseVAD)
|
||||
};
|
||||
};
|
||||
|
||||
Role.prototype.serialize = function serialize() {
|
||||
// ;n;
|
||||
return this.serialise();
|
||||
};
|
||||
|
||||
Role.prototype.hasPermission = function hasPermission(perm) {
|
||||
var explicit = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
|
||||
|
||||
if (perm instanceof String || typeof perm === "string") {
|
||||
perm = _Constants.Permissions[perm];
|
||||
}
|
||||
if (!perm) {
|
||||
return false;
|
||||
}
|
||||
if (!explicit) {
|
||||
// implicit permissions allowed
|
||||
if (!!(this.permissions & _Constants.Permissions.manageRoles)) {
|
||||
// manageRoles allowed, they have all permissions
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// e.g.
|
||||
// !!(36953089 & Permissions.manageRoles) = not allowed to manage roles
|
||||
// !!(36953089 & (1 << 21)) = voice speak allowed
|
||||
|
||||
return !!(this.permissions & perm);
|
||||
};
|
||||
|
||||
Role.prototype.setPermission = function setPermission(permission, value) {
|
||||
if (permission instanceof String || typeof permission === "string") {
|
||||
permission = _Constants.Permissions[permission];
|
||||
}
|
||||
if (permission) {
|
||||
// valid permission
|
||||
if (value) {
|
||||
this.permissions |= permission;
|
||||
} else {
|
||||
this.permissions &= ~permission;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Role.prototype.setPermissions = function setPermissions(obj) {
|
||||
var _this2 = this;
|
||||
|
||||
obj.forEach(function (value, permission) {
|
||||
if (permission instanceof String || typeof permission === "string") {
|
||||
permission = _Constants.Permissions[permission];
|
||||
}
|
||||
if (permission) {
|
||||
// valid permission
|
||||
_this2.setPermission(permission, value);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Role.prototype.colorAsHex = function colorAsHex() {
|
||||
var val = this.color.toString();
|
||||
while (val.length < 6) {
|
||||
val = "0" + val;
|
||||
}
|
||||
return "#" + val;
|
||||
};
|
||||
|
||||
return Role;
|
||||
})();
|
||||
|
||||
exports["default"] = Role;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,205 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _UtilEquality = require("../Util/Equality");
|
||||
|
||||
var _UtilEquality2 = _interopRequireDefault(_UtilEquality);
|
||||
|
||||
var _Constants = require("../Constants");
|
||||
|
||||
var _UtilCache = require("../Util/Cache");
|
||||
|
||||
var _UtilCache2 = _interopRequireDefault(_UtilCache);
|
||||
|
||||
var _User = require("./User");
|
||||
|
||||
var _User2 = _interopRequireDefault(_User);
|
||||
|
||||
var _TextChannel = require("./TextChannel");
|
||||
|
||||
var _TextChannel2 = _interopRequireDefault(_TextChannel);
|
||||
|
||||
var _VoiceChannel = require("./VoiceChannel");
|
||||
|
||||
var _VoiceChannel2 = _interopRequireDefault(_VoiceChannel);
|
||||
|
||||
var _Role = require("./Role");
|
||||
|
||||
var _Role2 = _interopRequireDefault(_Role);
|
||||
|
||||
var strictKeys = ["region", "ownerID", "name", "id", "icon", "afkTimeout", "afkChannelID"];
|
||||
|
||||
var Server = (function (_Equality) {
|
||||
_inherits(Server, _Equality);
|
||||
|
||||
function Server(data, client) {
|
||||
var _this = this;
|
||||
|
||||
_classCallCheck(this, Server);
|
||||
|
||||
_Equality.call(this);
|
||||
|
||||
var self = this;
|
||||
this.client = client;
|
||||
|
||||
this.region = data.region;
|
||||
this.ownerID = data.owner_id;
|
||||
this.name = data.name;
|
||||
this.id = data.id;
|
||||
this.members = new _UtilCache2["default"]();
|
||||
this.channels = new _UtilCache2["default"]();
|
||||
this.roles = new _UtilCache2["default"]();
|
||||
this.icon = data.icon;
|
||||
this.afkTimeout = data.afkTimeout;
|
||||
this.afkChannelID = data.afk_channel_id;
|
||||
this.memberMap = {};
|
||||
|
||||
var self = this;
|
||||
|
||||
data.roles.forEach(function (dataRole) {
|
||||
_this.roles.add(new _Role2["default"](dataRole, _this, client));
|
||||
});
|
||||
|
||||
data.members.forEach(function (dataUser) {
|
||||
_this.memberMap[dataUser.user.id] = {
|
||||
roles: dataUser.roles.map(function (pid) {
|
||||
return self.roles.get("id", pid);
|
||||
}),
|
||||
mute: dataUser.mute,
|
||||
deaf: dataUser.deaf,
|
||||
joinedAt: Date.parse(dataUser.joined_at)
|
||||
};
|
||||
var user = client.internal.users.add(new _User2["default"](dataUser.user, client));
|
||||
_this.members.add(user);
|
||||
});
|
||||
|
||||
data.channels.forEach(function (dataChannel) {
|
||||
if (dataChannel.type === "text") {
|
||||
var channel = client.internal.channels.add(new _TextChannel2["default"](dataChannel, client, _this));
|
||||
_this.channels.add(channel);
|
||||
} else {
|
||||
var channel = client.internal.channels.add(new _VoiceChannel2["default"](dataChannel, client, _this));
|
||||
_this.channels.add(channel);
|
||||
}
|
||||
});
|
||||
|
||||
if (data.presences) {
|
||||
for (var _iterator = data.presences, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var presence = _ref;
|
||||
|
||||
var user = client.internal.users.get("id", presence.user.id);
|
||||
if (user) {
|
||||
user.status = presence.status;
|
||||
user.gameID = presence.game_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Server.prototype.details = function details(user) {
|
||||
user = this.client.internal.resolver.resolveUser(user);
|
||||
if (user) {
|
||||
return this.memberMap[user.id];
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
Server.prototype.detailsOf = function detailsOf(user) {
|
||||
return this.details(user);
|
||||
};
|
||||
|
||||
Server.prototype.rolesOfUser = function rolesOfUser(user) {
|
||||
user = this.client.internal.resolver.resolveUser(user);
|
||||
if (user) {
|
||||
return this.memberMap[user.id] ? this.memberMap[user.id].roles : [];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
Server.prototype.rolesOf = function rolesOf(user) {
|
||||
return this.rolesOfUser(user);
|
||||
};
|
||||
|
||||
Server.prototype.toString = function toString() {
|
||||
return this.name;
|
||||
};
|
||||
|
||||
Server.prototype.equalsStrict = function equalsStrict(obj) {
|
||||
if (obj instanceof Server) {
|
||||
for (var _iterator2 = strictKeys, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref2 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref2 = _i2.value;
|
||||
}
|
||||
|
||||
var key = _ref2;
|
||||
|
||||
if (obj[key] !== this[key]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
_createClass(Server, [{
|
||||
key: "iconURL",
|
||||
get: function get() {
|
||||
if (!this.icon) {
|
||||
return null;
|
||||
} else {
|
||||
return _Constants.Endpoints.SERVER_ICON(this.id, this.icon);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "afkChannel",
|
||||
get: function get() {
|
||||
return this.channels.get("id", this.afkChannelID);
|
||||
}
|
||||
}, {
|
||||
key: "defaultChannel",
|
||||
get: function get() {
|
||||
return this.channels.get("id", this.id);
|
||||
}
|
||||
}, {
|
||||
key: "owner",
|
||||
get: function get() {
|
||||
return this.members.get("id", this.ownerID);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Server;
|
||||
})(_UtilEquality2["default"]);
|
||||
|
||||
exports["default"] = Server;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,134 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _Channel2 = require("./Channel");
|
||||
|
||||
var _Channel3 = _interopRequireDefault(_Channel2);
|
||||
|
||||
var _UtilCache = require("../Util/Cache");
|
||||
|
||||
var _UtilCache2 = _interopRequireDefault(_UtilCache);
|
||||
|
||||
var _PermissionOverwrite = require("./PermissionOverwrite");
|
||||
|
||||
var _PermissionOverwrite2 = _interopRequireDefault(_PermissionOverwrite);
|
||||
|
||||
var _ChannelPermissions = require("./ChannelPermissions");
|
||||
|
||||
var _ChannelPermissions2 = _interopRequireDefault(_ChannelPermissions);
|
||||
|
||||
var _UtilArgumentRegulariser = require("../Util/ArgumentRegulariser");
|
||||
|
||||
var ServerChannel = (function (_Channel) {
|
||||
_inherits(ServerChannel, _Channel);
|
||||
|
||||
function ServerChannel(data, client, server) {
|
||||
var _this = this;
|
||||
|
||||
_classCallCheck(this, ServerChannel);
|
||||
|
||||
_Channel.call(this, data, client);
|
||||
this.name = data.name;
|
||||
this.type = data.type;
|
||||
this.position = data.position;
|
||||
this.permissionOverwrites = new _UtilCache2["default"]();
|
||||
this.server = server;
|
||||
data.permission_overwrites.forEach(function (permission) {
|
||||
_this.permissionOverwrites.add(new _PermissionOverwrite2["default"](permission));
|
||||
});
|
||||
}
|
||||
|
||||
ServerChannel.prototype.permissionsOf = function permissionsOf(user) {
|
||||
user = this.client.internal.resolver.resolveUser(user);
|
||||
if (user) {
|
||||
if (this.server.owner.equals(user)) {
|
||||
return new _ChannelPermissions2["default"](4294967295);
|
||||
}
|
||||
var everyoneRole = this.server.roles.get("name", "@everyone");
|
||||
|
||||
var userRoles = [everyoneRole].concat(this.server.rolesOf(user) || []);
|
||||
var userRolesID = userRoles.map(function (v) {
|
||||
return v.id;
|
||||
});
|
||||
var roleOverwrites = [],
|
||||
memberOverwrites = [];
|
||||
|
||||
this.permissionOverwrites.forEach(function (overwrite) {
|
||||
if (overwrite.type === "member" && overwrite.id === user.id) {
|
||||
memberOverwrites.push(overwrite);
|
||||
} else if (overwrite.type === "role" && overwrite.id in userRolesID) {
|
||||
roleOverwrites.push(overwrite);
|
||||
}
|
||||
});
|
||||
|
||||
var permissions = 0;
|
||||
|
||||
for (var _iterator = userRoles, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var serverRole = _ref;
|
||||
|
||||
permissions |= serverRole.permissions;
|
||||
}
|
||||
|
||||
for (var _iterator2 = roleOverwrites.concat(memberOverwrites), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref2 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref2 = _i2.value;
|
||||
}
|
||||
|
||||
var overwrite = _ref2;
|
||||
|
||||
permissions = permissions & ~overwrite.deny;
|
||||
permissions = permissions | overwrite.allow;
|
||||
}
|
||||
|
||||
return new _ChannelPermissions2["default"](permissions);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
ServerChannel.prototype.permsOf = function permsOf(user) {
|
||||
return this.permissionsOf(user);
|
||||
};
|
||||
|
||||
ServerChannel.prototype.mention = function mention() {
|
||||
return "<#" + this.id + ">";
|
||||
};
|
||||
|
||||
ServerChannel.prototype.toString = function toString() {
|
||||
return this.mention();
|
||||
};
|
||||
|
||||
ServerChannel.prototype.setName = function setName() {
|
||||
return this.client.setChannelName.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
return ServerChannel;
|
||||
})(_Channel3["default"]);
|
||||
|
||||
exports["default"] = ServerChannel;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,69 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _ServerChannel2 = require("./ServerChannel");
|
||||
|
||||
var _ServerChannel3 = _interopRequireDefault(_ServerChannel2);
|
||||
|
||||
var _UtilCache = require("../Util/Cache");
|
||||
|
||||
var _UtilCache2 = _interopRequireDefault(_UtilCache);
|
||||
|
||||
var _UtilArgumentRegulariser = require("../Util/ArgumentRegulariser");
|
||||
|
||||
var TextChannel = (function (_ServerChannel) {
|
||||
_inherits(TextChannel, _ServerChannel);
|
||||
|
||||
function TextChannel(data, client, server) {
|
||||
_classCallCheck(this, TextChannel);
|
||||
|
||||
_ServerChannel.call(this, data, client, server);
|
||||
|
||||
this.topic = data.topic;
|
||||
this.lastMessageID = data.last_message_id;
|
||||
this.messages = new _UtilCache2["default"]("id", client.options.maximumMessages);
|
||||
}
|
||||
|
||||
/* warning! may return null */
|
||||
|
||||
TextChannel.prototype.setTopic = function setTopic() {
|
||||
return this.client.setTopic.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
TextChannel.prototype.setNameAndTopic = function setNameAndTopic() {
|
||||
return this.client.setChannelNameAndTopic.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
TextChannel.prototype.update = function update() {
|
||||
return this.client.updateChannel.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
TextChannel.prototype.sendMessage = function sendMessage() {
|
||||
return this.client.sendMessage.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
TextChannel.prototype.sendTTSMessage = function sendTTSMessage() {
|
||||
return this.client.sendTTSMessage.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
|
||||
};
|
||||
|
||||
_createClass(TextChannel, [{
|
||||
key: "lastMessage",
|
||||
get: function get() {
|
||||
return this.messages.get("id", this.lastMessageID);
|
||||
}
|
||||
}]);
|
||||
|
||||
return TextChannel;
|
||||
})(_ServerChannel3["default"]);
|
||||
|
||||
exports["default"] = TextChannel;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,70 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _UtilEquality = require("../Util/Equality");
|
||||
|
||||
var _UtilEquality2 = _interopRequireDefault(_UtilEquality);
|
||||
|
||||
var _Constants = require("../Constants");
|
||||
|
||||
var User = (function (_Equality) {
|
||||
_inherits(User, _Equality);
|
||||
|
||||
function User(data, client) {
|
||||
_classCallCheck(this, User);
|
||||
|
||||
_Equality.call(this);
|
||||
this.client = client;
|
||||
this.username = data.username;
|
||||
this.discriminator = data.discriminator;
|
||||
this.id = data.id;
|
||||
this.avatar = data.avatar;
|
||||
this.status = data.status || "offline";
|
||||
this.gameID = data.game_id || null;
|
||||
this.typing = {
|
||||
since: null,
|
||||
channel: null
|
||||
};
|
||||
}
|
||||
|
||||
User.prototype.mention = function mention() {
|
||||
return "<@" + this.id + ">";
|
||||
};
|
||||
|
||||
User.prototype.toString = function toString() {
|
||||
return this.mention();
|
||||
};
|
||||
|
||||
User.prototype.equalsStrict = function equalsStrict(obj) {
|
||||
if (obj instanceof User) return this.id === obj.id && this.username === obj.username && this.discriminator === obj.discriminator && this.avatar === obj.avatar && this.status === obj.status && this.gameID === obj.gameID;else return false;
|
||||
};
|
||||
|
||||
User.prototype.equals = function equals(obj) {
|
||||
if (obj instanceof User) return this.id === obj.id && this.username === obj.username && this.discriminator === obj.discriminator && this.avatar === obj.avatar;else return false;
|
||||
};
|
||||
|
||||
_createClass(User, [{
|
||||
key: "avatarURL",
|
||||
get: function get() {
|
||||
if (!this.avatar) {
|
||||
return null;
|
||||
} else {
|
||||
return _Constants.Endpoints.AVATAR(this.id, this.avatar);
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return User;
|
||||
})(_UtilEquality2["default"]);
|
||||
|
||||
exports["default"] = User;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,28 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _ServerChannel2 = require("./ServerChannel");
|
||||
|
||||
var _ServerChannel3 = _interopRequireDefault(_ServerChannel2);
|
||||
|
||||
var VoiceChannel = (function (_ServerChannel) {
|
||||
_inherits(VoiceChannel, _ServerChannel);
|
||||
|
||||
function VoiceChannel(data, client, server) {
|
||||
_classCallCheck(this, VoiceChannel);
|
||||
|
||||
_ServerChannel.call(this, data, client, server);
|
||||
}
|
||||
|
||||
return VoiceChannel;
|
||||
})(_ServerChannel3["default"]);
|
||||
|
||||
exports["default"] = VoiceChannel;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,8 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.reg = reg;
|
||||
|
||||
function reg(c, a) {
|
||||
return [c].concat(Array.prototype.slice.call(a));
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Cache = (function (_Array) {
|
||||
_inherits(Cache, _Array);
|
||||
|
||||
function Cache(discrim, limit) {
|
||||
_classCallCheck(this, Cache);
|
||||
|
||||
_Array.call(this);
|
||||
this.discrim = discrim || "id";
|
||||
}
|
||||
|
||||
Cache.prototype.get = function get(key, value) {
|
||||
var found = null;
|
||||
this.forEach(function (val, index, array) {
|
||||
if (val.hasOwnProperty(key) && val[key] == value) {
|
||||
found = val;
|
||||
return;
|
||||
}
|
||||
});
|
||||
return found;
|
||||
};
|
||||
|
||||
Cache.prototype.has = function has(object) {
|
||||
return !!this.get(this.discrim, object[this.discrim]);
|
||||
};
|
||||
|
||||
Cache.prototype.getAll = function getAll(key, value) {
|
||||
var found = new Cache(this.discrim);
|
||||
this.forEach(function (val, index, array) {
|
||||
if (val.hasOwnProperty(key) && val[key] == value) {
|
||||
found.push(val);
|
||||
return;
|
||||
}
|
||||
});
|
||||
return found;
|
||||
};
|
||||
|
||||
Cache.prototype.add = function add(data) {
|
||||
var exit = false;
|
||||
for (var _iterator = this, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var item = _ref;
|
||||
|
||||
if (item[this.discrim] === data[this.discrim]) {
|
||||
exit = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (exit) {
|
||||
return exit;
|
||||
} else {
|
||||
if (this.limit && this.length >= this.limit) {
|
||||
this.splice(0, 1);
|
||||
}
|
||||
this.push(data);
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
Cache.prototype.update = function update(old, data) {
|
||||
var item = this.get(this.discrim, old[this.discrim]);
|
||||
if (item) {
|
||||
var index = this.indexOf(item);
|
||||
this[index] = data;
|
||||
return this[index];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Cache.prototype.random = function random() {
|
||||
return this[Math.floor(Math.random() * this.length)];
|
||||
};
|
||||
|
||||
Cache.prototype.remove = function remove(data) {
|
||||
var index = this.indexOf(data);
|
||||
if (~index) {
|
||||
this.splice(index, 1);
|
||||
} else {
|
||||
var item = this.get(this.discrim, data[this.discrim]);
|
||||
if (item) {
|
||||
this.splice(this.indexOf(item), 1);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
return Cache;
|
||||
})(Array);
|
||||
|
||||
exports["default"] = Cache;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
The Equality Class is just used to show
|
||||
that a Class has an ID that can be used to
|
||||
check for equality.
|
||||
|
||||
Never use == or === when comparing
|
||||
objects in discord.js, they will be different
|
||||
instances sometimes.
|
||||
|
||||
Instead, use objectThatExtendsEquality.equals()
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Equality = (function () {
|
||||
function Equality() {
|
||||
_classCallCheck(this, Equality);
|
||||
}
|
||||
|
||||
Equality.prototype.equals = function equals(object) {
|
||||
if (object && object[this.eqDiscriminator] == this[this.eqDiscriminator]) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
Equality.prototype.equalsStrict = function equalsStrict(object) {
|
||||
// override per class type
|
||||
return;
|
||||
};
|
||||
|
||||
_createClass(Equality, [{
|
||||
key: "eqDiscriminator",
|
||||
get: function get() {
|
||||
return "id";
|
||||
}
|
||||
}]);
|
||||
|
||||
return Equality;
|
||||
})();
|
||||
|
||||
exports["default"] = Equality;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,135 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var _child_process = require("child_process");
|
||||
|
||||
var _child_process2 = _interopRequireDefault(_child_process);
|
||||
|
||||
var opus;
|
||||
try {
|
||||
opus = require("node-opus");
|
||||
} catch (e) {
|
||||
// no opus!
|
||||
}
|
||||
|
||||
var AudioEncoder = (function () {
|
||||
function AudioEncoder() {
|
||||
_classCallCheck(this, AudioEncoder);
|
||||
|
||||
if (opus) {
|
||||
this.opus = new opus.OpusEncoder(48000, 1);
|
||||
}
|
||||
this.choice = false;
|
||||
}
|
||||
|
||||
AudioEncoder.prototype.opusBuffer = function opusBuffer(buffer) {
|
||||
|
||||
return this.opus.encode(buffer, 1920);
|
||||
};
|
||||
|
||||
AudioEncoder.prototype.getCommand = function getCommand(force) {
|
||||
|
||||
if (this.choice && force) return choice;
|
||||
|
||||
var choices = ["avconv", "ffmpeg"];
|
||||
|
||||
for (var _iterator = choices, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var choice = _ref;
|
||||
|
||||
var p = _child_process2["default"].spawnSync(choice);
|
||||
if (!p.error) {
|
||||
this.choice = choice;
|
||||
return choice;
|
||||
}
|
||||
}
|
||||
|
||||
return "help";
|
||||
};
|
||||
|
||||
AudioEncoder.prototype.encodeStream = function encodeStream(stream) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function (err, buffer) {} : arguments[1];
|
||||
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
var enc = _child_process2["default"].spawn(self.getCommand(), ["-f", "s16le", "-ar", "48000", "-ac", "1", // this can be 2 but there's no point, discord makes it mono on playback, wasted bandwidth.
|
||||
"-af", "volume=1", "pipe:1", "-i", "-"]);
|
||||
|
||||
stream.pipe(enc.stdin);
|
||||
|
||||
enc.stdout.once("readable", function () {
|
||||
callback(null, {
|
||||
proc: enc,
|
||||
stream: enc.stdout,
|
||||
instream: stream
|
||||
});
|
||||
resolve({
|
||||
proc: enc,
|
||||
stream: enc.stdout,
|
||||
instream: stream
|
||||
});
|
||||
});
|
||||
|
||||
enc.stdout.on("end", function () {
|
||||
callback("end");
|
||||
reject("end");
|
||||
});
|
||||
|
||||
enc.stdout.on("close", function () {
|
||||
callback("close");
|
||||
reject("close");
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
AudioEncoder.prototype.encodeFile = function encodeFile(file) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function (err, buffer) {} : arguments[1];
|
||||
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
var enc = _child_process2["default"].spawn(self.getCommand(), ["-f", "s16le", "-ar", "48000", "-ac", "1", // this can be 2 but there's no point, discord makes it mono on playback, wasted bandwidth.
|
||||
"-af", "volume=1", "pipe:1", "-i", file]);
|
||||
|
||||
enc.stdout.once("readable", function () {
|
||||
callback(null, {
|
||||
proc: enc,
|
||||
stream: enc.stdout
|
||||
});
|
||||
resolve({
|
||||
proc: enc,
|
||||
stream: enc.stdout
|
||||
});
|
||||
});
|
||||
|
||||
enc.stdout.on("end", function () {
|
||||
callback("end");
|
||||
reject("end");
|
||||
});
|
||||
|
||||
enc.stdout.on("close", function () {
|
||||
callback("close");
|
||||
reject("close");
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return AudioEncoder;
|
||||
})();
|
||||
|
||||
exports["default"] = AudioEncoder;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,28 +0,0 @@
|
||||
"use strict";
|
||||
// represents an intent of streaming music
|
||||
exports.__esModule = true;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _events = require("events");
|
||||
|
||||
var _events2 = _interopRequireDefault(_events);
|
||||
|
||||
var StreamIntent = (function (_EventEmitter) {
|
||||
_inherits(StreamIntent, _EventEmitter);
|
||||
|
||||
function StreamIntent() {
|
||||
_classCallCheck(this, StreamIntent);
|
||||
|
||||
_EventEmitter.call(this);
|
||||
}
|
||||
|
||||
return StreamIntent;
|
||||
})(_events2["default"]);
|
||||
|
||||
exports["default"] = StreamIntent;
|
||||
module.exports = exports["default"];
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user