nyxlink 0.0.0-stage → 0.1.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +172 -0
- package/README.md +82 -2
- package/assets/nyxlink_banner.png +0 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -0
- package/dist/src/Util.d.ts +110 -0
- package/dist/src/Util.js +621 -0
- package/dist/src/Util.js.map +1 -0
- package/dist/src/autoplay/AutoPlayManager.d.ts +6 -0
- package/dist/src/autoplay/AutoPlayManager.js +36 -0
- package/dist/src/autoplay/AutoPlayManager.js.map +1 -0
- package/dist/src/autoplay/RecommendationResolver.d.ts +6 -0
- package/dist/src/autoplay/RecommendationResolver.js +115 -0
- package/dist/src/autoplay/RecommendationResolver.js.map +1 -0
- package/dist/src/backends/BackendAdapter.d.ts +13 -0
- package/dist/src/backends/BackendAdapter.js +25 -0
- package/dist/src/backends/BackendAdapter.js.map +1 -0
- package/dist/src/backends/BackendDetector.d.ts +4 -0
- package/dist/src/backends/BackendDetector.js +32 -0
- package/dist/src/backends/BackendDetector.js.map +1 -0
- package/dist/src/backends/LavalinkAdapter.d.ts +4 -0
- package/dist/src/backends/LavalinkAdapter.js +9 -0
- package/dist/src/backends/LavalinkAdapter.js.map +1 -0
- package/dist/src/backends/NodeLinkAdapter.d.ts +4 -0
- package/dist/src/backends/NodeLinkAdapter.js +9 -0
- package/dist/src/backends/NodeLinkAdapter.js.map +1 -0
- package/dist/src/connectors/Connector.d.ts +8 -0
- package/dist/src/connectors/Connector.js +11 -0
- package/dist/src/connectors/Connector.js.map +1 -0
- package/dist/src/connectors/DiscordJs.d.ts +10 -0
- package/dist/src/connectors/DiscordJs.js +49 -0
- package/dist/src/connectors/DiscordJs.js.map +1 -0
- package/dist/src/connectors/index.d.ts +4 -0
- package/dist/src/connectors/index.js +8 -0
- package/dist/src/connectors/index.js.map +1 -0
- package/dist/src/core/Manager.d.ts +44 -0
- package/dist/src/core/Manager.js +328 -0
- package/dist/src/core/Manager.js.map +1 -0
- package/dist/src/database/Local.d.ts +23 -0
- package/dist/src/database/Local.js +134 -0
- package/dist/src/database/Local.js.map +1 -0
- package/dist/src/database/Memory.d.ts +14 -0
- package/dist/src/database/Memory.js +86 -0
- package/dist/src/database/Memory.js.map +1 -0
- package/dist/src/database/StorageAdapter.d.ts +12 -0
- package/dist/src/database/StorageAdapter.js +3 -0
- package/dist/src/database/StorageAdapter.js.map +1 -0
- package/dist/src/entities/Filters.d.ts +72 -0
- package/dist/src/entities/Filters.js +559 -0
- package/dist/src/entities/Filters.js.map +1 -0
- package/dist/src/entities/Node.d.ts +243 -0
- package/dist/src/entities/Node.js +1257 -0
- package/dist/src/entities/Node.js.map +1 -0
- package/dist/src/entities/Player.d.ts +152 -0
- package/dist/src/entities/Player.js +1083 -0
- package/dist/src/entities/Player.js.map +1 -0
- package/dist/src/entities/Queue.d.ts +47 -0
- package/dist/src/entities/Queue.js +305 -0
- package/dist/src/entities/Queue.js.map +1 -0
- package/dist/src/entities/Rest.d.ts +83 -0
- package/dist/src/entities/Rest.js +428 -0
- package/dist/src/entities/Rest.js.map +1 -0
- package/dist/src/entities/Track.d.ts +33 -0
- package/dist/src/entities/Track.js +160 -0
- package/dist/src/entities/Track.js.map +1 -0
- package/dist/src/entities/Voice.d.ts +54 -0
- package/dist/src/entities/Voice.js +378 -0
- package/dist/src/entities/Voice.js.map +1 -0
- package/dist/src/entities/VoicePacketHandler.d.ts +4 -0
- package/dist/src/entities/VoicePacketHandler.js +33 -0
- package/dist/src/entities/VoicePacketHandler.js.map +1 -0
- package/dist/src/entities/VoiceReceiver.d.ts +42 -0
- package/dist/src/entities/VoiceReceiver.js +114 -0
- package/dist/src/entities/VoiceReceiver.js.map +1 -0
- package/dist/src/entities/YouTubeLiveChat.d.ts +54 -0
- package/dist/src/entities/YouTubeLiveChat.js +95 -0
- package/dist/src/entities/YouTubeLiveChat.js.map +1 -0
- package/dist/src/errors/FeatureUnavailableError.d.ts +7 -0
- package/dist/src/errors/FeatureUnavailableError.js +18 -0
- package/dist/src/errors/FeatureUnavailableError.js.map +1 -0
- package/dist/src/errors/HttpError.d.ts +6 -0
- package/dist/src/errors/HttpError.js +17 -0
- package/dist/src/errors/HttpError.js.map +1 -0
- package/dist/src/logging/Banner.d.ts +1 -0
- package/dist/src/logging/Banner.js +18 -0
- package/dist/src/logging/Banner.js.map +1 -0
- package/dist/src/logging/ConsoleReporter.d.ts +8 -0
- package/dist/src/logging/ConsoleReporter.js +25 -0
- package/dist/src/logging/ConsoleReporter.js.map +1 -0
- package/dist/src/logging/LogFormatter.d.ts +33 -0
- package/dist/src/logging/LogFormatter.js +146 -0
- package/dist/src/logging/LogFormatter.js.map +1 -0
- package/dist/src/logging/LogLevels.d.ts +3 -0
- package/dist/src/logging/LogLevels.js +26 -0
- package/dist/src/logging/LogLevels.js.map +1 -0
- package/dist/src/logging/Logger.d.ts +37 -0
- package/dist/src/logging/Logger.js +122 -0
- package/dist/src/logging/Logger.js.map +1 -0
- package/dist/src/logging/index.d.ts +8 -0
- package/dist/src/logging/index.js +16 -0
- package/dist/src/logging/index.js.map +1 -0
- package/dist/src/managers/DatabaseManager.d.ts +21 -0
- package/dist/src/managers/DatabaseManager.js +92 -0
- package/dist/src/managers/DatabaseManager.js.map +1 -0
- package/dist/src/managers/NodeManager.d.ts +21 -0
- package/dist/src/managers/NodeManager.js +106 -0
- package/dist/src/managers/NodeManager.js.map +1 -0
- package/dist/src/managers/PlayerManager.d.ts +22 -0
- package/dist/src/managers/PlayerManager.js +96 -0
- package/dist/src/managers/PlayerManager.js.map +1 -0
- package/dist/src/nodes/NodeFailover.d.ts +16 -0
- package/dist/src/nodes/NodeFailover.js +58 -0
- package/dist/src/nodes/NodeFailover.js.map +1 -0
- package/dist/src/nodes/NodeHealthMonitor.d.ts +12 -0
- package/dist/src/nodes/NodeHealthMonitor.js +33 -0
- package/dist/src/nodes/NodeHealthMonitor.js.map +1 -0
- package/dist/src/nodes/NodeSelector.d.ts +9 -0
- package/dist/src/nodes/NodeSelector.js +46 -0
- package/dist/src/nodes/NodeSelector.js.map +1 -0
- package/dist/src/players/PlaybackGuard.d.ts +11 -0
- package/dist/src/players/PlaybackGuard.js +25 -0
- package/dist/src/players/PlaybackGuard.js.map +1 -0
- package/dist/src/players/PlayerCommandQueue.d.ts +4 -0
- package/dist/src/players/PlayerCommandQueue.js +13 -0
- package/dist/src/players/PlayerCommandQueue.js.map +1 -0
- package/dist/src/search/SearchService.d.ts +14 -0
- package/dist/src/search/SearchService.js +143 -0
- package/dist/src/search/SearchService.js.map +1 -0
- package/dist/src/services/WebSocket.d.ts +40 -0
- package/dist/src/services/WebSocket.js +447 -0
- package/dist/src/services/WebSocket.js.map +1 -0
- package/dist/src/sources/deezer.d.ts +18 -0
- package/dist/src/sources/deezer.js +153 -0
- package/dist/src/sources/deezer.js.map +1 -0
- package/dist/src/sources/spotify.d.ts +35 -0
- package/dist/src/sources/spotify.js +239 -0
- package/dist/src/sources/spotify.js.map +1 -0
- package/dist/src/structures/SearchResult.d.ts +22 -0
- package/dist/src/structures/SearchResult.js +64 -0
- package/dist/src/structures/SearchResult.js.map +1 -0
- package/dist/src/tracks/TrackCodec.d.ts +17 -0
- package/dist/src/tracks/TrackCodec.js +25 -0
- package/dist/src/tracks/TrackCodec.js.map +1 -0
- package/dist/src/tracks/TrackResolver.d.ts +9 -0
- package/dist/src/tracks/TrackResolver.js +41 -0
- package/dist/src/tracks/TrackResolver.js.map +1 -0
- package/dist/src/typings/Interfaces.d.ts +561 -0
- package/dist/src/typings/Interfaces.js +3 -0
- package/dist/src/typings/Interfaces.js.map +1 -0
- package/dist/src/typings/types.d.ts +65 -0
- package/dist/src/typings/types.js +28 -0
- package/dist/src/typings/types.js.map +1 -0
- package/package.json +64 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Open Software License ("OSL") v. 3.0
|
|
2
|
+
|
|
3
|
+
This Open Software License (the "License") applies to any original work of
|
|
4
|
+
authorship (the "Original Work") whose owner (the "Licensor") has placed the
|
|
5
|
+
following licensing notice adjacent to the copyright notice for the Original
|
|
6
|
+
Work:
|
|
7
|
+
|
|
8
|
+
Licensed under the Open Software License version 3.0
|
|
9
|
+
|
|
10
|
+
1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free,
|
|
11
|
+
non-exclusive, sublicensable license, for the duration of the copyright, to do
|
|
12
|
+
the following:
|
|
13
|
+
|
|
14
|
+
a) to reproduce the Original Work in copies, either alone or as part of a
|
|
15
|
+
collective work;
|
|
16
|
+
|
|
17
|
+
b) to translate, adapt, alter, transform, modify, or arrange the Original
|
|
18
|
+
Work, thereby creating derivative works ("Derivative Works") based upon the
|
|
19
|
+
Original Work;
|
|
20
|
+
|
|
21
|
+
c) to distribute or communicate copies of the Original Work and Derivative
|
|
22
|
+
Works to the public, with the proviso that copies of Original Work or
|
|
23
|
+
Derivative Works that You distribute or communicate shall be licensed under
|
|
24
|
+
this Open Software License;
|
|
25
|
+
|
|
26
|
+
d) to perform the Original Work publicly; and
|
|
27
|
+
|
|
28
|
+
e) to display the Original Work publicly.
|
|
29
|
+
|
|
30
|
+
2) Grant of Patent License. Licensor grants You a worldwide, royalty-free,
|
|
31
|
+
non-exclusive, sublicensable license, under patent claims owned or controlled
|
|
32
|
+
by the Licensor that are embodied in the Original Work as furnished by the
|
|
33
|
+
Licensor, for the duration of the patents, to make, use, sell, offer for sale,
|
|
34
|
+
have made, and import the Original Work and Derivative Works.
|
|
35
|
+
|
|
36
|
+
3) Grant of Source Code License. The term "Source Code" means the preferred
|
|
37
|
+
form of the Original Work for making modifications to it and all available
|
|
38
|
+
documentation describing how to modify the Original Work. Licensor agrees to
|
|
39
|
+
provide a machine-readable copy of the Source Code of the Original Work along
|
|
40
|
+
with each copy of the Original Work that Licensor distributes. Licensor
|
|
41
|
+
reserves the right to satisfy this obligation by placing a machine-readable
|
|
42
|
+
copy of the Source Code in an information repository reasonably calculated to
|
|
43
|
+
permit inexpensive and convenient access by You for as long as Licensor
|
|
44
|
+
continues to distribute the Original Work.
|
|
45
|
+
|
|
46
|
+
4) Exclusions From License Grant. Neither the names of Licensor, nor the names
|
|
47
|
+
of any contributors to the Original Work, nor any of their trademarks or
|
|
48
|
+
service marks, may be used to endorse or promote products derived from this
|
|
49
|
+
Original Work without express prior permission of the Licensor. Except as
|
|
50
|
+
expressly stated herein, nothing in this License grants any license to
|
|
51
|
+
Licensor's trademarks, copyrights, patents, trade secrets or any other
|
|
52
|
+
intellectual property. No patent license is granted to make, use, sell, offer
|
|
53
|
+
for sale, have made, or import embodiments of any patent claims other than the
|
|
54
|
+
licensed claims defined in Section 2. No license is granted to the trademarks
|
|
55
|
+
of Licensor even if such marks are included in the Original Work. Nothing in
|
|
56
|
+
this License shall be interpreted to prohibit Licensor from licensing under
|
|
57
|
+
terms different from this License any Original Work that Licensor otherwise
|
|
58
|
+
would have a right to license.
|
|
59
|
+
|
|
60
|
+
5) External Deployment. The term "External Deployment" means the use,
|
|
61
|
+
distribution, or communication of the Original Work or Derivative Works in any
|
|
62
|
+
way such that the Original Work or Derivative Works may be used by anyone
|
|
63
|
+
other than You, whether those works are distributed or communicated to those
|
|
64
|
+
persons or made available as an application intended for use over a network.
|
|
65
|
+
As an express condition for the grants of license hereunder, You must treat
|
|
66
|
+
any External Deployment by You of the Original Work or a Derivative Work as a
|
|
67
|
+
distribution under section 1(c).
|
|
68
|
+
|
|
69
|
+
6) Attribution Rights. You must retain, in the Source Code of any Derivative
|
|
70
|
+
Works that You create, all copyright, patent, or trademark notices from the
|
|
71
|
+
Source Code of the Original Work, as well as any notices of licensing and any
|
|
72
|
+
descriptive text identified therein as an "Attribution Notice." You must cause
|
|
73
|
+
the Source Code for any Derivative Works that You create to carry a prominent
|
|
74
|
+
Attribution Notice reasonably calculated to inform recipients that You have
|
|
75
|
+
modified the Original Work.
|
|
76
|
+
|
|
77
|
+
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
|
|
78
|
+
the copyright in and to the Original Work and the patent rights granted herein
|
|
79
|
+
by Licensor are owned by the Licensor or are sublicensed to You under the
|
|
80
|
+
terms of this License with the permission of the contributor(s) of those
|
|
81
|
+
copyrights and patent rights. Except as expressly stated in the immediately
|
|
82
|
+
preceding sentence, the Original Work is provided under this License on an "AS
|
|
83
|
+
IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without
|
|
84
|
+
limitation, the warranties of non-infringement, merchantability or fitness for
|
|
85
|
+
a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK
|
|
86
|
+
IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this
|
|
87
|
+
License. No license to the Original Work is granted by this License except
|
|
88
|
+
under this disclaimer.
|
|
89
|
+
|
|
90
|
+
8) Limitation of Liability. Under no circumstances and under no legal theory,
|
|
91
|
+
whether in tort (including negligence), contract, or otherwise, shall the
|
|
92
|
+
Licensor be liable to anyone for any indirect, special, incidental, or
|
|
93
|
+
consequential damages of any character arising as a result of this License or
|
|
94
|
+
the use of the Original Work including, without limitation, damages for loss
|
|
95
|
+
of goodwill, work stoppage, computer failure or malfunction, or any and all
|
|
96
|
+
other commercial damages or losses. This limitation of liability shall not
|
|
97
|
+
apply to the extent applicable law prohibits such limitation.
|
|
98
|
+
|
|
99
|
+
9) Acceptance and Termination. If, at any time, You expressly assented to this
|
|
100
|
+
License, that assent indicates your clear and irrevocable acceptance of this
|
|
101
|
+
License and all of its terms and conditions. If You distribute or communicate
|
|
102
|
+
copies of the Original Work or a Derivative Work, You must make a reasonable
|
|
103
|
+
effort under the circumstances to obtain the express assent of recipients to
|
|
104
|
+
the terms of this License. This License conditions your rights to undertake
|
|
105
|
+
the activities listed in Section 1, including your right to create Derivative
|
|
106
|
+
Works based upon the Original Work, and doing so without honoring these terms
|
|
107
|
+
and conditions is prohibited by copyright law and international treaty.
|
|
108
|
+
Nothing in this License is intended to affect copyright exceptions and
|
|
109
|
+
limitations (including "fair use" or "fair dealing"). This License shall
|
|
110
|
+
terminate immediately and You may no longer exercise any of the rights granted
|
|
111
|
+
to You by this License upon your failure to honor the conditions in Section
|
|
112
|
+
1(c).
|
|
113
|
+
|
|
114
|
+
10) Termination for Patent Action. This License shall terminate automatically
|
|
115
|
+
and You may no longer exercise any of the rights granted to You by this
|
|
116
|
+
License as of the date You commence an action, including a cross-claim or
|
|
117
|
+
counterclaim, against Licensor or any licensee alleging that the Original Work
|
|
118
|
+
infringes a patent. This termination provision shall not apply for an action
|
|
119
|
+
alleging patent infringement by combinations of the Original Work with other
|
|
120
|
+
software or hardware.
|
|
121
|
+
|
|
122
|
+
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
|
|
123
|
+
License may be brought only in the courts of a jurisdiction wherein the
|
|
124
|
+
Licensor resides or in which Licensor conducts its primary business, and under
|
|
125
|
+
the laws of that jurisdiction excluding its conflict-of-law provisions. The
|
|
126
|
+
application of the United Nations Convention on Contracts for the
|
|
127
|
+
International Sale of Goods is expressly excluded. Any use of the Original
|
|
128
|
+
Work outside the scope of this License or after its termination shall be
|
|
129
|
+
subject to the requirements and penalties of copyright or patent law in the
|
|
130
|
+
appropriate jurisdiction. This section shall survive the termination of this
|
|
131
|
+
License.
|
|
132
|
+
|
|
133
|
+
12) Attorneys' Fees. In any action to enforce the terms of this License or
|
|
134
|
+
seeking damages relating thereto, the prevailing party shall be entitled to
|
|
135
|
+
recover its costs and expenses, including, without limitation, reasonable
|
|
136
|
+
attorneys' fees and costs incurred in connection with such action, including
|
|
137
|
+
any appeal of such action. This section shall survive the termination of this
|
|
138
|
+
License.
|
|
139
|
+
|
|
140
|
+
13) Miscellaneous. If any provision of this License is held to be
|
|
141
|
+
unenforceable, such provision shall be reformed only to the extent necessary
|
|
142
|
+
to make it enforceable.
|
|
143
|
+
|
|
144
|
+
14) Definition of "You" in This License. "You" throughout this License,
|
|
145
|
+
whether in upper or lower case, means an individual or a legal entity
|
|
146
|
+
exercising rights under, and complying with all of the terms of, this License.
|
|
147
|
+
For legal entities, "You" includes any entity that controls, is controlled by,
|
|
148
|
+
or is under common control with you. For purposes of this definition,
|
|
149
|
+
"control" means (i) the power, direct or indirect, to cause the direction or
|
|
150
|
+
management of such entity, whether by contract or otherwise, or (ii) ownership
|
|
151
|
+
of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
|
|
152
|
+
ownership of such entity.
|
|
153
|
+
|
|
154
|
+
15) Right to Use. You may use the Original Work in all ways not otherwise
|
|
155
|
+
restricted or conditioned by this License or by law, and Licensor promises not
|
|
156
|
+
to interfere with or be responsible for such uses by You.
|
|
157
|
+
|
|
158
|
+
16) Modification of This License. This License is Copyright © 2005 Lawrence
|
|
159
|
+
Rosen. Permission is granted to copy, distribute, or communicate this License
|
|
160
|
+
without modification. Nothing in this License permits You to modify this
|
|
161
|
+
License as applied to the Original Work or to Derivative Works. However, You
|
|
162
|
+
may modify the text of this License and copy, distribute or communicate your
|
|
163
|
+
modified version (the "Modified License") and apply it to other original works
|
|
164
|
+
of authorship subject to the following conditions: (i) You may not indicate in
|
|
165
|
+
any way that your Modified License is the "Open Software License" or "OSL" and
|
|
166
|
+
you may not use those names in the name of your Modified License; (ii) You
|
|
167
|
+
must replace the notice specified in the first paragraph above with the notice
|
|
168
|
+
"Licensed under <insert your license name here>" or with a notice of your own
|
|
169
|
+
that is not confusingly similar to the notice in this License; and (iii) You
|
|
170
|
+
may not claim that your original works are open source software unless your
|
|
171
|
+
Modified License has been approved by Open Source Initiative (OSI) and You
|
|
172
|
+
comply with its license review and certification process.
|
package/README.md
CHANGED
|
@@ -1,3 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/melodiabl/NyxLink/v0.1.0-dev.2/assets/nyxlink_banner.png" alt="NyxLink" width="100%">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
# NyxLink
|
|
6
|
+
|
|
7
|
+
Cliente de **Lavalink v4 y NodeLink** para bots de Discord, escrito en TypeScript y disponible para JavaScript y TypeScript.
|
|
8
|
+
|
|
9
|
+
[Paquete npm](https://www.npmjs.com/package/nyxlink) · [GitHub](https://github.com/melodiabl/NyxLink) · [Reportar un problema](https://github.com/melodiabl/NyxLink/issues)
|
|
10
|
+
|
|
11
|
+
## Instalación
|
|
12
|
+
|
|
13
|
+
Requiere **Node.js 22.12 o superior**. Versión de desarrollo actual: **0.1.0-dev.2**.
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install nyxlink@dev
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Para fijar la versión:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm install nyxlink@0.1.0-dev.2
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Uso con Discord.js
|
|
26
|
+
|
|
27
|
+
El ejemplo utiliza Discord.js 14. Instálalo en tu bot con `npm install discord.js` y configura `DISCORD_TOKEN` y `AUDIO_NODE_PASSWORD` en tu entorno.
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const { Client, GatewayIntentBits } = require('discord.js');
|
|
31
|
+
const { Manager, Connectors } = require('nyxlink');
|
|
32
|
+
|
|
33
|
+
const client = new Client({
|
|
34
|
+
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates],
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const manager = new Manager({
|
|
38
|
+
nodes: [{
|
|
39
|
+
identifier: 'principal',
|
|
40
|
+
host: process.env.AUDIO_NODE_HOST ?? '127.0.0.1',
|
|
41
|
+
port: Number(process.env.AUDIO_NODE_PORT ?? 2333),
|
|
42
|
+
password: process.env.AUDIO_NODE_PASSWORD,
|
|
43
|
+
secure: false,
|
|
44
|
+
}],
|
|
45
|
+
options: { database: { type: 'memory' }, resume: false },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
manager.use(new Connectors.DiscordJs(), client);
|
|
49
|
+
manager.on('nodeReady', node => console.log(`Nodo conectado: ${node.identifier}`));
|
|
50
|
+
manager.on('nodeError', (_node, error) => console.error(error.message));
|
|
51
|
+
|
|
52
|
+
client.login(process.env.DISCORD_TOKEN);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Espera el evento `nodeReady` antes de buscar o reproducir pistas. Los ejemplos completos de búsqueda, cola y cierre están en [JavaScript](examples/discordjs.cjs) y [TypeScript](examples/discordjs.ts).
|
|
56
|
+
|
|
57
|
+
## API principal
|
|
58
|
+
|
|
59
|
+
- `manager.search({ query, requester })`: buscar pistas.
|
|
60
|
+
- `manager.players.create({ guildId, voiceChannelId })`: crear un reproductor.
|
|
61
|
+
- `player.queue.add(track)`: añadir una pista a la cola.
|
|
62
|
+
- `await player.play()`: iniciar la reproducción; devuelve si el backend aceptó la operación.
|
|
63
|
+
- `await player.stop()`: detener la reproducción.
|
|
64
|
+
- `await player.setVolumeAsync(50)`: cambiar el volumen esperando la respuesta del backend.
|
|
65
|
+
- `await manager.shutdown()`: cerrar los recursos de NyxLink.
|
|
66
|
+
|
|
67
|
+
## Desarrollo
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
git clone --branch dev https://github.com/melodiabl/NyxLink.git
|
|
71
|
+
cd NyxLink
|
|
72
|
+
corepack pnpm install --frozen-lockfile
|
|
73
|
+
pnpm run build
|
|
74
|
+
pnpm test
|
|
75
|
+
pnpm run test:types
|
|
76
|
+
pnpm run test:package
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`src/` contiene el código TypeScript. `dist/` contiene el JavaScript compilado, las declaraciones de tipos y los mapas de código; se genera con `pnpm run build` y es la entrada del paquete npm. `tests/`, `scripts/` y `.github/` contienen las pruebas y su automatización.
|
|
80
|
+
|
|
81
|
+
## Licencia
|
|
82
|
+
|
|
83
|
+
Mantenido por [melodiabl](https://github.com/melodiabl). NyxLink deriva de Moonlink.js, de 1Lucas1.apk y sus colaboradores, y conserva la licencia [OSL-3.0](LICENSE) y los avisos de origen.
|
|
Binary file
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type * from './src/typings/Interfaces';
|
|
2
|
+
export { NodeState, VoiceConnectionState, LoadType } from './src/typings/types';
|
|
3
|
+
export declare const version: string;
|
|
4
|
+
export { Logger, ConsoleReporter, createBanner, formatEntry, formatBox, formatSystemStatus, formatFailover } from './src/logging';
|
|
5
|
+
export type { LoggerOptions, NyxLogLevel, AudioNodeStatus, FailoverReport } from './src/logging';
|
|
6
|
+
export { BackendAdapter } from './src/backends/BackendAdapter';
|
|
7
|
+
export type { BackendKind, CapabilityState } from './src/backends/BackendAdapter';
|
|
8
|
+
export { BackendDetector } from './src/backends/BackendDetector';
|
|
9
|
+
export { LavalinkAdapter } from './src/backends/LavalinkAdapter';
|
|
10
|
+
export { NodeLinkAdapter } from './src/backends/NodeLinkAdapter';
|
|
11
|
+
export { NodeSelector } from './src/nodes/NodeSelector';
|
|
12
|
+
export { NodeHealthMonitor } from './src/nodes/NodeHealthMonitor';
|
|
13
|
+
export { NodeFailover } from './src/nodes/NodeFailover';
|
|
14
|
+
export type { NodeHealth } from './src/nodes/NodeHealthMonitor';
|
|
15
|
+
export type { FailoverOptions, FailoverResult } from './src/nodes/NodeFailover';
|
|
16
|
+
export { FeatureUnavailableError } from './src/errors/FeatureUnavailableError';
|
|
17
|
+
export { HttpError } from './src/errors/HttpError';
|
|
18
|
+
export type { StorageAdapter } from './src/database/StorageAdapter';
|
|
19
|
+
export { Memory } from './src/database/Memory';
|
|
20
|
+
export { Local } from './src/database/Local';
|
|
21
|
+
export { TrackCodec } from './src/tracks/TrackCodec';
|
|
22
|
+
export type { TrackSnapshot } from './src/tracks/TrackCodec';
|
|
23
|
+
export { TrackResolver, TrackResolutionError } from './src/tracks/TrackResolver';
|
|
24
|
+
export { VoicePacketHandler } from './src/entities/VoicePacketHandler';
|
|
25
|
+
import { Manager } from "./src/core/Manager";
|
|
26
|
+
import { Node } from "./src/entities/Node";
|
|
27
|
+
import { Player } from "./src/entities/Player";
|
|
28
|
+
import { Queue } from "./src/entities/Queue";
|
|
29
|
+
import { Rest } from "./src/entities/Rest";
|
|
30
|
+
import { Filters } from "./src/entities/Filters";
|
|
31
|
+
import { Track } from "./src/entities/Track";
|
|
32
|
+
import { VoiceReceiver } from "./src/entities/VoiceReceiver";
|
|
33
|
+
import { YouTubeLiveChat } from "./src/entities/YouTubeLiveChat";
|
|
34
|
+
import { SearchResult } from "./src/structures/SearchResult";
|
|
35
|
+
import { NodeManager } from "./src/managers/NodeManager";
|
|
36
|
+
import { PlayerManager } from "./src/managers/PlayerManager";
|
|
37
|
+
import { WebSocket } from "./src/services/WebSocket";
|
|
38
|
+
import { Connectors } from "./src/connectors";
|
|
39
|
+
import { SpotifySource } from "./src/sources/spotify";
|
|
40
|
+
import { DeezerSource } from "./src/sources/deezer";
|
|
41
|
+
export { Manager, Node, Player, Queue, Rest, Filters, Track, VoiceReceiver, YouTubeLiveChat, SpotifySource, DeezerSource, SearchResult, NodeManager, PlayerManager, WebSocket, Connectors, };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Connectors = exports.WebSocket = exports.PlayerManager = exports.NodeManager = exports.SearchResult = exports.DeezerSource = exports.SpotifySource = exports.YouTubeLiveChat = exports.VoiceReceiver = exports.Track = exports.Filters = exports.Rest = exports.Queue = exports.Player = exports.Node = exports.Manager = exports.VoicePacketHandler = exports.TrackResolutionError = exports.TrackResolver = exports.TrackCodec = exports.Local = exports.Memory = exports.HttpError = exports.FeatureUnavailableError = exports.NodeFailover = exports.NodeHealthMonitor = exports.NodeSelector = exports.NodeLinkAdapter = exports.LavalinkAdapter = exports.BackendDetector = exports.BackendAdapter = exports.formatFailover = exports.formatSystemStatus = exports.formatBox = exports.formatEntry = exports.createBanner = exports.ConsoleReporter = exports.Logger = exports.version = exports.LoadType = exports.VoiceConnectionState = exports.NodeState = void 0;
|
|
4
|
+
var types_1 = require("./src/typings/types");
|
|
5
|
+
Object.defineProperty(exports, "NodeState", { enumerable: true, get: function () { return types_1.NodeState; } });
|
|
6
|
+
Object.defineProperty(exports, "VoiceConnectionState", { enumerable: true, get: function () { return types_1.VoiceConnectionState; } });
|
|
7
|
+
Object.defineProperty(exports, "LoadType", { enumerable: true, get: function () { return types_1.LoadType; } });
|
|
8
|
+
exports.version = require("../package.json").version;
|
|
9
|
+
var logging_1 = require("./src/logging");
|
|
10
|
+
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logging_1.Logger; } });
|
|
11
|
+
Object.defineProperty(exports, "ConsoleReporter", { enumerable: true, get: function () { return logging_1.ConsoleReporter; } });
|
|
12
|
+
Object.defineProperty(exports, "createBanner", { enumerable: true, get: function () { return logging_1.createBanner; } });
|
|
13
|
+
Object.defineProperty(exports, "formatEntry", { enumerable: true, get: function () { return logging_1.formatEntry; } });
|
|
14
|
+
Object.defineProperty(exports, "formatBox", { enumerable: true, get: function () { return logging_1.formatBox; } });
|
|
15
|
+
Object.defineProperty(exports, "formatSystemStatus", { enumerable: true, get: function () { return logging_1.formatSystemStatus; } });
|
|
16
|
+
Object.defineProperty(exports, "formatFailover", { enumerable: true, get: function () { return logging_1.formatFailover; } });
|
|
17
|
+
var BackendAdapter_1 = require("./src/backends/BackendAdapter");
|
|
18
|
+
Object.defineProperty(exports, "BackendAdapter", { enumerable: true, get: function () { return BackendAdapter_1.BackendAdapter; } });
|
|
19
|
+
var BackendDetector_1 = require("./src/backends/BackendDetector");
|
|
20
|
+
Object.defineProperty(exports, "BackendDetector", { enumerable: true, get: function () { return BackendDetector_1.BackendDetector; } });
|
|
21
|
+
var LavalinkAdapter_1 = require("./src/backends/LavalinkAdapter");
|
|
22
|
+
Object.defineProperty(exports, "LavalinkAdapter", { enumerable: true, get: function () { return LavalinkAdapter_1.LavalinkAdapter; } });
|
|
23
|
+
var NodeLinkAdapter_1 = require("./src/backends/NodeLinkAdapter");
|
|
24
|
+
Object.defineProperty(exports, "NodeLinkAdapter", { enumerable: true, get: function () { return NodeLinkAdapter_1.NodeLinkAdapter; } });
|
|
25
|
+
var NodeSelector_1 = require("./src/nodes/NodeSelector");
|
|
26
|
+
Object.defineProperty(exports, "NodeSelector", { enumerable: true, get: function () { return NodeSelector_1.NodeSelector; } });
|
|
27
|
+
var NodeHealthMonitor_1 = require("./src/nodes/NodeHealthMonitor");
|
|
28
|
+
Object.defineProperty(exports, "NodeHealthMonitor", { enumerable: true, get: function () { return NodeHealthMonitor_1.NodeHealthMonitor; } });
|
|
29
|
+
var NodeFailover_1 = require("./src/nodes/NodeFailover");
|
|
30
|
+
Object.defineProperty(exports, "NodeFailover", { enumerable: true, get: function () { return NodeFailover_1.NodeFailover; } });
|
|
31
|
+
var FeatureUnavailableError_1 = require("./src/errors/FeatureUnavailableError");
|
|
32
|
+
Object.defineProperty(exports, "FeatureUnavailableError", { enumerable: true, get: function () { return FeatureUnavailableError_1.FeatureUnavailableError; } });
|
|
33
|
+
var HttpError_1 = require("./src/errors/HttpError");
|
|
34
|
+
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return HttpError_1.HttpError; } });
|
|
35
|
+
var Memory_1 = require("./src/database/Memory");
|
|
36
|
+
Object.defineProperty(exports, "Memory", { enumerable: true, get: function () { return Memory_1.Memory; } });
|
|
37
|
+
var Local_1 = require("./src/database/Local");
|
|
38
|
+
Object.defineProperty(exports, "Local", { enumerable: true, get: function () { return Local_1.Local; } });
|
|
39
|
+
var TrackCodec_1 = require("./src/tracks/TrackCodec");
|
|
40
|
+
Object.defineProperty(exports, "TrackCodec", { enumerable: true, get: function () { return TrackCodec_1.TrackCodec; } });
|
|
41
|
+
var TrackResolver_1 = require("./src/tracks/TrackResolver");
|
|
42
|
+
Object.defineProperty(exports, "TrackResolver", { enumerable: true, get: function () { return TrackResolver_1.TrackResolver; } });
|
|
43
|
+
Object.defineProperty(exports, "TrackResolutionError", { enumerable: true, get: function () { return TrackResolver_1.TrackResolutionError; } });
|
|
44
|
+
var VoicePacketHandler_1 = require("./src/entities/VoicePacketHandler");
|
|
45
|
+
Object.defineProperty(exports, "VoicePacketHandler", { enumerable: true, get: function () { return VoicePacketHandler_1.VoicePacketHandler; } });
|
|
46
|
+
const Util_1 = require("./src/Util");
|
|
47
|
+
const Manager_1 = require("./src/core/Manager");
|
|
48
|
+
Object.defineProperty(exports, "Manager", { enumerable: true, get: function () { return Manager_1.Manager; } });
|
|
49
|
+
const Node_1 = require("./src/entities/Node");
|
|
50
|
+
Object.defineProperty(exports, "Node", { enumerable: true, get: function () { return Node_1.Node; } });
|
|
51
|
+
const Player_1 = require("./src/entities/Player");
|
|
52
|
+
Object.defineProperty(exports, "Player", { enumerable: true, get: function () { return Player_1.Player; } });
|
|
53
|
+
const Queue_1 = require("./src/entities/Queue");
|
|
54
|
+
Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return Queue_1.Queue; } });
|
|
55
|
+
const Rest_1 = require("./src/entities/Rest");
|
|
56
|
+
Object.defineProperty(exports, "Rest", { enumerable: true, get: function () { return Rest_1.Rest; } });
|
|
57
|
+
const Filters_1 = require("./src/entities/Filters");
|
|
58
|
+
Object.defineProperty(exports, "Filters", { enumerable: true, get: function () { return Filters_1.Filters; } });
|
|
59
|
+
const Track_1 = require("./src/entities/Track");
|
|
60
|
+
Object.defineProperty(exports, "Track", { enumerable: true, get: function () { return Track_1.Track; } });
|
|
61
|
+
const VoiceReceiver_1 = require("./src/entities/VoiceReceiver");
|
|
62
|
+
Object.defineProperty(exports, "VoiceReceiver", { enumerable: true, get: function () { return VoiceReceiver_1.VoiceReceiver; } });
|
|
63
|
+
const YouTubeLiveChat_1 = require("./src/entities/YouTubeLiveChat");
|
|
64
|
+
Object.defineProperty(exports, "YouTubeLiveChat", { enumerable: true, get: function () { return YouTubeLiveChat_1.YouTubeLiveChat; } });
|
|
65
|
+
const SearchResult_1 = require("./src/structures/SearchResult");
|
|
66
|
+
Object.defineProperty(exports, "SearchResult", { enumerable: true, get: function () { return SearchResult_1.SearchResult; } });
|
|
67
|
+
const NodeManager_1 = require("./src/managers/NodeManager");
|
|
68
|
+
Object.defineProperty(exports, "NodeManager", { enumerable: true, get: function () { return NodeManager_1.NodeManager; } });
|
|
69
|
+
const PlayerManager_1 = require("./src/managers/PlayerManager");
|
|
70
|
+
Object.defineProperty(exports, "PlayerManager", { enumerable: true, get: function () { return PlayerManager_1.PlayerManager; } });
|
|
71
|
+
const WebSocket_1 = require("./src/services/WebSocket");
|
|
72
|
+
Object.defineProperty(exports, "WebSocket", { enumerable: true, get: function () { return WebSocket_1.WebSocket; } });
|
|
73
|
+
const connectors_1 = require("./src/connectors");
|
|
74
|
+
Object.defineProperty(exports, "Connectors", { enumerable: true, get: function () { return connectors_1.Connectors; } });
|
|
75
|
+
const spotify_1 = require("./src/sources/spotify");
|
|
76
|
+
Object.defineProperty(exports, "SpotifySource", { enumerable: true, get: function () { return spotify_1.SpotifySource; } });
|
|
77
|
+
const deezer_1 = require("./src/sources/deezer");
|
|
78
|
+
Object.defineProperty(exports, "DeezerSource", { enumerable: true, get: function () { return deezer_1.DeezerSource; } });
|
|
79
|
+
Util_1.Structure.register("Node", Node_1.Node);
|
|
80
|
+
Util_1.Structure.register("Player", Player_1.Player);
|
|
81
|
+
Util_1.Structure.register("Queue", Queue_1.Queue);
|
|
82
|
+
Util_1.Structure.register("Rest", Rest_1.Rest);
|
|
83
|
+
Util_1.Structure.register("Filters", Filters_1.Filters);
|
|
84
|
+
Util_1.Structure.register("Track", Track_1.Track);
|
|
85
|
+
Util_1.Structure.register("SearchResult", SearchResult_1.SearchResult);
|
|
86
|
+
Util_1.Structure.register("NodeManager", NodeManager_1.NodeManager);
|
|
87
|
+
Util_1.Structure.register("PlayerManager", PlayerManager_1.PlayerManager);
|
|
88
|
+
Util_1.Structure.register("WebSocket", WebSocket_1.WebSocket);
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AACA,6CAAgF;AAAvE,kGAAA,SAAS,OAAA;AAAE,6GAAA,oBAAoB,OAAA;AAAE,iGAAA,QAAQ,OAAA;AACrC,QAAA,OAAO,GAAW,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAiB,CAAC;AAC5E,yCAAkI;AAAzH,iGAAA,MAAM,OAAA;AAAE,0GAAA,eAAe,OAAA;AAAE,uGAAA,YAAY,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAAE,yGAAA,cAAc,OAAA;AAE1G,gEAA+D;AAAtD,gHAAA,cAAc,OAAA;AAEvB,kEAAiE;AAAxD,kHAAA,eAAe,OAAA;AACxB,kEAAiE;AAAxD,kHAAA,eAAe,OAAA;AACxB,kEAAiE;AAAxD,kHAAA,eAAe,OAAA;AACxB,yDAAwD;AAA/C,4GAAA,YAAY,OAAA;AACrB,mEAAkE;AAAzD,sHAAA,iBAAiB,OAAA;AAC1B,yDAAwD;AAA/C,4GAAA,YAAY,OAAA;AAGrB,gFAA+E;AAAtE,kIAAA,uBAAuB,OAAA;AAChC,oDAAmD;AAA1C,sGAAA,SAAS,OAAA;AAElB,gDAA+C;AAAtC,gGAAA,MAAM,OAAA;AACf,8CAA6C;AAApC,8FAAA,KAAK,OAAA;AACd,sDAAqD;AAA5C,wGAAA,UAAU,OAAA;AAEnB,4DAAiF;AAAxE,8GAAA,aAAa,OAAA;AAAE,qHAAA,oBAAoB,OAAA;AAC5C,wEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,qCAAuC;AACvC,gDAA6C;AA6BzC,wFA7BK,iBAAO,OA6BL;AA5BX,8CAA2C;AA6BvC,qFA7BK,WAAI,OA6BL;AA5BR,kDAA+C;AA6B3C,uFA7BK,eAAM,OA6BL;AA5BV,gDAA6C;AA6BzC,sFA7BK,aAAK,OA6BL;AA5BT,8CAA2C;AA6BvC,qFA7BK,WAAI,OA6BL;AA5BR,oDAAiD;AA6B7C,wFA7BK,iBAAO,OA6BL;AA5BX,gDAA6C;AA6BzC,sFA7BK,aAAK,OA6BL;AA5BT,gEAA6D;AA6BzD,8FA7BK,6BAAa,OA6BL;AA5BjB,oEAAiE;AA6B7D,gGA7BK,iCAAe,OA6BL;AA5BnB,gEAA6D;AA+BzD,6FA/BK,2BAAY,OA+BL;AA9BhB,4DAAyD;AA+BrD,4FA/BK,yBAAW,OA+BL;AA9Bf,gEAA6D;AA+BzD,8FA/BK,6BAAa,OA+BL;AA9BjB,wDAAqD;AA+BjD,0FA/BK,qBAAS,OA+BL;AA9Bb,iDAA8C;AA+B1C,2FA/BK,uBAAU,OA+BL;AA9Bd,mDAAsD;AAwBlD,8FAxBK,uBAAa,OAwBL;AAvBjB,iDAAoD;AAwBhD,6FAxBK,qBAAY,OAwBL;AAtBhB,gBAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAI,CAAC,CAAC;AACjC,gBAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,eAAM,CAAC,CAAC;AACrC,gBAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAK,CAAC,CAAC;AACnC,gBAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAI,CAAC,CAAC;AACjC,gBAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,iBAAO,CAAC,CAAC;AACvC,gBAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAK,CAAC,CAAC;AACnC,gBAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,2BAAY,CAAC,CAAC;AACjD,gBAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,yBAAW,CAAC,CAAC;AAC/C,gBAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,6BAAa,CAAC,CAAC;AACnD,gBAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,qBAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import http from "node:http";
|
|
2
|
+
import type { ITrack, ITrackInfo } from "./typings/Interfaces";
|
|
3
|
+
export declare const structures: Record<string, any>;
|
|
4
|
+
export declare abstract class Structure {
|
|
5
|
+
static manager: any;
|
|
6
|
+
static setManager(manager: any): void;
|
|
7
|
+
static getManager(): any;
|
|
8
|
+
static get(name: string): any;
|
|
9
|
+
static register(name: string, structure: any): void;
|
|
10
|
+
static extend(name: string, extender: (baseClass: any) => any): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function validate<T>(prop: T | undefined, validator: (value: T) => boolean, errorMessage: string): void;
|
|
13
|
+
export declare function delay(ms: number): Promise<void>;
|
|
14
|
+
export declare const NODELINK_URL = "https://github.com/PerformanC/NodeLink";
|
|
15
|
+
export declare function nodeLinkOnlyError(feature: string): Error;
|
|
16
|
+
export type NodeLinkResponse<T> = {
|
|
17
|
+
loadType?: string;
|
|
18
|
+
data: T;
|
|
19
|
+
};
|
|
20
|
+
export declare function normalizeNodeLinkResponse<T>(input: T | {
|
|
21
|
+
loadType?: string;
|
|
22
|
+
data?: T;
|
|
23
|
+
}, fallbackLoadType?: string): NodeLinkResponse<T>;
|
|
24
|
+
export declare function decodeTrack(encoded: string): ITrack;
|
|
25
|
+
export declare function encodeTrack(track: ITrackInfo): string;
|
|
26
|
+
export declare function generateUUID(host: string, port: number): string;
|
|
27
|
+
export declare function Log(message: string, LogPath: string): void;
|
|
28
|
+
export type ResponseWithHeaders<T> = {
|
|
29
|
+
data: T;
|
|
30
|
+
headers: http.IncomingHttpHeaders;
|
|
31
|
+
};
|
|
32
|
+
export declare function makeRequest<T = any>(initialUrl: string, options: http.RequestOptions & {
|
|
33
|
+
body?: any;
|
|
34
|
+
returnHeaders: true;
|
|
35
|
+
throwOnError?: boolean;
|
|
36
|
+
}, timeout?: number, retries?: number, retryDelay?: number, maxRedirects?: number): Promise<ResponseWithHeaders<T> | undefined>;
|
|
37
|
+
export declare function makeRequest<T = any>(initialUrl: string, options: http.RequestOptions & {
|
|
38
|
+
body?: any;
|
|
39
|
+
returnHeaders?: false;
|
|
40
|
+
throwOnError?: boolean;
|
|
41
|
+
}, timeout?: number, retries?: number, retryDelay?: number, maxRedirects?: number): Promise<T | undefined>;
|
|
42
|
+
export type StreamResponse = {
|
|
43
|
+
stream: http.IncomingMessage;
|
|
44
|
+
statusCode: number;
|
|
45
|
+
headers: http.IncomingHttpHeaders;
|
|
46
|
+
};
|
|
47
|
+
export declare function makeStreamRequest(initialUrl: string, options: http.RequestOptions & {
|
|
48
|
+
body?: any;
|
|
49
|
+
}, timeout?: number): Promise<StreamResponse>;
|
|
50
|
+
export declare function stringifyWithReplacer(obj: any): string;
|
|
51
|
+
export declare const nodeLinkSources: Set<string>;
|
|
52
|
+
export declare const sources: {
|
|
53
|
+
youtube: string;
|
|
54
|
+
youtubemusic: string;
|
|
55
|
+
soundcloud: string;
|
|
56
|
+
local: string;
|
|
57
|
+
admsearch: string;
|
|
58
|
+
amsearch: string;
|
|
59
|
+
audiomack: string;
|
|
60
|
+
bcsearch: string;
|
|
61
|
+
bilibili: string;
|
|
62
|
+
dzsearch: string;
|
|
63
|
+
flowery: string;
|
|
64
|
+
ftts: string;
|
|
65
|
+
gaanasearch: string;
|
|
66
|
+
gtts: string;
|
|
67
|
+
jssearch: string;
|
|
68
|
+
lfsearch: string;
|
|
69
|
+
mcsearch: string;
|
|
70
|
+
ncsearch: string;
|
|
71
|
+
nicovideo: string;
|
|
72
|
+
pdsearch: string;
|
|
73
|
+
shsearch: string;
|
|
74
|
+
speak: string;
|
|
75
|
+
spsearch: string;
|
|
76
|
+
szsearch: string;
|
|
77
|
+
tdsearch: string;
|
|
78
|
+
vksearch: string;
|
|
79
|
+
};
|
|
80
|
+
export declare class Plugin {
|
|
81
|
+
name: string;
|
|
82
|
+
version: string;
|
|
83
|
+
description?: string;
|
|
84
|
+
author?: string | Record<string, any>;
|
|
85
|
+
minVersion?: string;
|
|
86
|
+
load(manager: any): void;
|
|
87
|
+
unload(manager: any): void;
|
|
88
|
+
}
|
|
89
|
+
export declare function isSourceBlacklisted(manager: any, sourceName: string): boolean;
|
|
90
|
+
export declare function isValidDiscordId(id: string): boolean;
|
|
91
|
+
export declare class EventEmitter<E extends {
|
|
92
|
+
[K in keyof E]: (...args: any[]) => void;
|
|
93
|
+
}> {
|
|
94
|
+
private readonly parent?;
|
|
95
|
+
private readonly listenerMap;
|
|
96
|
+
constructor(parent?: EventEmitter<E>);
|
|
97
|
+
on<K extends keyof E>(event: K, listener: E[K], options?: EmitterListenerOptions): () => void;
|
|
98
|
+
once<K extends keyof E>(event: K, listener: E[K], priority?: number): () => void;
|
|
99
|
+
off<K extends keyof E>(event: K, listener: E[K]): void;
|
|
100
|
+
emit<K extends keyof E>(event: K, ...args: Parameters<E[K]>): void;
|
|
101
|
+
removeAllListeners<K extends keyof E>(event?: K): void;
|
|
102
|
+
listenerCount<K extends keyof E>(event: K): number;
|
|
103
|
+
createChild(): EventEmitter<E>;
|
|
104
|
+
private sortListeners;
|
|
105
|
+
}
|
|
106
|
+
interface EmitterListenerOptions {
|
|
107
|
+
once?: boolean;
|
|
108
|
+
priority?: number;
|
|
109
|
+
}
|
|
110
|
+
export {};
|