magmastream 2.7.5 → 2.8.0
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/README.md +16 -0
- package/dist/index.d.ts +201 -170
- package/dist/structures/Filters.js +189 -127
- package/dist/structures/Manager.js +38 -39
- package/dist/structures/Node.js +132 -99
- package/dist/structures/Player.js +271 -108
- package/dist/structures/Queue.js +31 -31
- package/dist/utils/filtersEqualizers.js +19 -1
- package/dist/utils/playerCheck.js +14 -14
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ For real-time support and engaging discussions, join our vibrant [Discord Suppor
|
|
|
40
40
|
| [Cool Music](https://discord.com/oauth2/authorize?client_id=923529398425096193&permissions=12888394808&redirect_uri=https%3A%2F%2Fdiscord.gg%2Fcool-music-support-925619107460698202&response_type=code&scope=bot%20identify%20applications.commands) | Itz Random |
|
|
41
41
|
| [Soundy](https://dsc.gg/sndy) | iaMJ |
|
|
42
42
|
| [HamBot](https://discord.com/oauth2/authorize?client_id=1049314312776335390) | yanishamburger|
|
|
43
|
+
| [Miyu](https://discord.com/oauth2/authorize?client_id=1277180179273482280&permissions=572851999731703&response_type=code&redirect_uri=https%3A%2F%2Fdiscord.gg%2Ftn3nbFB8nX&integration_type=0&scope=identify+applications.commands+bot) | Kenver |
|
|
43
44
|
|
|
44
45
|
Want to showcase your bot? Feel free to create a pull request and add it to our growing list of amazing bots powered by Magmastream!
|
|
45
46
|
|
|
@@ -50,10 +51,25 @@ A heartfelt thank you to all our amazing contributors who have poured their time
|
|
|
50
51
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
51
52
|
<!-- prettier-ignore-start -->
|
|
52
53
|
<!-- markdownlint-disable -->
|
|
54
|
+
<table>
|
|
55
|
+
<tbody>
|
|
56
|
+
<tr>
|
|
57
|
+
<td align="center" valign="top" width="14.28%"><a href="https://discord.gg/JCaTDJRz7P"><img src="https://avatars.githubusercontent.com/u/58607083?v=4?s=100" width="100px;" alt="Darek"/><br /><sub><b>Darek</b></sub></a><br /><a href="#doc-realdarek" title="Documentation">📖</a></td>
|
|
58
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Vexify4103"><img src="https://avatars.githubusercontent.com/u/47192617?v=4?s=100" width="100px;" alt="Vexify4103"/><br /><sub><b>Vexify4103</b></sub></a><br /><a href="#code-Vexify4103" title="Code">💻</a> <a href="#doc-Vexify4103" title="Documentation">📖</a></td>
|
|
59
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ItzRandom23"><img src="https://avatars.githubusercontent.com/u/100831398?v=4?s=100" width="100px;" alt="Itz Random"/><br /><sub><b>Itz Random</b></sub></a><br /><a href="#code-ItzRandom23" title="Code">💻</a></td>
|
|
60
|
+
</tr>
|
|
61
|
+
</tbody>
|
|
62
|
+
</table>
|
|
53
63
|
|
|
54
64
|
<!-- markdownlint-restore -->
|
|
55
65
|
<!-- prettier-ignore-end -->
|
|
56
66
|
|
|
57
67
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
58
68
|
|
|
69
|
+
|
|
70
|
+
<img src="https://contributers.code-fy.tech/Magmastream-NPM?yousuck">
|
|
71
|
+
|
|
72
|
+
## Stats
|
|
73
|
+
|
|
74
|
+
|
|
59
75
|

|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { User, ClientUser, Message } from 'discord.js';
|
|
2
2
|
import WebSocket from 'ws';
|
|
3
3
|
import { Collection } from '@discordjs/collection';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
@@ -23,26 +23,41 @@ declare class Filters {
|
|
|
23
23
|
private filterStatus;
|
|
24
24
|
constructor(player: Player);
|
|
25
25
|
/**
|
|
26
|
-
* Updates the filters
|
|
27
|
-
*
|
|
26
|
+
* Updates the player's filters by applying the current settings.
|
|
27
|
+
*
|
|
28
|
+
* This method sends the updated filter settings, including distortion, equalizer,
|
|
29
|
+
* karaoke, rotation, timescale, vibrato, and volume, to the player. It ensures that
|
|
30
|
+
* the player's audio output is updated to reflect the applied filters.
|
|
31
|
+
*
|
|
32
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
28
33
|
*/
|
|
29
34
|
private updateFilters;
|
|
30
35
|
/**
|
|
31
|
-
* Applies a filter to the player.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
36
|
+
* Applies a specific filter to the player.
|
|
37
|
+
*
|
|
38
|
+
* This method sets a filter property to the specified value and updates the player's
|
|
39
|
+
* filters if the `updateFilters` flag is true.
|
|
40
|
+
*
|
|
41
|
+
* @param {Object} filter - The filter property and value to apply.
|
|
42
|
+
* @param {string} filter.property - The property of the filter to modify.
|
|
43
|
+
* @param {any} filter.value - The value to set for the filter property.
|
|
44
|
+
* @param {boolean} [updateFilters=true] - Whether to update the filters on the player.
|
|
45
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
35
46
|
*/
|
|
36
47
|
private applyFilter;
|
|
37
48
|
/**
|
|
38
|
-
* Sets the status of
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
49
|
+
* Sets the status of a specific filter.
|
|
50
|
+
*
|
|
51
|
+
* This method updates the filter status to either true or false, indicating whether
|
|
52
|
+
* the filter is applied or not. This helps track which filters are active.
|
|
53
|
+
*
|
|
54
|
+
* @param {keyof availableFilters} filter - The filter to update.
|
|
55
|
+
* @param {boolean} status - The status to set (true for active, false for inactive).
|
|
56
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
42
57
|
*/
|
|
43
58
|
private setFilterStatus;
|
|
44
59
|
/**
|
|
45
|
-
* Sets the equalizer bands
|
|
60
|
+
* Sets the equalizer bands for the player.
|
|
46
61
|
*
|
|
47
62
|
* This method updates the player's equalizer settings by applying the provided
|
|
48
63
|
* bands configuration. The equalizer is an array of Band objects, each containing
|
|
@@ -55,198 +70,188 @@ declare class Filters {
|
|
|
55
70
|
*/
|
|
56
71
|
setEqualizer(bands?: Band[]): this;
|
|
57
72
|
/**
|
|
58
|
-
* Applies the
|
|
59
|
-
*
|
|
60
|
-
*
|
|
73
|
+
* Applies the "8D audio" effect by setting a rotation filter.
|
|
74
|
+
*
|
|
75
|
+
* This method creates the "8D audio" effect, which gives the illusion of sound
|
|
76
|
+
* moving around the listener's head. It applies a subtle rotation effect to the audio.
|
|
77
|
+
*
|
|
78
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
61
79
|
*/
|
|
62
80
|
eightD(): this;
|
|
63
81
|
/**
|
|
64
|
-
* Applies the bass boost
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
82
|
+
* Applies the bass boost effect by setting an equalizer with boosted bass frequencies.
|
|
83
|
+
*
|
|
84
|
+
* This method enhances the lower frequencies of the audio, giving the audio a deep
|
|
85
|
+
* and powerful bass response.
|
|
86
|
+
*
|
|
87
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
68
88
|
*/
|
|
69
89
|
bassBoost(): this;
|
|
70
90
|
/**
|
|
71
|
-
* Applies the nightcore audio
|
|
72
|
-
*
|
|
73
|
-
*
|
|
91
|
+
* Applies the nightcore effect by adjusting the speed and pitch of the audio.
|
|
92
|
+
*
|
|
93
|
+
* This method increases the tempo and pitch of the audio, giving it a faster and
|
|
94
|
+
* higher-pitched sound, characteristic of the nightcore genre.
|
|
95
|
+
*
|
|
96
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
74
97
|
*/
|
|
75
98
|
nightcore(): this;
|
|
76
99
|
/**
|
|
77
|
-
* Applies the slow
|
|
78
|
-
*
|
|
79
|
-
*
|
|
100
|
+
* Applies the slow-motion effect by reducing the speed and pitch of the audio.
|
|
101
|
+
*
|
|
102
|
+
* This method slows down the audio, giving it a slower and more relaxed feel.
|
|
103
|
+
*
|
|
104
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
80
105
|
*/
|
|
81
106
|
slowmo(): this;
|
|
82
107
|
/**
|
|
83
|
-
* Applies
|
|
108
|
+
* Applies a soft equalizer to give the audio a smoother sound.
|
|
84
109
|
*
|
|
85
|
-
* This method
|
|
86
|
-
*
|
|
87
|
-
* by reducing the gain of certain frequency bands.
|
|
110
|
+
* This method adjusts the equalizer settings to soften the frequencies and give
|
|
111
|
+
* the audio a more mellow tone.
|
|
88
112
|
*
|
|
89
|
-
* @returns {this} Returns the current instance of the Filters class for method chaining.
|
|
113
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
90
114
|
*/
|
|
91
115
|
soft(): this;
|
|
92
116
|
/**
|
|
93
|
-
* Applies
|
|
94
|
-
*
|
|
95
|
-
*
|
|
117
|
+
* Applies a TV-like equalizer effect to the audio.
|
|
118
|
+
*
|
|
119
|
+
* This method adjusts the equalizer to give the audio a "TV" effect, which may
|
|
120
|
+
* simulate the audio quality heard from television speakers.
|
|
121
|
+
*
|
|
122
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
96
123
|
*/
|
|
97
124
|
tv(): this;
|
|
98
125
|
/**
|
|
99
|
-
* Applies the treble bass
|
|
100
|
-
*
|
|
101
|
-
*
|
|
126
|
+
* Applies the "treble and bass boost" effect to the audio.
|
|
127
|
+
*
|
|
128
|
+
* This method adjusts the equalizer to boost both the treble (high frequencies)
|
|
129
|
+
* and bass (low frequencies), giving the audio a more balanced and enhanced sound.
|
|
130
|
+
*
|
|
131
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
102
132
|
*/
|
|
103
133
|
trebleBass(): this;
|
|
104
134
|
/**
|
|
105
|
-
* Applies the vaporwave
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
135
|
+
* Applies the vaporwave effect by adjusting the equalizer and pitch.
|
|
136
|
+
*
|
|
137
|
+
* This method applies a vaporwave-style equalizer, with softer tones, and adjusts
|
|
138
|
+
* the pitch to give the audio a dreamy, nostalgic feel.
|
|
139
|
+
*
|
|
140
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
109
141
|
*/
|
|
110
142
|
vaporwave(): this;
|
|
111
143
|
/**
|
|
112
|
-
* Applies
|
|
113
|
-
*
|
|
114
|
-
*
|
|
144
|
+
* Applies a distortion effect to the audio.
|
|
145
|
+
*
|
|
146
|
+
* This method applies a distortion effect by adjusting various distortion parameters.
|
|
147
|
+
* It can make the audio sound rougher and more intense.
|
|
148
|
+
*
|
|
115
149
|
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
116
150
|
*/
|
|
117
151
|
distort(): this;
|
|
118
152
|
/**
|
|
119
|
-
*
|
|
153
|
+
* Sets the karaoke effect on the audio.
|
|
120
154
|
*
|
|
121
|
-
* This method
|
|
122
|
-
*
|
|
123
|
-
* - `level`: The level of the karaoke effect. A higher level results in a more
|
|
124
|
-
* pronounced effect.
|
|
125
|
-
* - `monoLevel`: The level of the mono channel. A higher level results in a more
|
|
126
|
-
* pronounced effect.
|
|
127
|
-
* - `filterBand`: The frequency band to apply the karaoke effect to.
|
|
128
|
-
* - `filterWidth`: The width of the frequency band to apply the karaoke effect to.
|
|
155
|
+
* This method adjusts the player's audio output to apply a karaoke effect, which
|
|
156
|
+
* may include filtering out vocals or adjusting levels for optimal karaoke performance.
|
|
129
157
|
*
|
|
130
|
-
*
|
|
131
|
-
* be disabled.
|
|
132
|
-
*
|
|
133
|
-
* @param {karaokeOptions} [karaoke] - The karaoke options to apply.
|
|
158
|
+
* @param {karaokeOptions} [karaoke] - The karaoke settings to apply (level, mono level, filter band, etc.).
|
|
134
159
|
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
135
160
|
*/
|
|
136
161
|
setKaraoke(karaoke?: karaokeOptions): this;
|
|
137
162
|
/**
|
|
138
|
-
*
|
|
163
|
+
* Sets the timescale (speed, pitch, rate) for the audio.
|
|
139
164
|
*
|
|
140
|
-
* This method
|
|
141
|
-
*
|
|
142
|
-
* adjustments to modify the playback characteristics of the audio.
|
|
165
|
+
* This method adjusts the speed, pitch, and rate of the audio, allowing for effects
|
|
166
|
+
* such as faster or slower playback, pitch shifts, and time dilation.
|
|
143
167
|
*
|
|
144
|
-
* @param {timescaleOptions} [timescale] - The timescale
|
|
168
|
+
* @param {timescaleOptions} [timescale] - The timescale settings to apply (speed, pitch, rate).
|
|
145
169
|
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
146
170
|
*/
|
|
147
171
|
setTimescale(timescale?: timescaleOptions): this;
|
|
148
172
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* This method takes an optional `vibratoOptions` object as a parameter, which
|
|
152
|
-
* can be used to customize the vibrato effect. The available options are:
|
|
153
|
-
* - `frequency`: The frequency of the vibrato effect. A higher frequency results
|
|
154
|
-
* in a faster vibrato effect.
|
|
155
|
-
* - `depth`: The depth of the vibrato effect. A higher depth results in a more
|
|
156
|
-
* pronounced effect.
|
|
173
|
+
* Sets the vibrato effect on the audio.
|
|
157
174
|
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
175
|
+
* This method applies a vibrato effect to the audio, which creates a wobble in the
|
|
176
|
+
* pitch by modulating it at a specified frequency and depth.
|
|
160
177
|
*
|
|
161
|
-
* @param {vibratoOptions} [vibrato] - The vibrato
|
|
178
|
+
* @param {vibratoOptions} [vibrato] - The vibrato settings to apply (frequency and depth).
|
|
162
179
|
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
163
180
|
*/
|
|
164
181
|
setVibrato(vibrato?: vibratoOptions): this;
|
|
165
182
|
/**
|
|
166
|
-
*
|
|
183
|
+
* Sets the rotation effect on the audio.
|
|
167
184
|
*
|
|
168
|
-
* This method
|
|
169
|
-
*
|
|
170
|
-
* - `rotationHz`: The frequency of the rotation effect. A higher frequency results
|
|
171
|
-
* in a faster rotation effect.
|
|
185
|
+
* This method applies a rotation effect to the audio, creating the illusion of sound
|
|
186
|
+
* moving around the listener's head.
|
|
172
187
|
*
|
|
173
|
-
*
|
|
174
|
-
* be disabled.
|
|
175
|
-
*
|
|
176
|
-
* @param {rotationOptions} [rotation] - The rotation options to apply.
|
|
188
|
+
* @param {rotationOptions} [rotation] - The rotation settings (rotationHz).
|
|
177
189
|
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
178
190
|
*/
|
|
179
191
|
setRotation(rotation?: rotationOptions): this;
|
|
180
192
|
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* - `cosScale`: The cosine scale value for the distortion effect.
|
|
188
|
-
* - `tanOffset`: The tangent offset value for the distortion effect.
|
|
189
|
-
* - `tanScale`: The tangent scale value for the distortion effect.
|
|
190
|
-
* - `offset`: The offset value for the distortion effect.
|
|
191
|
-
* - `scale`: The scale value for the distortion effect.
|
|
192
|
-
*
|
|
193
|
-
* If no options are provided, the filter will be reset and the distortion effect will
|
|
194
|
-
* be disabled.
|
|
195
|
-
*
|
|
196
|
-
* @param {distortionOptions} [distortion] - The distortion options to apply.
|
|
193
|
+
* Sets the distortion effect on the audio.
|
|
194
|
+
*
|
|
195
|
+
* This method applies a distortion effect to the audio, which adds an aggressive,
|
|
196
|
+
* rough texture to the sound.
|
|
197
|
+
*
|
|
198
|
+
* @param {distortionOptions} [distortion] - The distortion settings to apply.
|
|
197
199
|
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
198
200
|
*/
|
|
199
201
|
setDistortion(distortion?: distortionOptions): this;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
+
pop(): this;
|
|
203
|
+
party(): this;
|
|
204
|
+
earrape(): this;
|
|
205
|
+
electronic(): this;
|
|
206
|
+
radio(): this;
|
|
207
|
+
tremolo(): this;
|
|
208
|
+
china(): this;
|
|
209
|
+
chipmunk(): this;
|
|
210
|
+
darthvader(): this;
|
|
211
|
+
daycore(): this;
|
|
212
|
+
doubletime(): this;
|
|
213
|
+
/**
|
|
214
|
+
* Clears all filters applied to the audio.
|
|
202
215
|
*
|
|
203
|
-
* This method
|
|
204
|
-
*
|
|
205
|
-
* effects without having to manually reset each filter individually.
|
|
216
|
+
* This method resets all filter settings to their default values and removes any
|
|
217
|
+
* active filters from the player.
|
|
206
218
|
*
|
|
207
|
-
* @returns {
|
|
208
|
-
* instance of the Filters class.
|
|
219
|
+
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
209
220
|
*/
|
|
210
221
|
clearFilters(): Promise<this>;
|
|
211
222
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
223
|
+
* Retrieves the status of a specific filter.
|
|
224
|
+
*
|
|
225
|
+
* This method returns whether a specific filter is currently applied or not.
|
|
226
|
+
*
|
|
227
|
+
* @param {keyof availableFilters} filter - The filter to check.
|
|
228
|
+
* @returns {boolean} - Returns true if the filter is active, false otherwise.
|
|
215
229
|
*/
|
|
216
230
|
getFilterStatus(filter: keyof availableFilters): boolean;
|
|
217
231
|
}
|
|
218
232
|
/** Options for adjusting the timescale of audio. */
|
|
219
233
|
interface timescaleOptions {
|
|
220
|
-
/** The speed factor for the timescale. */
|
|
221
234
|
speed?: number;
|
|
222
|
-
/** The pitch factor for the timescale. */
|
|
223
235
|
pitch?: number;
|
|
224
|
-
/** The rate factor for the timescale. */
|
|
225
236
|
rate?: number;
|
|
226
237
|
}
|
|
227
238
|
/** Options for applying vibrato effect to audio. */
|
|
228
239
|
interface vibratoOptions {
|
|
229
|
-
/** The frequency of the vibrato effect. */
|
|
230
240
|
frequency: number;
|
|
231
|
-
/** * The depth of the vibrato effect.*/
|
|
232
241
|
depth: number;
|
|
233
242
|
}
|
|
234
243
|
/** Options for applying rotation effect to audio. */
|
|
235
244
|
interface rotationOptions {
|
|
236
|
-
/** The rotation speed in Hertz (Hz). */
|
|
237
245
|
rotationHz: number;
|
|
238
246
|
}
|
|
239
247
|
/** Options for applying karaoke effect to audio. */
|
|
240
248
|
interface karaokeOptions {
|
|
241
|
-
/** The level of karaoke effect. */
|
|
242
249
|
level?: number;
|
|
243
|
-
/** The mono level of karaoke effect. */
|
|
244
250
|
monoLevel?: number;
|
|
245
|
-
/** The filter band of karaoke effect. */
|
|
246
251
|
filterBand?: number;
|
|
247
|
-
/** The filter width of karaoke effect. */
|
|
248
252
|
filterWidth?: number;
|
|
249
253
|
}
|
|
254
|
+
/** Options for applying distortion effect to audio. */
|
|
250
255
|
interface distortionOptions {
|
|
251
256
|
sinOffset?: number;
|
|
252
257
|
sinScale?: number;
|
|
@@ -258,16 +263,7 @@ interface distortionOptions {
|
|
|
258
263
|
scale?: number;
|
|
259
264
|
}
|
|
260
265
|
interface availableFilters {
|
|
261
|
-
|
|
262
|
-
distort: boolean;
|
|
263
|
-
eightD: boolean;
|
|
264
|
-
karaoke: boolean;
|
|
265
|
-
nightcore: boolean;
|
|
266
|
-
slowmo: boolean;
|
|
267
|
-
soft: boolean;
|
|
268
|
-
trebleBass: boolean;
|
|
269
|
-
tv: boolean;
|
|
270
|
-
vaporwave: boolean;
|
|
266
|
+
[key: string]: boolean;
|
|
271
267
|
}
|
|
272
268
|
|
|
273
269
|
/**
|
|
@@ -297,14 +293,14 @@ declare class Queue extends Array<Track | UnresolvedTrack> {
|
|
|
297
293
|
previous: Track | UnresolvedTrack | null;
|
|
298
294
|
/** The Manager instance. */
|
|
299
295
|
manager: Manager;
|
|
300
|
-
/** The guild property. */
|
|
301
|
-
|
|
296
|
+
/** The guild ID property. */
|
|
297
|
+
guildId: string;
|
|
302
298
|
/**
|
|
303
299
|
* Constructs a new Queue.
|
|
304
|
-
* @param
|
|
300
|
+
* @param guildId The guild ID.
|
|
305
301
|
* @param manager The Manager instance.
|
|
306
302
|
*/
|
|
307
|
-
constructor(
|
|
303
|
+
constructor(guildId: string, manager: Manager);
|
|
308
304
|
/**
|
|
309
305
|
* Adds a track to the queue.
|
|
310
306
|
* @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
|
|
@@ -362,12 +358,12 @@ declare class Player {
|
|
|
362
358
|
volume: number;
|
|
363
359
|
/** The Node for the Player. */
|
|
364
360
|
node: Node;
|
|
365
|
-
/** The guild for the player. */
|
|
366
|
-
|
|
361
|
+
/** The guild ID for the player. */
|
|
362
|
+
guildId: string;
|
|
367
363
|
/** The voice channel for the player. */
|
|
368
|
-
|
|
364
|
+
voiceChannelId: string | null;
|
|
369
365
|
/** The text channel for the player. */
|
|
370
|
-
|
|
366
|
+
textChannelId: string | null;
|
|
371
367
|
/**The now playing message. */
|
|
372
368
|
nowPlayingMessage?: Message;
|
|
373
369
|
/** The current state of the player. */
|
|
@@ -385,6 +381,7 @@ declare class Player {
|
|
|
385
381
|
private static _manager;
|
|
386
382
|
private readonly data;
|
|
387
383
|
private dynamicLoopInterval;
|
|
384
|
+
private dynamicRepeatIntervalMs;
|
|
388
385
|
/**
|
|
389
386
|
* Set custom data.
|
|
390
387
|
* @param key - The key to set the data for.
|
|
@@ -443,7 +440,7 @@ declare class Player {
|
|
|
443
440
|
* @returns {this} - The player instance.
|
|
444
441
|
* @throws {TypeError} If the channel parameter is not a string.
|
|
445
442
|
*/
|
|
446
|
-
|
|
443
|
+
setVoiceChannelId(channel: string): this;
|
|
447
444
|
/**
|
|
448
445
|
* Sets the player text channel.
|
|
449
446
|
*
|
|
@@ -454,7 +451,7 @@ declare class Player {
|
|
|
454
451
|
* @returns {this} - The player instance for method chaining.
|
|
455
452
|
* @throws {TypeError} If the channel parameter is not a string.
|
|
456
453
|
*/
|
|
457
|
-
|
|
454
|
+
setTextChannelId(channel: string): this;
|
|
458
455
|
/**
|
|
459
456
|
* Sets the now playing message.
|
|
460
457
|
*
|
|
@@ -470,6 +467,7 @@ declare class Player {
|
|
|
470
467
|
*
|
|
471
468
|
* @param {object} [optionsOrTrack] - The track to play or the options to play with.
|
|
472
469
|
* @param {object} [playOptions] - The options to play with.
|
|
470
|
+
*
|
|
473
471
|
* @returns {Promise<void>}
|
|
474
472
|
*/
|
|
475
473
|
play(): Promise<void>;
|
|
@@ -495,7 +493,9 @@ declare class Player {
|
|
|
495
493
|
* @param {User | ClientUser} requester - The user who requested the track.
|
|
496
494
|
* @returns {Promise<Track[]>} - Array of recommended tracks.
|
|
497
495
|
*/
|
|
498
|
-
|
|
496
|
+
getRecommendedTracks(track: Track): Promise<Track[]>;
|
|
497
|
+
private handleYouTubeRecommendations;
|
|
498
|
+
private handlePlatformAutoplay;
|
|
499
499
|
/**
|
|
500
500
|
* Sets the player volume.
|
|
501
501
|
* @param {number} volume - The volume to set the player to. Must be between 0 and 100.
|
|
@@ -548,7 +548,7 @@ declare class Player {
|
|
|
548
548
|
* Restarts the current track to the start.
|
|
549
549
|
* If there's no current track and there are tracks in the queue, it plays the next track.
|
|
550
550
|
*/
|
|
551
|
-
restart():
|
|
551
|
+
restart(): Promise<Player>;
|
|
552
552
|
/**
|
|
553
553
|
* Stops the current track, optionally give an amount to skip to, e.g 5 would play the 5th song.
|
|
554
554
|
* @param amount - The amount of tracks to skip, e.g 5 would play the 5th song.
|
|
@@ -578,14 +578,34 @@ declare class Player {
|
|
|
578
578
|
* @returns The repeat state of the player, or null if it is not repeating.
|
|
579
579
|
*/
|
|
580
580
|
private getRepeatState;
|
|
581
|
+
/**
|
|
582
|
+
* Automatically moves the player to a usable node.
|
|
583
|
+
* @returns {Promise<Player | void>} - The player instance or void if not moved.
|
|
584
|
+
*/
|
|
585
|
+
autoMoveNode(): Promise<Player | void>;
|
|
586
|
+
/**
|
|
587
|
+
* Moves the player to another node.
|
|
588
|
+
* @param {string} identifier - The identifier of the node to move to.
|
|
589
|
+
* @returns {Promise<Player>} - The player instance after being moved.
|
|
590
|
+
*/
|
|
591
|
+
moveNode(identifier: string): Promise<Player>;
|
|
592
|
+
/**
|
|
593
|
+
* Transfers the player to a new server. If the player already exists on the new server
|
|
594
|
+
* and force is false, this method will return the existing player. Otherwise, a new player
|
|
595
|
+
* will be created and the current player will be destroyed.
|
|
596
|
+
* @param {PlayerOptions} newOptions - The new options for the player.
|
|
597
|
+
* @param {boolean} force - Whether to force the creation of a new player.
|
|
598
|
+
* @returns {Promise<Player>} - The new player instance.
|
|
599
|
+
*/
|
|
600
|
+
switchGuild(newOptions: PlayerOptions, force?: boolean): Promise<Player>;
|
|
581
601
|
}
|
|
582
602
|
interface PlayerOptions {
|
|
583
|
-
/** The guild the Player belongs to. */
|
|
584
|
-
|
|
603
|
+
/** The guild ID the Player belongs to. */
|
|
604
|
+
guildId: string;
|
|
585
605
|
/** The text channel the Player belongs to. */
|
|
586
|
-
|
|
606
|
+
textChannelId: string;
|
|
587
607
|
/** The voice channel the Player belongs to. */
|
|
588
|
-
|
|
608
|
+
voiceChannelId?: string;
|
|
589
609
|
/** The node the Player uses. */
|
|
590
610
|
node?: string;
|
|
591
611
|
/** The initial volume the Player will use. */
|
|
@@ -881,7 +901,7 @@ declare class Node {
|
|
|
881
901
|
* @param {number} code The close code.
|
|
882
902
|
* @param {string} reason The close reason.
|
|
883
903
|
*/
|
|
884
|
-
protected close(code: number, reason: string): void
|
|
904
|
+
protected close(code: number, reason: string): Promise<void>;
|
|
885
905
|
/**
|
|
886
906
|
* Handles the "error" event emitted by the WebSocket connection.
|
|
887
907
|
*
|
|
@@ -924,20 +944,11 @@ declare class Node {
|
|
|
924
944
|
* @protected
|
|
925
945
|
*/
|
|
926
946
|
protected trackEnd(player: Player, track: Track, payload: TrackEndEvent): Promise<void>;
|
|
927
|
-
/**
|
|
928
|
-
* Extracts the Spotify track ID from a URL.
|
|
929
|
-
* @param {string} url The URL to extract the track ID from.
|
|
930
|
-
* @returns {string | null} The track ID or null if the URL is invalid.
|
|
931
|
-
*/
|
|
932
|
-
extractSpotifyTrackID(url: string): string | null;
|
|
933
|
-
/**
|
|
934
|
-
* Extracts the Spotify artist ID from a URL.
|
|
935
|
-
* @param {string} url - The URL to extract the artist ID from.
|
|
936
|
-
* @returns {string | null} - The artist ID or null if the URL is invalid.
|
|
937
|
-
*/
|
|
938
|
-
extractSpotifyArtistID(url: string): string | null;
|
|
939
947
|
/**
|
|
940
948
|
* Handles autoplay logic for a player.
|
|
949
|
+
* This method is responsible for selecting an appropriate method of autoplay
|
|
950
|
+
* and executing it. If autoplay is not enabled or all attempts have failed,
|
|
951
|
+
* it will return false.
|
|
941
952
|
* @param {Player} player - The player to handle autoplay for.
|
|
942
953
|
* @param {Track} track - The track that has ended.
|
|
943
954
|
* @param {number} attempt - The current attempt number of the autoplay.
|
|
@@ -945,6 +956,28 @@ declare class Node {
|
|
|
945
956
|
* @private
|
|
946
957
|
*/
|
|
947
958
|
private handleAutoplay;
|
|
959
|
+
/**
|
|
960
|
+
* Selects a platform from the given enabled sources.
|
|
961
|
+
* @param {string[]} enabledSources - The enabled sources to select from.
|
|
962
|
+
* @returns {SearchPlatform | null} - The selected platform or null if none was found.
|
|
963
|
+
*/
|
|
964
|
+
selectPlatform(enabledSources: string[]): SearchPlatform | null;
|
|
965
|
+
/**
|
|
966
|
+
* Handles Last.fm-based autoplay.
|
|
967
|
+
* @param {Player} player - The player instance.
|
|
968
|
+
* @param {Track | UnresolvedTrack} previousTrack - The previous track.
|
|
969
|
+
* @param {SearchPlatform} platform - The selected platform.
|
|
970
|
+
* @param {string} apiKey - The Last.fm API key.
|
|
971
|
+
* @returns {Promise<boolean>} - Whether the autoplay was successful.
|
|
972
|
+
*/
|
|
973
|
+
private handlePlatformAutoplay;
|
|
974
|
+
/**
|
|
975
|
+
* Handles YouTube-based autoplay.
|
|
976
|
+
* @param {Player} player - The player instance.
|
|
977
|
+
* @param {Track | UnresolvedTrack} previousTrack - The previous track.
|
|
978
|
+
* @returns {Promise<boolean>} - Whether the autoplay was successful.
|
|
979
|
+
*/
|
|
980
|
+
private handleYouTubeAutoplay;
|
|
948
981
|
private handleFailedTrack;
|
|
949
982
|
/**
|
|
950
983
|
* Handles the case when a track ended and it's set to repeat (track or queue)
|
|
@@ -1522,7 +1555,7 @@ declare class Manager extends EventEmitter {
|
|
|
1522
1555
|
* If `usePriority` is false and `useNode` is not set, the node with the lowest load is chosen.
|
|
1523
1556
|
* @returns {Node} The node to use.
|
|
1524
1557
|
*/
|
|
1525
|
-
get
|
|
1558
|
+
get useableNode(): Node;
|
|
1526
1559
|
/**
|
|
1527
1560
|
* Handles the shutdown of the process by saving all active players' states and optionally cleaning up inactive players.
|
|
1528
1561
|
* This function is called when the process is about to exit.
|
|
@@ -1602,17 +1635,17 @@ declare class Manager extends EventEmitter {
|
|
|
1602
1635
|
create(options: PlayerOptions): Player;
|
|
1603
1636
|
/**
|
|
1604
1637
|
* Returns a player or undefined if it does not exist.
|
|
1605
|
-
* @param
|
|
1638
|
+
* @param guildId The guild ID of the player to retrieve.
|
|
1606
1639
|
* @returns The player if it exists, undefined otherwise.
|
|
1607
1640
|
*/
|
|
1608
|
-
get(
|
|
1641
|
+
get(guildId: string): Player | undefined;
|
|
1609
1642
|
/**
|
|
1610
1643
|
* Destroys a player if it exists and cleans up inactive players.
|
|
1611
|
-
* @param
|
|
1644
|
+
* @param guildId - The guild ID of the player to destroy.
|
|
1612
1645
|
* @returns {void}
|
|
1613
1646
|
* @emits {debug} - Emits a debug message indicating the player is being destroyed.
|
|
1614
1647
|
*/
|
|
1615
|
-
destroy(
|
|
1648
|
+
destroy(guildId: string): void;
|
|
1616
1649
|
/**
|
|
1617
1650
|
* Creates a new node or returns an existing one if it already exists.
|
|
1618
1651
|
* @param options - The options to create the node with.
|
|
@@ -1684,15 +1717,16 @@ declare enum UseNodeOptions {
|
|
|
1684
1717
|
}
|
|
1685
1718
|
type UseNodeOption = keyof typeof UseNodeOptions;
|
|
1686
1719
|
declare enum SearchPlatform {
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1720
|
+
AppleMusic = "amsearch",
|
|
1721
|
+
Bandcamp = "bcsearch",
|
|
1722
|
+
Deezer = "dzsearch",
|
|
1690
1723
|
Jiosaavn = "jssearch",
|
|
1691
1724
|
SoundCloud = "scsearch",
|
|
1692
|
-
|
|
1725
|
+
Spotify = "spsearch",
|
|
1693
1726
|
Tidal = "tdsearch",
|
|
1694
|
-
|
|
1695
|
-
|
|
1727
|
+
VKMusic = "vksearch",
|
|
1728
|
+
YouTube = "ytsearch",
|
|
1729
|
+
YouTubeMusic = "ytmsearch"
|
|
1696
1730
|
}
|
|
1697
1731
|
declare enum PlayerStateEventTypes {
|
|
1698
1732
|
AutoPlayChange = "playerAutoplay",
|
|
@@ -1817,9 +1851,6 @@ declare enum ManagerEventTypes {
|
|
|
1817
1851
|
SocketClosed = "socketClosed",
|
|
1818
1852
|
TrackStart = "trackStart",
|
|
1819
1853
|
TrackEnd = "trackEnd",
|
|
1820
|
-
TrackEndReason = "trackEndReason",
|
|
1821
|
-
TrackEndReasonRaw = "trackEndReasonRaw",
|
|
1822
|
-
TrackEndReasonData = "trackEndReasonData",
|
|
1823
1854
|
TrackStuck = "trackStuck",
|
|
1824
1855
|
TrackError = "trackError",
|
|
1825
1856
|
SegmentsLoaded = "segmentsLoaded",
|