magmastream 2.9.3-dev.3 → 2.9.3-dev.31
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/dist/config/blockedWords.d.ts +1 -0
- package/dist/index.d.ts +19 -3687
- package/dist/index.js +1 -1
- package/dist/statestorage/JsonQueue.d.ts +173 -0
- package/dist/statestorage/JsonQueue.js +32 -4
- package/dist/statestorage/MemoryQueue.d.ts +154 -0
- package/dist/statestorage/MemoryQueue.js +56 -36
- package/dist/statestorage/RedisQueue.d.ts +178 -0
- package/dist/statestorage/RedisQueue.js +29 -7
- package/dist/structures/Enums.d.ts +310 -0
- package/dist/structures/Enums.js +6 -0
- package/dist/structures/Filters.d.ts +352 -0
- package/dist/structures/Filters.js +5 -4
- package/dist/structures/MagmastreamError.d.ts +14 -0
- package/dist/structures/Manager.d.ts +259 -0
- package/dist/structures/Manager.js +296 -555
- package/dist/structures/Node.d.ts +390 -0
- package/dist/structures/Node.js +100 -145
- package/dist/structures/Player.d.ts +347 -0
- package/dist/structures/Player.js +55 -132
- package/dist/structures/Plugin.d.ts +23 -0
- package/dist/structures/Rest.d.ts +93 -0
- package/dist/structures/Rest.js +41 -21
- package/dist/structures/Types.d.ts +1315 -0
- package/dist/structures/Utils.d.ts +169 -0
- package/dist/structures/Utils.js +145 -71
- package/dist/utils/filtersEqualizers.d.ts +16 -0
- package/dist/utils/managerCheck.d.ts +7 -0
- package/dist/utils/nodeCheck.d.ts +7 -0
- package/dist/utils/playerCheck.d.ts +7 -0
- package/dist/wrappers/discord.js.d.ts +15 -0
- package/dist/wrappers/discord.js.js +19 -4
- package/dist/wrappers/discordeno.d.ts +19 -0
- package/dist/wrappers/discordeno.js +77 -0
- package/dist/wrappers/eris.d.ts +15 -0
- package/dist/wrappers/eris.js +20 -3
- package/dist/wrappers/oceanic.d.ts +15 -0
- package/dist/wrappers/oceanic.js +22 -4
- package/dist/wrappers/seyfert.d.ts +37 -0
- package/dist/wrappers/seyfert.js +25 -1
- package/package.json +106 -98
- package/dist/wrappers/detritus.js +0 -52
|
@@ -0,0 +1,1315 @@
|
|
|
1
|
+
import type { User as DJSUser, ClientUser as DJSClientUser, Message as DJSMessage, Guild as DJSGuild } from "discord.js";
|
|
2
|
+
import type { User as OceanicUser, Message as OceanicMessage, Guild as OceanicGuild } from "oceanic.js";
|
|
3
|
+
import type { User as DenoUser, Message as DenoMessage, Guild as DenoGuild } from "@discordeno/bot";
|
|
4
|
+
import type { User as ErisUser, Message as ErisMessage, Guild as ErisGuild } from "eris";
|
|
5
|
+
import type { User as SeyfertUser, ClientUser as SeyfertClientUser, Message as SeyfertMessage, Guild as SeyfertGuild } from "seyfert";
|
|
6
|
+
import { JsonQueue } from "../statestorage/JsonQueue";
|
|
7
|
+
import { MemoryQueue } from "../statestorage/MemoryQueue";
|
|
8
|
+
import { RedisQueue } from "../statestorage/RedisQueue";
|
|
9
|
+
import { AutoPlayPlatform, LoadTypes, ManagerEventTypes, PlayerStateEventTypes, SearchPlatform, SeverityTypes, StateStorageType, TrackEndReasonTypes, TrackPartial, TrackSourceTypes, UseNodeOptions } from "./Enums";
|
|
10
|
+
import { Node } from "./Node";
|
|
11
|
+
import { Player } from "./Player";
|
|
12
|
+
import { Plugin } from "./Plugin";
|
|
13
|
+
/**
|
|
14
|
+
* Manager Options
|
|
15
|
+
*/
|
|
16
|
+
export interface ManagerOptions {
|
|
17
|
+
/** The state storage options.
|
|
18
|
+
*
|
|
19
|
+
* @default { type: StateStorageType.Collection, deleteDestroyedPlayers: true }
|
|
20
|
+
*/
|
|
21
|
+
stateStorage?: StateStorageOptions;
|
|
22
|
+
/** Enable priority mode over least player count or load balancing?
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
enablePriorityMode?: boolean;
|
|
26
|
+
/** Automatically play the next track when the current one ends.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
playNextOnEnd?: boolean;
|
|
30
|
+
/** An array of search platforms to use for autoplay. First to last matters
|
|
31
|
+
* Use enum `AutoPlayPlatform`.
|
|
32
|
+
* @default [AutoPlayPlatform.YouTube]
|
|
33
|
+
*/
|
|
34
|
+
autoPlaySearchPlatforms?: AutoPlayPlatform[];
|
|
35
|
+
/** The client ID to use. */
|
|
36
|
+
clientId?: string;
|
|
37
|
+
/** Value to use for the `Client-Name` header.
|
|
38
|
+
* @default "Magmastream"
|
|
39
|
+
*
|
|
40
|
+
* For NodeLink, leave it empty.
|
|
41
|
+
*/
|
|
42
|
+
clientName?: string;
|
|
43
|
+
/** The array of shard IDs connected to this manager instance.
|
|
44
|
+
* @default 0
|
|
45
|
+
*/
|
|
46
|
+
clusterId?: number;
|
|
47
|
+
/** List of plugins to load. */
|
|
48
|
+
enabledPlugins?: Plugin[];
|
|
49
|
+
/** The default search platform to use.
|
|
50
|
+
* Use enum `SearchPlatform`.
|
|
51
|
+
* @default SearchPlatform.YouTube
|
|
52
|
+
*/
|
|
53
|
+
defaultSearchPlatform?: SearchPlatform;
|
|
54
|
+
/** The last.fm API key.
|
|
55
|
+
* If you need to create one go here: https://www.last.fm/api/account/create.
|
|
56
|
+
* If you already have one, get it from here: https://www.last.fm/api/accounts. */
|
|
57
|
+
lastFmApiKey?: string;
|
|
58
|
+
/** The maximum number of previous tracks to store.
|
|
59
|
+
* @default 20
|
|
60
|
+
*/
|
|
61
|
+
maxPreviousTracks?: number;
|
|
62
|
+
/** The array of nodes to connect to. */
|
|
63
|
+
nodes?: NodeOptions[];
|
|
64
|
+
/** Whether the YouTube video titles should be replaced if the Author does not exactly match.
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
normalizeYouTubeTitles?: boolean;
|
|
68
|
+
/** An array of track properties to keep. `track` will always be present. */
|
|
69
|
+
trackPartial?: TrackPartial[];
|
|
70
|
+
/** Use the least amount of players or least load?
|
|
71
|
+
* Use enum `UseNodeOptions`.
|
|
72
|
+
* @default UseNodeOptions.LeastPlayers
|
|
73
|
+
*/
|
|
74
|
+
useNode?: UseNodeOptions.LeastLoad | UseNodeOptions.LeastPlayers;
|
|
75
|
+
/** Whether the manager should listen to SIGINT and SIGTERM events.
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
listenToSIGEvents?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Function to send data to the websocket.
|
|
81
|
+
* @param id The ID of the node to send the data to.
|
|
82
|
+
* @param payload The payload to send.
|
|
83
|
+
*/
|
|
84
|
+
send?: (packet: DiscordPacket) => unknown;
|
|
85
|
+
/**
|
|
86
|
+
* Optional user cache getter.
|
|
87
|
+
* When resolving a user from a partial ID, this function will be called first.
|
|
88
|
+
* Should return the full user object if cached, or undefined if not.
|
|
89
|
+
* @param id The ID of the user to get.
|
|
90
|
+
* @returns The user object if cached, or undefined if not.
|
|
91
|
+
*/
|
|
92
|
+
getUser?: (id: string) => AnyUser | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Optional guild cache getter.
|
|
95
|
+
* When resolving a guild from a partial ID, this function will be called first.
|
|
96
|
+
* Should return the full guild object if cached, or undefined if not.
|
|
97
|
+
* @param id The ID of the guild to get.
|
|
98
|
+
* @returns The guild object if cached, or undefined if not.
|
|
99
|
+
*/
|
|
100
|
+
getGuild?: (id: string) => AnyGuild | undefined;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* State Storage Options
|
|
104
|
+
*/
|
|
105
|
+
export interface StateStorageOptions {
|
|
106
|
+
type: StateStorageType;
|
|
107
|
+
redisConfig?: RedisConfig;
|
|
108
|
+
jsonConfig?: JsonConfig;
|
|
109
|
+
deleteDestroyedPlayers?: boolean;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Node Options
|
|
113
|
+
*/
|
|
114
|
+
export interface NodeOptions {
|
|
115
|
+
/** The host for the node. */
|
|
116
|
+
host: string;
|
|
117
|
+
/** The port for the node.
|
|
118
|
+
* @default 2333
|
|
119
|
+
*/
|
|
120
|
+
port?: number;
|
|
121
|
+
/** The password for the node.
|
|
122
|
+
* @default "youshallnotpass"
|
|
123
|
+
*/
|
|
124
|
+
password?: string;
|
|
125
|
+
/** Whether the host uses SSL.
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
useSSL?: boolean;
|
|
129
|
+
/** The identifier for the node.
|
|
130
|
+
* @default host
|
|
131
|
+
*/
|
|
132
|
+
identifier?: string;
|
|
133
|
+
/** The maxRetryAttempts for the node.
|
|
134
|
+
* @default 30
|
|
135
|
+
*/
|
|
136
|
+
maxRetryAttempts?: number;
|
|
137
|
+
/** The retryDelayMs for the node.
|
|
138
|
+
* @default 60000
|
|
139
|
+
*/
|
|
140
|
+
retryDelayMs?: number;
|
|
141
|
+
/** Whether to resume the previous session.
|
|
142
|
+
* @default false
|
|
143
|
+
*/
|
|
144
|
+
enableSessionResumeOption?: boolean;
|
|
145
|
+
/** The time in seconds the lavalink server will wait before it removes the player.
|
|
146
|
+
* @default 60
|
|
147
|
+
*/
|
|
148
|
+
sessionTimeoutSeconds?: number;
|
|
149
|
+
/** The timeout used for api calls.
|
|
150
|
+
* @default 10000
|
|
151
|
+
*/
|
|
152
|
+
apiRequestTimeoutMs?: number;
|
|
153
|
+
/** Priority of the node.
|
|
154
|
+
* @default 0
|
|
155
|
+
*/
|
|
156
|
+
nodePriority?: number;
|
|
157
|
+
/** Whether the node is a NodeLink.
|
|
158
|
+
* @default false
|
|
159
|
+
*/
|
|
160
|
+
isNodeLink?: boolean;
|
|
161
|
+
/** Whether the node is a backup node.
|
|
162
|
+
* @default false
|
|
163
|
+
*/
|
|
164
|
+
isBackup?: boolean;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Portable User
|
|
168
|
+
*/
|
|
169
|
+
export interface PortableUser {
|
|
170
|
+
id: string;
|
|
171
|
+
username?: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Any user
|
|
175
|
+
*/
|
|
176
|
+
export type AnyUser = PortableUser | DJSUser | DJSClientUser | OceanicUser | DenoUser | ErisUser | SeyfertUser | SeyfertClientUser;
|
|
177
|
+
/**
|
|
178
|
+
* Portable Message
|
|
179
|
+
*/
|
|
180
|
+
export interface PortableMessage {
|
|
181
|
+
id: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Any message
|
|
185
|
+
*/
|
|
186
|
+
export type AnyMessage = PortableMessage | DJSMessage | OceanicMessage | DenoMessage | ErisMessage | SeyfertMessage;
|
|
187
|
+
/**
|
|
188
|
+
* Any guild
|
|
189
|
+
*/
|
|
190
|
+
export type AnyGuild = DJSGuild | OceanicGuild | DenoGuild | ErisGuild | SeyfertGuild<"cached">;
|
|
191
|
+
/**
|
|
192
|
+
* Discord Packet
|
|
193
|
+
*/
|
|
194
|
+
export interface DiscordPacket {
|
|
195
|
+
/**
|
|
196
|
+
* The opcode for the payload
|
|
197
|
+
*/
|
|
198
|
+
op: number;
|
|
199
|
+
/**
|
|
200
|
+
* Event data
|
|
201
|
+
*/
|
|
202
|
+
d: any;
|
|
203
|
+
/**
|
|
204
|
+
* Sequence number, used for resuming sessions and heartbeats
|
|
205
|
+
*/
|
|
206
|
+
s?: number;
|
|
207
|
+
/**
|
|
208
|
+
* The event name for this payload
|
|
209
|
+
*/
|
|
210
|
+
t?: string;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Player Update Voice State
|
|
214
|
+
*/
|
|
215
|
+
export interface PlayerUpdateVoiceState {
|
|
216
|
+
/**
|
|
217
|
+
* The session id of the voice connection
|
|
218
|
+
*/
|
|
219
|
+
sessionId: string;
|
|
220
|
+
/**
|
|
221
|
+
* Event data
|
|
222
|
+
*/
|
|
223
|
+
event: VoiceServerUpdate;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Voice Server Update
|
|
227
|
+
*/
|
|
228
|
+
export interface VoiceServerUpdate {
|
|
229
|
+
/**
|
|
230
|
+
* The token for the session
|
|
231
|
+
*/
|
|
232
|
+
token: string;
|
|
233
|
+
/**
|
|
234
|
+
* Guild if of the voice connection
|
|
235
|
+
*/
|
|
236
|
+
guild_id: string;
|
|
237
|
+
/**
|
|
238
|
+
* The endpoint lavalink will connect to
|
|
239
|
+
*/
|
|
240
|
+
endpoint: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Redis Configuration
|
|
244
|
+
*/
|
|
245
|
+
export interface RedisConfig {
|
|
246
|
+
host: string;
|
|
247
|
+
port: string;
|
|
248
|
+
password?: string;
|
|
249
|
+
db?: number;
|
|
250
|
+
prefix?: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* JSON Configuration
|
|
254
|
+
*/
|
|
255
|
+
export interface JsonConfig {
|
|
256
|
+
path: string;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Player State Update Event
|
|
260
|
+
*/
|
|
261
|
+
export type PlayerStateUpdateEvent = {
|
|
262
|
+
changeType: PlayerStateEventTypes.TrackChange;
|
|
263
|
+
details: TrackChangeEvent;
|
|
264
|
+
} | {
|
|
265
|
+
changeType: PlayerStateEventTypes.PauseChange;
|
|
266
|
+
details: PauseChangeEvent;
|
|
267
|
+
} | {
|
|
268
|
+
changeType: PlayerStateEventTypes.QueueChange;
|
|
269
|
+
details: QueueChangeEvent;
|
|
270
|
+
} | {
|
|
271
|
+
changeType: PlayerStateEventTypes.ConnectionChange;
|
|
272
|
+
details: ConnectionChangeEvent;
|
|
273
|
+
} | {
|
|
274
|
+
changeType: PlayerStateEventTypes.AutoPlayChange;
|
|
275
|
+
details: AutoplayChangeEvent;
|
|
276
|
+
} | {
|
|
277
|
+
changeType: PlayerStateEventTypes.ChannelChange;
|
|
278
|
+
details: ChannelChangeEvent;
|
|
279
|
+
} | {
|
|
280
|
+
changeType: PlayerStateEventTypes.VolumeChange;
|
|
281
|
+
details: VolumeChangeEvent;
|
|
282
|
+
} | {
|
|
283
|
+
changeType: PlayerStateEventTypes.RepeatChange;
|
|
284
|
+
details: RepeatChangeEvent;
|
|
285
|
+
} | {
|
|
286
|
+
changeType: PlayerStateEventTypes.FilterChange;
|
|
287
|
+
details: FilterChangeEvent;
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Autoplay Change Event
|
|
291
|
+
*/
|
|
292
|
+
interface AutoplayChangeEvent {
|
|
293
|
+
type: "autoplay";
|
|
294
|
+
action: "toggle";
|
|
295
|
+
previousAutoplay: boolean | null;
|
|
296
|
+
currentAutoplay: boolean | null;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Connection Change Event
|
|
300
|
+
*/
|
|
301
|
+
interface ConnectionChangeEvent {
|
|
302
|
+
type: "connection";
|
|
303
|
+
action: "connect" | "disconnect";
|
|
304
|
+
previousConnection: boolean | null;
|
|
305
|
+
currentConnection: boolean | null;
|
|
306
|
+
}
|
|
307
|
+
interface FilterChangeEvent {
|
|
308
|
+
type: "filter";
|
|
309
|
+
action: "change";
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Repeat Change Event
|
|
313
|
+
*/
|
|
314
|
+
interface RepeatChangeEvent {
|
|
315
|
+
type: "repeat";
|
|
316
|
+
action: "dynamic" | "track" | "queue" | "none";
|
|
317
|
+
previousRepeat: "dynamic" | "track" | "queue" | null;
|
|
318
|
+
currentRepeat: "dynamic" | "track" | "queue" | null;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Pause Change Event
|
|
322
|
+
*/
|
|
323
|
+
interface PauseChangeEvent {
|
|
324
|
+
type: "pause";
|
|
325
|
+
action: "pause" | "resume" | "toggle";
|
|
326
|
+
previousPause: boolean | null;
|
|
327
|
+
currentPause: boolean | null;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Queue Change Event
|
|
331
|
+
*/
|
|
332
|
+
interface QueueChangeEvent {
|
|
333
|
+
type: "queue";
|
|
334
|
+
action: "add" | "remove" | "clear" | "shuffle" | "roundRobin" | "userBlock" | "autoPlayAdd";
|
|
335
|
+
previousQueueLength: number | null;
|
|
336
|
+
currentQueueLength: number | null;
|
|
337
|
+
tracks?: Track[];
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Track Change Event
|
|
341
|
+
*/
|
|
342
|
+
interface TrackChangeEvent {
|
|
343
|
+
type: "track";
|
|
344
|
+
action: "start" | "end" | "previous" | "timeUpdate" | "autoPlay";
|
|
345
|
+
track: Track;
|
|
346
|
+
previousTime?: number | null;
|
|
347
|
+
currentTime?: number | null;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Volume Change Event
|
|
351
|
+
*/
|
|
352
|
+
interface VolumeChangeEvent {
|
|
353
|
+
type: "volume";
|
|
354
|
+
action: "adjust";
|
|
355
|
+
previousVolume: number | null;
|
|
356
|
+
currentVolume: number | null;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Channel Change Event
|
|
360
|
+
*/
|
|
361
|
+
interface ChannelChangeEvent {
|
|
362
|
+
type: "channel";
|
|
363
|
+
action: "text" | "voice";
|
|
364
|
+
previousChannel: string | null;
|
|
365
|
+
currentChannel: string | null;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Track
|
|
369
|
+
*/
|
|
370
|
+
export interface Track {
|
|
371
|
+
/** The base64 encoded track. */
|
|
372
|
+
readonly track: string;
|
|
373
|
+
/** The artwork url of the track. */
|
|
374
|
+
readonly artworkUrl: string | null;
|
|
375
|
+
/** The track source name. */
|
|
376
|
+
readonly sourceName: TrackSourceName;
|
|
377
|
+
/** The title of the track. */
|
|
378
|
+
title: string;
|
|
379
|
+
/** The identifier of the track. */
|
|
380
|
+
readonly identifier: string;
|
|
381
|
+
/** The author of the track. */
|
|
382
|
+
author: string;
|
|
383
|
+
/** The duration of the track. */
|
|
384
|
+
readonly duration: number;
|
|
385
|
+
/** The ISRC of the track. */
|
|
386
|
+
readonly isrc: string;
|
|
387
|
+
/** If the track is seekable. */
|
|
388
|
+
readonly isSeekable: boolean;
|
|
389
|
+
/** If the track is a stream.. */
|
|
390
|
+
readonly isStream: boolean;
|
|
391
|
+
/** The uri of the track. */
|
|
392
|
+
readonly uri: string;
|
|
393
|
+
/** The thumbnail of the track or null if it's a unsupported source. */
|
|
394
|
+
readonly thumbnail: string | null;
|
|
395
|
+
/** The user that requested the track. */
|
|
396
|
+
requester: AnyUser;
|
|
397
|
+
/** Displays the track thumbnail with optional size or null if it's a unsupported source. */
|
|
398
|
+
displayThumbnail(size?: Sizes): string | null;
|
|
399
|
+
/** Additional track info provided by plugins. */
|
|
400
|
+
pluginInfo: TrackPluginInfo;
|
|
401
|
+
/** Add your own data to the track. */
|
|
402
|
+
customData: Record<string, unknown>;
|
|
403
|
+
/** If the track got added by autoplay. */
|
|
404
|
+
readonly isAutoplay: boolean;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Track Plugin Info
|
|
408
|
+
*/
|
|
409
|
+
export interface TrackPluginInfo {
|
|
410
|
+
albumName?: string;
|
|
411
|
+
albumUrl?: string;
|
|
412
|
+
artistArtworkUrl?: string;
|
|
413
|
+
artistUrl?: string;
|
|
414
|
+
isPreview?: string;
|
|
415
|
+
previewUrl?: string;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Search Query
|
|
419
|
+
*/
|
|
420
|
+
export interface SearchQuery {
|
|
421
|
+
/** The source to search from. */
|
|
422
|
+
source?: SearchPlatform;
|
|
423
|
+
/** The query to search for. */
|
|
424
|
+
query: string;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Lavalink Response
|
|
428
|
+
*/
|
|
429
|
+
export interface LavalinkResponse {
|
|
430
|
+
loadType: LoadTypes;
|
|
431
|
+
data: TrackData[] | PlaylistRawData;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Track Data
|
|
435
|
+
*/
|
|
436
|
+
export interface TrackData {
|
|
437
|
+
/** The track information. */
|
|
438
|
+
encoded: string;
|
|
439
|
+
/** The detailed information of the track. */
|
|
440
|
+
info: TrackDataInfo;
|
|
441
|
+
/** Additional track info provided by plugins. */
|
|
442
|
+
pluginInfo: Record<string, string>;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Playlist Raw Data
|
|
446
|
+
*/
|
|
447
|
+
export interface PlaylistRawData {
|
|
448
|
+
info: {
|
|
449
|
+
/** The playlist name. */
|
|
450
|
+
name: string;
|
|
451
|
+
};
|
|
452
|
+
/** Addition info provided by plugins. */
|
|
453
|
+
pluginInfo: object;
|
|
454
|
+
/** The tracks of the playlist */
|
|
455
|
+
tracks: TrackData[];
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Track Data Info
|
|
459
|
+
*/
|
|
460
|
+
export interface TrackDataInfo {
|
|
461
|
+
identifier: string;
|
|
462
|
+
isSeekable: boolean;
|
|
463
|
+
author: string;
|
|
464
|
+
length: number;
|
|
465
|
+
isrc?: string;
|
|
466
|
+
isStream: boolean;
|
|
467
|
+
title: string;
|
|
468
|
+
uri?: string;
|
|
469
|
+
artworkUrl?: string;
|
|
470
|
+
sourceName?: TrackSourceName;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* LavaPlayer
|
|
474
|
+
*/
|
|
475
|
+
export interface LavaPlayer {
|
|
476
|
+
guildId: string;
|
|
477
|
+
track: TrackData;
|
|
478
|
+
volume: number;
|
|
479
|
+
paused: boolean;
|
|
480
|
+
state: {
|
|
481
|
+
time: number;
|
|
482
|
+
position: number;
|
|
483
|
+
connected: boolean;
|
|
484
|
+
ping: number;
|
|
485
|
+
};
|
|
486
|
+
voice: LavalinkVoiceStateResponse;
|
|
487
|
+
filters: Record<string, unknown>;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Error or Empty Search Result
|
|
491
|
+
*/
|
|
492
|
+
export interface ErrorOrEmptySearchResult {
|
|
493
|
+
/** The load type of the result. */
|
|
494
|
+
loadType: LoadTypes.Empty | LoadTypes.Error;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Track Search Result
|
|
498
|
+
*/
|
|
499
|
+
export interface TrackSearchResult {
|
|
500
|
+
/** The load type is always 'track' */
|
|
501
|
+
loadType: LoadTypes.Track;
|
|
502
|
+
/** The track obtained */
|
|
503
|
+
tracks: [Track];
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Search Result
|
|
507
|
+
*/
|
|
508
|
+
export interface SearchSearchResult {
|
|
509
|
+
/** The load type is always 'search' */
|
|
510
|
+
loadType: LoadTypes.Search;
|
|
511
|
+
/** The tracks of the search result */
|
|
512
|
+
tracks: Track[];
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Playlist Search Result
|
|
516
|
+
*/
|
|
517
|
+
export interface PlaylistSearchResult {
|
|
518
|
+
/** The playlist load type */
|
|
519
|
+
loadType: LoadTypes.Playlist;
|
|
520
|
+
/** The tracks of the playlist */
|
|
521
|
+
tracks: Track[];
|
|
522
|
+
/** The playlist info */
|
|
523
|
+
playlist: PlaylistData;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Album Search Result
|
|
527
|
+
*/
|
|
528
|
+
export interface AlbumSearchResult {
|
|
529
|
+
loadType: LoadTypes.Album;
|
|
530
|
+
tracks: Track[];
|
|
531
|
+
playlist: PlaylistData;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Artist Search Result
|
|
535
|
+
*/
|
|
536
|
+
export interface ArtistSearchResult {
|
|
537
|
+
loadType: LoadTypes.Artist;
|
|
538
|
+
tracks: Track[];
|
|
539
|
+
playlist: PlaylistData;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Station Search Result
|
|
543
|
+
*/
|
|
544
|
+
export interface StationSearchResult {
|
|
545
|
+
loadType: LoadTypes.Station;
|
|
546
|
+
tracks: Track[];
|
|
547
|
+
playlist: PlaylistData;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Podcast Search Result
|
|
551
|
+
*/
|
|
552
|
+
export interface PodcastSearchResult {
|
|
553
|
+
loadType: LoadTypes.Podcast;
|
|
554
|
+
tracks: Track[];
|
|
555
|
+
playlist: PlaylistData;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Show Search Result
|
|
559
|
+
*/
|
|
560
|
+
export interface ShowSearchResult {
|
|
561
|
+
loadType: LoadTypes.Show;
|
|
562
|
+
tracks: Track[];
|
|
563
|
+
playlist: PlaylistData;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Short Search Result
|
|
567
|
+
*/
|
|
568
|
+
export interface ShortSearchResult {
|
|
569
|
+
loadType: LoadTypes.Short;
|
|
570
|
+
tracks: [Track];
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Playlist Data
|
|
574
|
+
*/
|
|
575
|
+
export interface PlaylistData {
|
|
576
|
+
/** The playlist name. */
|
|
577
|
+
name: string;
|
|
578
|
+
/** Requester of playlist. */
|
|
579
|
+
requester: AnyUser;
|
|
580
|
+
/** More playlist information. */
|
|
581
|
+
playlistInfo: PlaylistInfoData[];
|
|
582
|
+
/** The length of the playlist. */
|
|
583
|
+
duration: number;
|
|
584
|
+
/** The songs of the playlist. */
|
|
585
|
+
tracks: Track[];
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Playlist Info Data
|
|
589
|
+
*/
|
|
590
|
+
export interface PlaylistInfoData {
|
|
591
|
+
/** Url to playlist. */
|
|
592
|
+
url: string;
|
|
593
|
+
/** Type is always playlist in that case. */
|
|
594
|
+
type: string;
|
|
595
|
+
/** ArtworkUrl of playlist */
|
|
596
|
+
artworkUrl: string;
|
|
597
|
+
/** Number of total tracks in playlist */
|
|
598
|
+
totalTracks: number;
|
|
599
|
+
/** Author of playlist */
|
|
600
|
+
author: string;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Manager Events
|
|
604
|
+
*/
|
|
605
|
+
export interface ManagerEvents {
|
|
606
|
+
[ManagerEventTypes.ChapterStarted]: [player: Player, track: Track, payload: SponsorBlockChapterStarted];
|
|
607
|
+
[ManagerEventTypes.ChaptersLoaded]: [player: Player, track: Track, payload: SponsorBlockChaptersLoaded];
|
|
608
|
+
[ManagerEventTypes.Debug]: [info: string];
|
|
609
|
+
[ManagerEventTypes.LyricsFound]: [player: Player, track: Track, payload: LyricsFoundEvent];
|
|
610
|
+
[ManagerEventTypes.LyricsLine]: [player: Player, track: Track, payload: LyricsLineEvent];
|
|
611
|
+
[ManagerEventTypes.LyricsNotFound]: [player: Player, track: Track, payload: LyricsNotFoundEvent];
|
|
612
|
+
[ManagerEventTypes.NodeConnect]: [node: Node];
|
|
613
|
+
[ManagerEventTypes.NodeCreate]: [node: Node];
|
|
614
|
+
[ManagerEventTypes.NodeDestroy]: [node: Node];
|
|
615
|
+
[ManagerEventTypes.NodeDisconnect]: [node: Node, reason: {
|
|
616
|
+
code?: number;
|
|
617
|
+
reason?: string;
|
|
618
|
+
}];
|
|
619
|
+
[ManagerEventTypes.NodeError]: [node: Node, error: Error];
|
|
620
|
+
[ManagerEventTypes.NodeRaw]: [payload: unknown];
|
|
621
|
+
[ManagerEventTypes.NodeReconnect]: [node: Node];
|
|
622
|
+
[ManagerEventTypes.PlayerCreate]: [player: Player];
|
|
623
|
+
[ManagerEventTypes.PlayerDestroy]: [player: Player];
|
|
624
|
+
[ManagerEventTypes.PlayerDisconnect]: [player: Player, oldChannel: string];
|
|
625
|
+
[ManagerEventTypes.PlayerMove]: [player: Player, oldChannel: string, newChannel: string];
|
|
626
|
+
[ManagerEventTypes.PlayerRestored]: [player: Player, node: Node];
|
|
627
|
+
[ManagerEventTypes.PlayerStateUpdate]: [oldPlayer: Player, newPlayer: Player, changeType: PlayerStateUpdateEvent];
|
|
628
|
+
[ManagerEventTypes.QueueEnd]: [player: Player, track: Track, payload: TrackEndEvent];
|
|
629
|
+
[ManagerEventTypes.RestoreComplete]: [node: Node];
|
|
630
|
+
[ManagerEventTypes.SegmentSkipped]: [player: Player, track: Track, payload: SponsorBlockSegmentSkipped];
|
|
631
|
+
[ManagerEventTypes.SegmentsLoaded]: [player: Player, track: Track, payload: SponsorBlockSegmentsLoaded];
|
|
632
|
+
[ManagerEventTypes.SocketClosed]: [player: Player, payload: WebSocketClosedEvent];
|
|
633
|
+
[ManagerEventTypes.TrackEnd]: [player: Player, track: Track, payload: TrackEndEvent];
|
|
634
|
+
[ManagerEventTypes.TrackError]: [player: Player, track: Track, payload: TrackExceptionEvent];
|
|
635
|
+
[ManagerEventTypes.TrackStart]: [player: Player, track: Track, payload: TrackStartEvent];
|
|
636
|
+
[ManagerEventTypes.TrackStuck]: [player: Player, track: Track, payload: TrackStuckEvent];
|
|
637
|
+
[ManagerEventTypes.VoiceReceiverDisconnect]: [player: Player];
|
|
638
|
+
[ManagerEventTypes.VoiceReceiverConnect]: [player: Player];
|
|
639
|
+
[ManagerEventTypes.VoiceReceiverError]: [player: Player, error: Error];
|
|
640
|
+
[ManagerEventTypes.VoiceReceiverStartSpeaking]: [player: Player, data: unknown];
|
|
641
|
+
[ManagerEventTypes.VoiceReceiverEndSpeaking]: [player: Player, data: unknown];
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Voice Packet
|
|
645
|
+
*/
|
|
646
|
+
export interface VoicePacket {
|
|
647
|
+
t?: "VOICE_SERVER_UPDATE" | "VOICE_STATE_UPDATE";
|
|
648
|
+
d: VoiceState | VoiceServer;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Voice Server
|
|
652
|
+
*/
|
|
653
|
+
export interface VoiceServer {
|
|
654
|
+
token: string;
|
|
655
|
+
guild_id: string;
|
|
656
|
+
endpoint: string;
|
|
657
|
+
}
|
|
658
|
+
export interface Extendable {
|
|
659
|
+
Player: typeof Player;
|
|
660
|
+
Queue: typeof MemoryQueue | typeof RedisQueue | typeof JsonQueue;
|
|
661
|
+
Node: typeof Node;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Voice State
|
|
665
|
+
*/
|
|
666
|
+
export interface VoiceState {
|
|
667
|
+
op: "voiceUpdate";
|
|
668
|
+
guildId: string;
|
|
669
|
+
event: VoiceServer;
|
|
670
|
+
sessionId?: string;
|
|
671
|
+
channelId?: string;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Voice State
|
|
675
|
+
*/
|
|
676
|
+
export interface VoiceState {
|
|
677
|
+
guild_id: string;
|
|
678
|
+
user_id: string;
|
|
679
|
+
session_id: string;
|
|
680
|
+
channel_id: string;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* NodeStats interface
|
|
684
|
+
*/
|
|
685
|
+
export interface NodeStats {
|
|
686
|
+
/** The amount of players on the node. */
|
|
687
|
+
players: number;
|
|
688
|
+
/** The amount of playing players on the node. */
|
|
689
|
+
playingPlayers: number;
|
|
690
|
+
/** The uptime for the node. */
|
|
691
|
+
uptime: number;
|
|
692
|
+
/** The memory stats for the node. */
|
|
693
|
+
memory: MemoryStats;
|
|
694
|
+
/** The cpu stats for the node. */
|
|
695
|
+
cpu: CPUStats;
|
|
696
|
+
/** The frame stats for the node. */
|
|
697
|
+
frameStats: FrameStats;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Node Message
|
|
701
|
+
*/
|
|
702
|
+
export interface NodeMessage extends NodeStats {
|
|
703
|
+
type: PlayerEventType;
|
|
704
|
+
op: "stats" | "playerUpdate" | "event";
|
|
705
|
+
guildId: string;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* PlayerEvent interface
|
|
709
|
+
*/
|
|
710
|
+
export interface PlayerEvent {
|
|
711
|
+
op: "event";
|
|
712
|
+
type: PlayerEventType;
|
|
713
|
+
guildId: string;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Exception interface
|
|
717
|
+
*/
|
|
718
|
+
export interface Exception {
|
|
719
|
+
message: string;
|
|
720
|
+
severity: SeverityTypes;
|
|
721
|
+
cause: string;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* TrackStartEvent interface
|
|
725
|
+
*/
|
|
726
|
+
export interface TrackStartEvent extends PlayerEvent {
|
|
727
|
+
type: "TrackStartEvent";
|
|
728
|
+
track: TrackData;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* TrackEndEvent interface
|
|
732
|
+
*/
|
|
733
|
+
export interface TrackEndEvent extends PlayerEvent {
|
|
734
|
+
type: "TrackEndEvent";
|
|
735
|
+
track: TrackData;
|
|
736
|
+
reason: TrackEndReasonTypes;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* TrackExceptionEvent interface
|
|
740
|
+
*/
|
|
741
|
+
export interface TrackExceptionEvent extends PlayerEvent {
|
|
742
|
+
exception?: Exception;
|
|
743
|
+
guildId: string;
|
|
744
|
+
type: "TrackExceptionEvent";
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* TrackStuckEvent interface
|
|
748
|
+
*/
|
|
749
|
+
export interface TrackStuckEvent extends PlayerEvent {
|
|
750
|
+
type: "TrackStuckEvent";
|
|
751
|
+
thresholdMs: number;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* WebSocketClosedEvent interface
|
|
755
|
+
*/
|
|
756
|
+
export interface WebSocketClosedEvent extends PlayerEvent {
|
|
757
|
+
type: "WebSocketClosedEvent";
|
|
758
|
+
code: number;
|
|
759
|
+
reason: string;
|
|
760
|
+
byRemote: boolean;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* SponsorBlockSegmentsLoaded interface
|
|
764
|
+
*/
|
|
765
|
+
export interface SponsorBlockSegmentsLoaded extends PlayerEvent {
|
|
766
|
+
type: "SegmentsLoaded";
|
|
767
|
+
segments: {
|
|
768
|
+
category: string;
|
|
769
|
+
start: number;
|
|
770
|
+
end: number;
|
|
771
|
+
}[];
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* SponsorBlockSegmentSkipped interface
|
|
775
|
+
*/
|
|
776
|
+
export interface SponsorBlockSegmentSkipped extends PlayerEvent {
|
|
777
|
+
type: "SegmentSkipped";
|
|
778
|
+
segment: {
|
|
779
|
+
category: string;
|
|
780
|
+
start: number;
|
|
781
|
+
end: number;
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* SponsorBlockChapterStarted interface
|
|
786
|
+
*/
|
|
787
|
+
export interface SponsorBlockChapterStarted extends PlayerEvent {
|
|
788
|
+
type: "ChapterStarted";
|
|
789
|
+
/** The chapter which started */
|
|
790
|
+
chapter: {
|
|
791
|
+
/** The name of the chapter */
|
|
792
|
+
name: string;
|
|
793
|
+
start: number;
|
|
794
|
+
end: number;
|
|
795
|
+
duration: number;
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* SponsorBlockChaptersLoaded interface
|
|
800
|
+
*/
|
|
801
|
+
export interface SponsorBlockChaptersLoaded extends PlayerEvent {
|
|
802
|
+
type: "ChaptersLoaded";
|
|
803
|
+
/** All chapters loaded */
|
|
804
|
+
chapters: {
|
|
805
|
+
/** The name of the chapter */
|
|
806
|
+
name: string;
|
|
807
|
+
start: number;
|
|
808
|
+
end: number;
|
|
809
|
+
duration: number;
|
|
810
|
+
}[];
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* NodeStats interface
|
|
814
|
+
*/
|
|
815
|
+
export interface NodeStats {
|
|
816
|
+
/** The amount of players on the node. */
|
|
817
|
+
players: number;
|
|
818
|
+
/** The amount of playing players on the node. */
|
|
819
|
+
playingPlayers: number;
|
|
820
|
+
/** The uptime for the node. */
|
|
821
|
+
uptime: number;
|
|
822
|
+
/** The memory stats for the node. */
|
|
823
|
+
memory: MemoryStats;
|
|
824
|
+
/** The cpu stats for the node. */
|
|
825
|
+
cpu: CPUStats;
|
|
826
|
+
/** The frame stats for the node. */
|
|
827
|
+
frameStats: FrameStats;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* MemoryStats interface
|
|
831
|
+
*/
|
|
832
|
+
export interface MemoryStats {
|
|
833
|
+
/** The free memory of the allocated amount. */
|
|
834
|
+
free: number;
|
|
835
|
+
/** The used memory of the allocated amount. */
|
|
836
|
+
used: number;
|
|
837
|
+
/** The total allocated memory. */
|
|
838
|
+
allocated: number;
|
|
839
|
+
/** The reservable memory. */
|
|
840
|
+
reservable: number;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* CPUStats interface
|
|
844
|
+
*/
|
|
845
|
+
export interface CPUStats {
|
|
846
|
+
/** The core amount the host machine has. */
|
|
847
|
+
cores: number;
|
|
848
|
+
/** The system load. */
|
|
849
|
+
systemLoad: number;
|
|
850
|
+
/** The lavalink load. */
|
|
851
|
+
lavalinkLoad: number;
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* FrameStats interface
|
|
855
|
+
*/
|
|
856
|
+
export interface FrameStats {
|
|
857
|
+
/** The amount of sent frames. */
|
|
858
|
+
sent?: number;
|
|
859
|
+
/** The amount of nulled frames. */
|
|
860
|
+
nulled?: number;
|
|
861
|
+
/** The amount of deficit frames. */
|
|
862
|
+
deficit?: number;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* LavalinkInfo interface
|
|
866
|
+
*/
|
|
867
|
+
export interface LavalinkInfo {
|
|
868
|
+
version: {
|
|
869
|
+
semver: string;
|
|
870
|
+
major: number;
|
|
871
|
+
minor: number;
|
|
872
|
+
patch: number;
|
|
873
|
+
preRelease: string;
|
|
874
|
+
};
|
|
875
|
+
buildTime: number;
|
|
876
|
+
git: {
|
|
877
|
+
branch: string;
|
|
878
|
+
commit: string;
|
|
879
|
+
commitTime: number;
|
|
880
|
+
};
|
|
881
|
+
jvm: string;
|
|
882
|
+
lavaplayer: string;
|
|
883
|
+
sourceManagers: string[];
|
|
884
|
+
filters: string[];
|
|
885
|
+
plugins: {
|
|
886
|
+
name: string;
|
|
887
|
+
version: string;
|
|
888
|
+
}[];
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* LyricsLine interface
|
|
892
|
+
*/
|
|
893
|
+
export interface LyricsLine {
|
|
894
|
+
timestamp: number;
|
|
895
|
+
duration: number;
|
|
896
|
+
line: string;
|
|
897
|
+
plugin: object;
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Lyrics interface
|
|
901
|
+
*/
|
|
902
|
+
export interface Lyrics {
|
|
903
|
+
source: string;
|
|
904
|
+
provider: string;
|
|
905
|
+
text?: string;
|
|
906
|
+
lines: LyricsLine[];
|
|
907
|
+
plugin: object[];
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* LyricsFoundEvent interface
|
|
911
|
+
*/
|
|
912
|
+
export interface LyricsFoundEvent extends PlayerEvent {
|
|
913
|
+
type: "LyricsFoundEvent";
|
|
914
|
+
guildId: string;
|
|
915
|
+
lyrics: Lyrics;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* LyricsNotFoundEvent interface
|
|
919
|
+
*/
|
|
920
|
+
export interface LyricsNotFoundEvent extends PlayerEvent {
|
|
921
|
+
type: "LyricsNotFoundEvent";
|
|
922
|
+
guildId: string;
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* LyricsLineEvent interface
|
|
926
|
+
*/
|
|
927
|
+
export interface LyricsLineEvent extends PlayerEvent {
|
|
928
|
+
type: "LyricsLineEvent";
|
|
929
|
+
guildId: string;
|
|
930
|
+
lineIndex: number;
|
|
931
|
+
line: LyricsLine;
|
|
932
|
+
skipped: boolean;
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* NodeLink Get Lyrics Multiple interface
|
|
936
|
+
*/
|
|
937
|
+
export interface NodeLinkGetLyricsMultiple {
|
|
938
|
+
loadType: "lyricsMultiple";
|
|
939
|
+
data: NodeLinkGetLyricsData[];
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* NodeLink Get Lyrics Empty interface
|
|
943
|
+
*/
|
|
944
|
+
export interface NodeLinkGetLyricsEmpty {
|
|
945
|
+
loadType: "empty";
|
|
946
|
+
data: Record<never, never>;
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* NodeLink Get Lyrics Data interface
|
|
950
|
+
*/
|
|
951
|
+
interface NodeLinkGetLyricsData {
|
|
952
|
+
name: string;
|
|
953
|
+
synced: boolean;
|
|
954
|
+
data: {
|
|
955
|
+
startTime?: number;
|
|
956
|
+
endTime?: number;
|
|
957
|
+
text: string;
|
|
958
|
+
}[];
|
|
959
|
+
rtl: boolean;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* NodeLink Get Lyrics Single interface
|
|
963
|
+
*/
|
|
964
|
+
export interface NodeLinkGetLyricsSingle {
|
|
965
|
+
loadType: "lyricsSingle";
|
|
966
|
+
data: NodeLinkGetLyricsData;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* NodeLink Get Lyrics Error interface
|
|
970
|
+
*/
|
|
971
|
+
export interface NodeLinkGetLyricsError {
|
|
972
|
+
loadType: "error";
|
|
973
|
+
data: {
|
|
974
|
+
message: string;
|
|
975
|
+
severity: Severity;
|
|
976
|
+
cause: string;
|
|
977
|
+
trace?: string;
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Start Speaking Event Voice Receiver Data interface
|
|
982
|
+
*/
|
|
983
|
+
export interface StartSpeakingEventVoiceReceiverData {
|
|
984
|
+
/**
|
|
985
|
+
* The user ID of the user who started speaking.
|
|
986
|
+
*/
|
|
987
|
+
userId: string;
|
|
988
|
+
/**
|
|
989
|
+
* The guild ID of the guild where the user started speaking.
|
|
990
|
+
*/
|
|
991
|
+
guildId: string;
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* End Speaking Event Voice Receiver Data interface
|
|
995
|
+
*/
|
|
996
|
+
export interface EndSpeakingEventVoiceReceiverData {
|
|
997
|
+
/**
|
|
998
|
+
* The user ID of the user who stopped speaking.
|
|
999
|
+
*/
|
|
1000
|
+
userId: string;
|
|
1001
|
+
/**
|
|
1002
|
+
* The guild ID of the guild where the user stopped speaking.
|
|
1003
|
+
*/
|
|
1004
|
+
guildId: string;
|
|
1005
|
+
/**
|
|
1006
|
+
* The audio data received from the user in base64.
|
|
1007
|
+
*/
|
|
1008
|
+
data: string;
|
|
1009
|
+
/**
|
|
1010
|
+
* The type of the audio data. Can be either opus or pcm. Older versions may include ogg/opus.
|
|
1011
|
+
*/
|
|
1012
|
+
type: "opus" | "pcm";
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Base Voice Receiver Event interface
|
|
1016
|
+
*/
|
|
1017
|
+
interface BaseVoiceReceiverEvent {
|
|
1018
|
+
op: "speak";
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Start Speaking Event Voice Receiver interface
|
|
1022
|
+
*/
|
|
1023
|
+
export interface StartSpeakingEventVoiceReceiver extends BaseVoiceReceiverEvent {
|
|
1024
|
+
type: "startSpeakingEvent";
|
|
1025
|
+
data: StartSpeakingEventVoiceReceiverData;
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* End Speaking Event Voice Receiver interface
|
|
1029
|
+
*/
|
|
1030
|
+
export interface EndSpeakingEventVoiceReceiver extends BaseVoiceReceiverEvent {
|
|
1031
|
+
type: "endSpeakingEvent";
|
|
1032
|
+
data: EndSpeakingEventVoiceReceiverData;
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* PlayerOptions interface
|
|
1036
|
+
*/
|
|
1037
|
+
export interface PlayerOptions {
|
|
1038
|
+
/** The guild ID the Player belongs to. */
|
|
1039
|
+
guildId: string;
|
|
1040
|
+
/** The text channel the Player belongs to. */
|
|
1041
|
+
textChannelId: string;
|
|
1042
|
+
/** The voice channel the Player belongs to. */
|
|
1043
|
+
voiceChannelId?: string;
|
|
1044
|
+
/** The node identifier the Player uses. */
|
|
1045
|
+
nodeIdentifier?: string;
|
|
1046
|
+
/** The initial volume the Player will use. */
|
|
1047
|
+
volume?: number;
|
|
1048
|
+
/** If the player should mute itself. */
|
|
1049
|
+
selfMute?: boolean;
|
|
1050
|
+
/** If the player should deaf itself. */
|
|
1051
|
+
selfDeafen?: boolean;
|
|
1052
|
+
/** Whether to apply the volume as a filter. */
|
|
1053
|
+
applyVolumeAsFilter?: boolean;
|
|
1054
|
+
/** Whether to pause the player when the voice connection is disconnected. */
|
|
1055
|
+
pauseOnDisconnect?: boolean;
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* PlayOptions interface
|
|
1059
|
+
*/
|
|
1060
|
+
export interface PlayOptions {
|
|
1061
|
+
/** The position to start the track. */
|
|
1062
|
+
readonly startTime?: number;
|
|
1063
|
+
/** The position to end the track. */
|
|
1064
|
+
readonly endTime?: number;
|
|
1065
|
+
/** Whether to not replace the track if a play payload is sent. */
|
|
1066
|
+
readonly noReplace?: boolean;
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* RestPlayOptions interface
|
|
1070
|
+
*/
|
|
1071
|
+
export interface RestPlayOptions {
|
|
1072
|
+
guildId: string;
|
|
1073
|
+
data: {
|
|
1074
|
+
/** The base64 encoded track. */
|
|
1075
|
+
encodedTrack?: string;
|
|
1076
|
+
/** The track ID. */
|
|
1077
|
+
identifier?: string;
|
|
1078
|
+
/** The track time to start at. */
|
|
1079
|
+
startTime?: number;
|
|
1080
|
+
/** The track time to end at. */
|
|
1081
|
+
endTime?: number;
|
|
1082
|
+
/** The player volume level. */
|
|
1083
|
+
volume?: number;
|
|
1084
|
+
/** The player position in a track. */
|
|
1085
|
+
position?: number;
|
|
1086
|
+
/** Whether the player is paused. */
|
|
1087
|
+
paused?: boolean;
|
|
1088
|
+
/** The audio effects. */
|
|
1089
|
+
filters?: object;
|
|
1090
|
+
/** voice payload. */
|
|
1091
|
+
voice?: LavalinkVoiceStateUpdate;
|
|
1092
|
+
/** Whether to not replace the track if a play payload is sent. */
|
|
1093
|
+
noReplace?: boolean;
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* PlayerStateEntry interface
|
|
1098
|
+
*/
|
|
1099
|
+
export interface SerializedPlayerState {
|
|
1100
|
+
clusterId: number;
|
|
1101
|
+
guildId: string;
|
|
1102
|
+
voiceChannelId: string | null;
|
|
1103
|
+
textChannelId: string | null;
|
|
1104
|
+
volume: number;
|
|
1105
|
+
position: number;
|
|
1106
|
+
isAutoplay?: boolean;
|
|
1107
|
+
autoplayTries?: number;
|
|
1108
|
+
paused: boolean;
|
|
1109
|
+
playing: boolean;
|
|
1110
|
+
trackRepeat: boolean;
|
|
1111
|
+
queueRepeat: boolean;
|
|
1112
|
+
dynamicRepeat: boolean;
|
|
1113
|
+
dynamicLoopInterval?: number;
|
|
1114
|
+
voiceState: VoiceState;
|
|
1115
|
+
options: PlayerOptions;
|
|
1116
|
+
node: {
|
|
1117
|
+
sessionId: string;
|
|
1118
|
+
options: {
|
|
1119
|
+
identifier: string;
|
|
1120
|
+
};
|
|
1121
|
+
} | null;
|
|
1122
|
+
queue: {
|
|
1123
|
+
current: Track | null;
|
|
1124
|
+
tracks: Track[];
|
|
1125
|
+
previous: Array<Track | null>;
|
|
1126
|
+
};
|
|
1127
|
+
filters: {
|
|
1128
|
+
bassBoostlevel: number | null;
|
|
1129
|
+
equalizer: EqualizerBand[];
|
|
1130
|
+
distortion: DistortionOptions;
|
|
1131
|
+
karaoke: KaraokeOptions;
|
|
1132
|
+
timescale: TimescaleOptions;
|
|
1133
|
+
vibrato: VibratoOptions;
|
|
1134
|
+
rotation: RotationOptions;
|
|
1135
|
+
reverb: ReverbOptions;
|
|
1136
|
+
volume: number;
|
|
1137
|
+
filterStatus: Record<string, boolean>;
|
|
1138
|
+
} | null;
|
|
1139
|
+
data?: Record<string, unknown> & {
|
|
1140
|
+
clientUser?: AnyUser;
|
|
1141
|
+
nowPlayingMessage?: {
|
|
1142
|
+
id: string;
|
|
1143
|
+
channelId: string;
|
|
1144
|
+
guildId: string;
|
|
1145
|
+
} | null;
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
/**
|
|
1149
|
+
* Lavalink voice state response
|
|
1150
|
+
*/
|
|
1151
|
+
export type LavalinkVoiceStateResponse = {
|
|
1152
|
+
token: string;
|
|
1153
|
+
endpoint: string;
|
|
1154
|
+
sessionId: string;
|
|
1155
|
+
channelId: string | null;
|
|
1156
|
+
};
|
|
1157
|
+
/**
|
|
1158
|
+
* Lavalink voice state update
|
|
1159
|
+
*/
|
|
1160
|
+
export type LavalinkVoiceStateUpdate = {
|
|
1161
|
+
token: string;
|
|
1162
|
+
endpoint: string;
|
|
1163
|
+
sessionId: string;
|
|
1164
|
+
channelId: string;
|
|
1165
|
+
};
|
|
1166
|
+
/**
|
|
1167
|
+
* ManagerInitOptions interface
|
|
1168
|
+
*/
|
|
1169
|
+
export interface ManagerInitOptions {
|
|
1170
|
+
clientId?: string;
|
|
1171
|
+
clusterId?: number;
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* EqualizerBand interface
|
|
1175
|
+
*/
|
|
1176
|
+
export interface EqualizerBand {
|
|
1177
|
+
/** The band number being 0 to 14. */
|
|
1178
|
+
band: number;
|
|
1179
|
+
/** The gain amount being -0.25 to 1.00, 0.25 being double. */
|
|
1180
|
+
gain: number;
|
|
1181
|
+
}
|
|
1182
|
+
/** Options for adjusting the timescale of audio. */
|
|
1183
|
+
export interface TimescaleOptions {
|
|
1184
|
+
speed?: number;
|
|
1185
|
+
pitch?: number;
|
|
1186
|
+
rate?: number;
|
|
1187
|
+
}
|
|
1188
|
+
/** Options for applying vibrato effect to audio. */
|
|
1189
|
+
export interface VibratoOptions {
|
|
1190
|
+
frequency: number;
|
|
1191
|
+
depth: number;
|
|
1192
|
+
}
|
|
1193
|
+
/** Options for applying rotation effect to audio. */
|
|
1194
|
+
export interface RotationOptions {
|
|
1195
|
+
rotationHz: number;
|
|
1196
|
+
}
|
|
1197
|
+
/** Options for applying karaoke effect to audio. */
|
|
1198
|
+
export interface KaraokeOptions {
|
|
1199
|
+
level?: number;
|
|
1200
|
+
monoLevel?: number;
|
|
1201
|
+
filterBand?: number;
|
|
1202
|
+
filterWidth?: number;
|
|
1203
|
+
}
|
|
1204
|
+
/** Options for applying distortion effect to audio. */
|
|
1205
|
+
export interface DistortionOptions {
|
|
1206
|
+
sinOffset?: number;
|
|
1207
|
+
sinScale?: number;
|
|
1208
|
+
cosOffset?: number;
|
|
1209
|
+
cosScale?: number;
|
|
1210
|
+
tanOffset?: number;
|
|
1211
|
+
tanScale?: number;
|
|
1212
|
+
offset?: number;
|
|
1213
|
+
scale?: number;
|
|
1214
|
+
}
|
|
1215
|
+
/** Options for applying reverb effect to audio. */
|
|
1216
|
+
export interface ReverbOptions {
|
|
1217
|
+
wet?: number;
|
|
1218
|
+
dry?: number;
|
|
1219
|
+
roomSize?: number;
|
|
1220
|
+
damping?: number;
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Queue interface
|
|
1224
|
+
*/
|
|
1225
|
+
export interface IQueue {
|
|
1226
|
+
getCurrent(): Track | Promise<Track | null>;
|
|
1227
|
+
setCurrent(track: Track | null): void | Promise<void>;
|
|
1228
|
+
getPrevious(): Track[] | Promise<Track[]>;
|
|
1229
|
+
addPrevious(track: Track | Track[]): void | Promise<void>;
|
|
1230
|
+
setPrevious(track: Track | Track[]): void | Promise<void>;
|
|
1231
|
+
/** Get newest track (index 0) */
|
|
1232
|
+
popPrevious(): Track | Promise<Track | null>;
|
|
1233
|
+
clearPrevious(): void | Promise<void>;
|
|
1234
|
+
size(): number | Promise<number>;
|
|
1235
|
+
totalSize(): number | Promise<number>;
|
|
1236
|
+
duration(): number | Promise<number>;
|
|
1237
|
+
add(track: Track | Track[], offset?: number): void | Promise<void>;
|
|
1238
|
+
remove(start?: number, end?: number): Track[] | Promise<Track[]>;
|
|
1239
|
+
clear(): void | Promise<void>;
|
|
1240
|
+
dequeue(): Track | Promise<Track | undefined>;
|
|
1241
|
+
enqueueFront(track: Track | Track[]): void | Promise<void>;
|
|
1242
|
+
getTracks(): Track[] | Promise<Track[]>;
|
|
1243
|
+
getSlice(start?: number, end?: number): Track[] | Promise<Track[]>;
|
|
1244
|
+
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Track[] | Promise<Track[]>;
|
|
1245
|
+
shuffle(): void | Promise<void>;
|
|
1246
|
+
userBlockShuffle(): void | Promise<void>;
|
|
1247
|
+
roundRobinShuffle(): void | Promise<void>;
|
|
1248
|
+
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): T[] | Promise<T[]>;
|
|
1249
|
+
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Track[] | Promise<Track[]>;
|
|
1250
|
+
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Track | Promise<Track | undefined>;
|
|
1251
|
+
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): boolean | Promise<boolean>;
|
|
1252
|
+
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): boolean | Promise<boolean>;
|
|
1253
|
+
destroy(): void | Promise<void>;
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Sizes Enum type
|
|
1257
|
+
*/
|
|
1258
|
+
export type Sizes = "0" | "1" | "2" | "3" | "default" | "mqdefault" | "hqdefault" | "maxresdefault";
|
|
1259
|
+
/**
|
|
1260
|
+
* Track Source Name Enum type
|
|
1261
|
+
*/
|
|
1262
|
+
export type TrackSourceName = keyof typeof TrackSourceTypes;
|
|
1263
|
+
/**
|
|
1264
|
+
* Use Node Option Enum type
|
|
1265
|
+
*/
|
|
1266
|
+
export type UseNodeOption = keyof typeof UseNodeOptions;
|
|
1267
|
+
/**
|
|
1268
|
+
* Track End Reason Enum type
|
|
1269
|
+
*/
|
|
1270
|
+
export type TrackEndReason = keyof typeof TrackEndReasonTypes;
|
|
1271
|
+
/**
|
|
1272
|
+
* Player Event Type Enum type
|
|
1273
|
+
*/
|
|
1274
|
+
export type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | "SegmentSkipped" | "SegmentsLoaded" | "ChaptersLoaded" | "ChapterStarted" | "LyricsFoundEvent" | "LyricsNotFoundEvent" | "LyricsLineEvent";
|
|
1275
|
+
/**
|
|
1276
|
+
* Severity Types Enum type
|
|
1277
|
+
*/
|
|
1278
|
+
export type Severity = keyof typeof SeverityTypes;
|
|
1279
|
+
/**
|
|
1280
|
+
* SponsorBlock Segment Events Enum type
|
|
1281
|
+
*/
|
|
1282
|
+
export type SponsorBlockSegmentEvents = SponsorBlockSegmentSkipped | SponsorBlockSegmentsLoaded | SponsorBlockChapterStarted | SponsorBlockChaptersLoaded;
|
|
1283
|
+
/**
|
|
1284
|
+
* SponsorBlock Segment Event Type Enum type
|
|
1285
|
+
*/
|
|
1286
|
+
export type SponsorBlockSegmentEventType = "SegmentSkipped" | "SegmentsLoaded" | "ChapterStarted" | "ChaptersLoaded";
|
|
1287
|
+
/**
|
|
1288
|
+
* Player Events Enum type
|
|
1289
|
+
*/
|
|
1290
|
+
export type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents | LyricsEvent;
|
|
1291
|
+
/**
|
|
1292
|
+
* Load Type Enum type
|
|
1293
|
+
*/
|
|
1294
|
+
export type LoadType = keyof typeof LoadTypes;
|
|
1295
|
+
/**
|
|
1296
|
+
* NodeLink Get Lyrics Enum type
|
|
1297
|
+
*/
|
|
1298
|
+
export type NodeLinkGetLyrics = NodeLinkGetLyricsSingle | NodeLinkGetLyricsMultiple | NodeLinkGetLyricsEmpty | NodeLinkGetLyricsError;
|
|
1299
|
+
/**
|
|
1300
|
+
* Voice Receiver Event Enum type
|
|
1301
|
+
*/
|
|
1302
|
+
export type VoiceReceiverEvent = StartSpeakingEventVoiceReceiver | EndSpeakingEventVoiceReceiver;
|
|
1303
|
+
/**
|
|
1304
|
+
* Search Result Enum type
|
|
1305
|
+
*/
|
|
1306
|
+
export type SearchResult = TrackSearchResult | SearchSearchResult | PlaylistSearchResult | ErrorOrEmptySearchResult | AlbumSearchResult | ArtistSearchResult | StationSearchResult | PodcastSearchResult | ShowSearchResult | ShortSearchResult;
|
|
1307
|
+
/**
|
|
1308
|
+
* Lyrics Event Enum type
|
|
1309
|
+
*/
|
|
1310
|
+
export type LyricsEvent = LyricsFoundEvent | LyricsNotFoundEvent | LyricsLineEvent;
|
|
1311
|
+
/**
|
|
1312
|
+
* Lyrics Event Type Enum type
|
|
1313
|
+
*/
|
|
1314
|
+
export type LyricsEventType = "LyricsFoundEvent" | "LyricsNotFoundEvent" | "LyricsLineEvent";
|
|
1315
|
+
export {};
|