discord-player 5.2.3-dev → 5.3.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.
@@ -10,7 +10,7 @@ class Track {
10
10
  */
11
11
  constructor(player, data) {
12
12
  this.raw = {};
13
- this.id = discord_js_1.SnowflakeUtil.generate();
13
+ this.id = discord_js_1.SnowflakeUtil.generate().toString();
14
14
  /**
15
15
  * The player that instantiated this Track
16
16
  * @name Track#player
@@ -82,17 +82,16 @@ class Track {
82
82
  void this._patch(data);
83
83
  }
84
84
  _patch(data) {
85
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
86
- this.title = discord_js_1.Util.escapeMarkdown((_a = data.title) !== null && _a !== void 0 ? _a : "");
87
- this.author = (_b = data.author) !== null && _b !== void 0 ? _b : "";
88
- this.url = (_c = data.url) !== null && _c !== void 0 ? _c : "";
89
- this.thumbnail = (_d = data.thumbnail) !== null && _d !== void 0 ? _d : "";
90
- this.duration = (_e = data.duration) !== null && _e !== void 0 ? _e : "";
91
- this.views = (_f = data.views) !== null && _f !== void 0 ? _f : 0;
85
+ this.title = (0, discord_js_1.escapeMarkdown)(data.title ?? "");
86
+ this.author = data.author ?? "";
87
+ this.url = data.url ?? "";
88
+ this.thumbnail = data.thumbnail ?? "";
89
+ this.duration = data.duration ?? "";
90
+ this.views = data.views ?? 0;
92
91
  this.requestedBy = data.requestedBy;
93
92
  this.playlist = data.playlist;
94
93
  // raw
95
- Object.defineProperty(this, "raw", { value: Object.assign({}, { source: (_h = (_g = data.raw) === null || _g === void 0 ? void 0 : _g.source) !== null && _h !== void 0 ? _h : data.source }, (_j = data.raw) !== null && _j !== void 0 ? _j : data), enumerable: false });
94
+ Object.defineProperty(this, "raw", { value: Object.assign({}, { source: data.raw?.source ?? data.source }, data.raw ?? data), enumerable: false });
96
95
  }
97
96
  /**
98
97
  * The queue in which this track is located
@@ -123,8 +122,7 @@ class Track {
123
122
  * @type {TrackSource}
124
123
  */
125
124
  get source() {
126
- var _a;
127
- return (_a = this.raw.source) !== null && _a !== void 0 ? _a : "arbitrary";
125
+ return this.raw.source ?? "arbitrary";
128
126
  }
129
127
  /**
130
128
  * String representation of this track
@@ -138,7 +136,6 @@ class Track {
138
136
  * @returns {TrackJSON}
139
137
  */
140
138
  toJSON(hidePlaylist) {
141
- var _a, _b, _c;
142
139
  return {
143
140
  id: this.id,
144
141
  title: this.title,
@@ -149,8 +146,8 @@ class Track {
149
146
  duration: this.duration,
150
147
  durationMS: this.durationMS,
151
148
  views: this.views,
152
- requestedBy: (_a = this.requestedBy) === null || _a === void 0 ? void 0 : _a.id,
153
- playlist: hidePlaylist ? null : (_c = (_b = this.playlist) === null || _b === void 0 ? void 0 : _b.toJSON()) !== null && _c !== void 0 ? _c : null
149
+ requestedBy: this.requestedBy?.id,
150
+ playlist: hidePlaylist ? null : this.playlist?.toJSON() ?? null
154
151
  };
155
152
  }
156
153
  }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StreamDispatcher = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const voice_1 = require("@discordjs/voice");
6
5
  const tiny_typed_emitter_1 = require("tiny-typed-emitter");
7
6
  const Util_1 = require("../utils/Util");
@@ -37,14 +36,13 @@ class StreamDispatcher extends tiny_typed_emitter_1.TypedEmitter {
37
36
  * @type {boolean}
38
37
  */
39
38
  this.paused = false;
40
- // @ts-expect-error ???
41
- this.voiceConnection.on("stateChange", (_, newState) => tslib_1.__awaiter(this, void 0, void 0, function* () {
39
+ this.voiceConnection.on("stateChange", async (_, newState) => {
42
40
  if (newState.status === voice_1.VoiceConnectionStatus.Disconnected) {
43
41
  if (newState.reason === voice_1.VoiceConnectionDisconnectReason.WebSocketClose && newState.closeCode === 4014) {
44
42
  try {
45
- yield (0, voice_1.entersState)(this.voiceConnection, voice_1.VoiceConnectionStatus.Connecting, this.connectionTimeout);
43
+ await (0, voice_1.entersState)(this.voiceConnection, voice_1.VoiceConnectionStatus.Connecting, this.connectionTimeout);
46
44
  }
47
- catch (_a) {
45
+ catch {
48
46
  try {
49
47
  this.voiceConnection.destroy();
50
48
  }
@@ -54,7 +52,7 @@ class StreamDispatcher extends tiny_typed_emitter_1.TypedEmitter {
54
52
  }
55
53
  }
56
54
  else if (this.voiceConnection.rejoinAttempts < 5) {
57
- yield Util_1.Util.wait((this.voiceConnection.rejoinAttempts + 1) * 5000);
55
+ await Util_1.Util.wait((this.voiceConnection.rejoinAttempts + 1) * 5000);
58
56
  this.voiceConnection.rejoin();
59
57
  }
60
58
  else {
@@ -72,9 +70,9 @@ class StreamDispatcher extends tiny_typed_emitter_1.TypedEmitter {
72
70
  else if (!this.readyLock && (newState.status === voice_1.VoiceConnectionStatus.Connecting || newState.status === voice_1.VoiceConnectionStatus.Signalling)) {
73
71
  this.readyLock = true;
74
72
  try {
75
- yield (0, voice_1.entersState)(this.voiceConnection, voice_1.VoiceConnectionStatus.Ready, this.connectionTimeout);
73
+ await (0, voice_1.entersState)(this.voiceConnection, voice_1.VoiceConnectionStatus.Ready, this.connectionTimeout);
76
74
  }
77
- catch (_b) {
75
+ catch {
78
76
  if (this.voiceConnection.state.status !== voice_1.VoiceConnectionStatus.Destroyed) {
79
77
  try {
80
78
  this.voiceConnection.destroy();
@@ -88,8 +86,7 @@ class StreamDispatcher extends tiny_typed_emitter_1.TypedEmitter {
88
86
  this.readyLock = false;
89
87
  }
90
88
  }
91
- }));
92
- // @ts-expect-error ???
89
+ });
93
90
  this.audioPlayer.on("stateChange", (oldState, newState) => {
94
91
  if (newState.status === voice_1.AudioPlayerStatus.Playing) {
95
92
  if (!this.paused)
@@ -109,17 +106,16 @@ class StreamDispatcher extends tiny_typed_emitter_1.TypedEmitter {
109
106
  /**
110
107
  * Creates stream
111
108
  * @param {Readable|Duplex|string} src The stream source
112
- * @param {object} [ops={}] Options
109
+ * @param {object} [ops] Options
113
110
  * @returns {AudioResource}
114
111
  */
115
112
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
116
113
  createStream(src, ops) {
117
- var _a;
118
114
  this.audioResource = (0, voice_1.createAudioResource)(src, {
119
- inputType: (_a = ops === null || ops === void 0 ? void 0 : ops.type) !== null && _a !== void 0 ? _a : voice_1.StreamType.Arbitrary,
120
- metadata: ops === null || ops === void 0 ? void 0 : ops.data,
115
+ inputType: ops?.type ?? voice_1.StreamType.Arbitrary,
116
+ metadata: ops?.data,
121
117
  // eslint-disable-next-line no-extra-boolean-cast
122
- inlineVolume: !Boolean(ops === null || ops === void 0 ? void 0 : ops.disableVolume)
118
+ inlineVolume: !Boolean(ops?.disableVolume)
123
119
  });
124
120
  return this.audioResource;
125
121
  }
@@ -139,7 +135,7 @@ class StreamDispatcher extends tiny_typed_emitter_1.TypedEmitter {
139
135
  this.audioPlayer.stop(true);
140
136
  this.voiceConnection.destroy();
141
137
  }
142
- catch (_a) { } // eslint-disable-line no-empty
138
+ catch { } // eslint-disable-line no-empty
143
139
  }
144
140
  /**
145
141
  * Stops the player
@@ -172,30 +168,28 @@ class StreamDispatcher extends tiny_typed_emitter_1.TypedEmitter {
172
168
  * @param {AudioResource<Track>} [resource=this.audioResource] The audio resource to play
173
169
  * @returns {Promise<StreamDispatcher>}
174
170
  */
175
- playStream(resource = this.audioResource) {
176
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
177
- if (!resource)
178
- throw new PlayerError_1.PlayerError("Audio resource is not available!", PlayerError_1.ErrorStatusCode.NO_AUDIO_RESOURCE);
179
- if (resource.ended)
180
- return void this.emit("error", new PlayerError_1.PlayerError("Cannot play a resource that has already ended."));
181
- if (!this.audioResource)
182
- this.audioResource = resource;
183
- if (this.voiceConnection.state.status !== voice_1.VoiceConnectionStatus.Ready) {
184
- try {
185
- yield (0, voice_1.entersState)(this.voiceConnection, voice_1.VoiceConnectionStatus.Ready, this.connectionTimeout);
186
- }
187
- catch (err) {
188
- return void this.emit("error", err);
189
- }
190
- }
171
+ async playStream(resource = this.audioResource) {
172
+ if (!resource)
173
+ throw new PlayerError_1.PlayerError("Audio resource is not available!", PlayerError_1.ErrorStatusCode.NO_AUDIO_RESOURCE);
174
+ if (resource.ended)
175
+ return void this.emit("error", new PlayerError_1.PlayerError("Cannot play a resource that has already ended."));
176
+ if (!this.audioResource)
177
+ this.audioResource = resource;
178
+ if (this.voiceConnection.state.status !== voice_1.VoiceConnectionStatus.Ready) {
191
179
  try {
192
- this.audioPlayer.play(resource);
180
+ await (0, voice_1.entersState)(this.voiceConnection, voice_1.VoiceConnectionStatus.Ready, this.connectionTimeout);
193
181
  }
194
- catch (e) {
195
- this.emit("error", e);
182
+ catch (err) {
183
+ return void this.emit("error", err);
196
184
  }
197
- return this;
198
- });
185
+ }
186
+ try {
187
+ this.audioPlayer.play(resource);
188
+ }
189
+ catch (e) {
190
+ this.emit("error", e);
191
+ }
192
+ return this;
199
193
  }
200
194
  /**
201
195
  * Sets playback volume
@@ -203,8 +197,7 @@ class StreamDispatcher extends tiny_typed_emitter_1.TypedEmitter {
203
197
  * @returns {boolean}
204
198
  */
205
199
  setVolume(value) {
206
- var _a;
207
- if (!((_a = this.audioResource) === null || _a === void 0 ? void 0 : _a.volume) || isNaN(value) || value < 0 || value > Infinity)
200
+ if (!this.audioResource?.volume || isNaN(value) || value < 0 || value > Infinity)
208
201
  return false;
209
202
  this.audioResource.volume.setVolumeLogarithmic(value / 100);
210
203
  return true;
@@ -214,8 +207,7 @@ class StreamDispatcher extends tiny_typed_emitter_1.TypedEmitter {
214
207
  * @type {number}
215
208
  */
216
209
  get volume() {
217
- var _a;
218
- if (!((_a = this.audioResource) === null || _a === void 0 ? void 0 : _a.volume))
210
+ if (!this.audioResource?.volume)
219
211
  return 100;
220
212
  const currentVol = this.audioResource.volume.volume;
221
213
  return Math.round(Math.pow(currentVol, 1 / 1.660964) * 100);
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VoiceUtils = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const discord_js_1 = require("discord.js");
6
5
  const voice_1 = require("@discordjs/voice");
7
6
  const StreamDispatcher_1 = require("./StreamDispatcher");
@@ -20,46 +19,29 @@ class VoiceUtils {
20
19
  /**
21
20
  * Joins a voice channel, creating basic stream dispatch manager
22
21
  * @param {StageChannel|VoiceChannel} channel The voice channel
23
- * @param {object} [options={}] Join options
22
+ * @param {object} [options] Join options
24
23
  * @returns {Promise<StreamDispatcher>}
25
24
  */
26
- connect(channel, options) {
27
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
- const conn = yield this.join(channel, options);
29
- const sub = new StreamDispatcher_1.StreamDispatcher(conn, channel, options.maxTime);
30
- this.cache.set(channel.guild.id, sub);
31
- return sub;
32
- });
25
+ async connect(channel, options) {
26
+ const conn = await this.join(channel, options);
27
+ const sub = new StreamDispatcher_1.StreamDispatcher(conn, channel, options.maxTime);
28
+ this.cache.set(channel.guild.id, sub);
29
+ return sub;
33
30
  }
34
31
  /**
35
32
  * Joins a voice channel
36
33
  * @param {StageChannel|VoiceChannel} [channel] The voice/stage channel to join
37
- * @param {object} [options={}] Join options
34
+ * @param {object} [options] Join options
38
35
  * @returns {VoiceConnection}
39
36
  */
40
- join(channel, options) {
41
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
42
- const conn = (0, voice_1.joinVoiceChannel)({
43
- guildId: channel.guild.id,
44
- channelId: channel.id,
45
- adapterCreator: channel.guild.voiceAdapterCreator,
46
- selfDeaf: Boolean(options.deaf)
47
- });
48
- return conn;
49
- });
50
- }
51
- enterReady(conn, options = {}) {
52
- var _a;
53
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
54
- try {
55
- conn = yield (0, voice_1.entersState)(conn, voice_1.VoiceConnectionStatus.Ready, (_a = options === null || options === void 0 ? void 0 : options.maxTime) !== null && _a !== void 0 ? _a : 20000);
56
- return conn;
57
- }
58
- catch (err) {
59
- conn.destroy();
60
- throw err;
61
- }
37
+ async join(channel, options) {
38
+ const conn = (0, voice_1.joinVoiceChannel)({
39
+ guildId: channel.guild.id,
40
+ channelId: channel.id,
41
+ adapterCreator: channel.guild.voiceAdapterCreator,
42
+ selfDeaf: Boolean(options.deaf)
62
43
  });
44
+ return conn;
63
45
  }
64
46
  /**
65
47
  * Disconnects voice connection
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { User, Snowflake, VoiceChannel, StageChannel, Collection, Client, GuildResolvable, Guild, GuildChannelResolvable, UserResolvable } from 'discord.js';
2
+ import { User, VoiceChannel, StageChannel, Collection, Snowflake, Client, GuildResolvable, Guild, GuildChannelResolvable, UserResolvable } from 'discord.js';
3
3
  import { Readable, Duplex } from 'stream';
4
4
  import { TypedEmitter } from 'tiny-typed-emitter';
5
5
  import { AudioPlayerError, AudioResource, VoiceConnection, AudioPlayer, StreamType, AudioPlayerStatus } from '@discordjs/voice';
@@ -47,7 +47,7 @@ declare class Track {
47
47
  requestedBy: User;
48
48
  playlist?: Playlist;
49
49
  readonly raw: RawTrackData;
50
- readonly id: Snowflake;
50
+ readonly id: string;
51
51
  /**
52
52
  * Track constructor
53
53
  * @param {Player} player The player that instantiated this Track
@@ -106,7 +106,7 @@ declare class StreamDispatcher extends TypedEmitter<VoiceEvents> {
106
106
  /**
107
107
  * Creates stream
108
108
  * @param {Readable|Duplex|string} src The stream source
109
- * @param {object} [ops={}] Options
109
+ * @param {object} [ops] Options
110
110
  * @returns {AudioResource}
111
111
  */
112
112
  createStream(src: Readable | Duplex | string, ops?: {
@@ -174,7 +174,7 @@ declare class VoiceUtils {
174
174
  /**
175
175
  * Joins a voice channel, creating basic stream dispatch manager
176
176
  * @param {StageChannel|VoiceChannel} channel The voice channel
177
- * @param {object} [options={}] Join options
177
+ * @param {object} [options] Join options
178
178
  * @returns {Promise<StreamDispatcher>}
179
179
  */
180
180
  connect(channel: VoiceChannel | StageChannel, options?: {
@@ -184,16 +184,13 @@ declare class VoiceUtils {
184
184
  /**
185
185
  * Joins a voice channel
186
186
  * @param {StageChannel|VoiceChannel} [channel] The voice/stage channel to join
187
- * @param {object} [options={}] Join options
187
+ * @param {object} [options] Join options
188
188
  * @returns {VoiceConnection}
189
189
  */
190
190
  join(channel: VoiceChannel | StageChannel, options?: {
191
191
  deaf?: boolean;
192
192
  maxTime?: number;
193
193
  }): Promise<VoiceConnection>;
194
- enterReady(conn: VoiceConnection, options?: {
195
- maxTime?: number;
196
- }): Promise<VoiceConnection>;
197
194
  /**
198
195
  * Disconnects voice connection
199
196
  * @param {VoiceConnection} connection The voice connection
@@ -246,7 +243,7 @@ declare class Player extends TypedEmitter<PlayerEvents> {
246
243
  /**
247
244
  * Creates new Discord Player
248
245
  * @param {Client} client The Discord Client
249
- * @param {PlayerInitOptions} [options={}] The player init options
246
+ * @param {PlayerInitOptions} [options] The player init options
250
247
  */
251
248
  constructor(client: Client, options?: PlayerInitOptions);
252
249
  /**
@@ -317,6 +314,11 @@ declare class Player extends TypedEmitter<PlayerEvents> {
317
314
  */
318
315
  resolveQueue<T>(queueLike: GuildResolvable | Queue): Queue<T>;
319
316
  [Symbol.iterator](): Generator<Queue<unknown>, void, undefined>;
317
+ /**
318
+ * Creates `Playlist` instance
319
+ * @param data The data to initialize a playlist
320
+ */
321
+ createPlaylist(data: PlaylistInitData): Playlist;
320
322
  }
321
323
 
322
324
  declare class Queue<T = unknown> {
@@ -330,7 +332,7 @@ declare class Queue<T = unknown> {
330
332
  playing: boolean;
331
333
  metadata?: T;
332
334
  repeatMode: QueueRepeatMode;
333
- readonly id: Snowflake;
335
+ readonly id: string;
334
336
  private _streamTime;
335
337
  _cooldownsTimeout: Collection<string, NodeJS.Timeout>;
336
338
  private _activeFilters;
@@ -340,7 +342,7 @@ declare class Queue<T = unknown> {
340
342
  * Queue constructor
341
343
  * @param {Player} player The player that instantiated this queue
342
344
  * @param {Guild} guild The guild that instantiated this queue
343
- * @param {PlayerOptions} [options={}] Player options for the queue
345
+ * @param {PlayerOptions} [options] Player options for the queue
344
346
  */
345
347
  constructor(player: Player, guild: Guild, options?: PlayerOptions);
346
348
  /**
@@ -465,16 +467,16 @@ declare class Queue<T = unknown> {
465
467
  shuffle(): boolean;
466
468
  /**
467
469
  * Removes a track from the queue
468
- * @param {Track|Snowflake|number} track The track to remove
470
+ * @param {Track|string|number} track The track to remove
469
471
  * @returns {Track}
470
472
  */
471
- remove(track: Track | Snowflake | number): Track;
473
+ remove(track: Track | string | number): Track;
472
474
  /**
473
475
  * Returns the index of the specified track. If found, returns the track index else returns -1.
474
- * @param {number|Track|Snowflake} track The track
476
+ * @param {number|Track|string} track The track
475
477
  * @returns {number}
476
478
  */
477
- getTrackPosition(track: number | Track | Snowflake): number;
479
+ getTrackPosition(track: number | Track | string): number;
478
480
  /**
479
481
  * Jumps to particular track
480
482
  * @param {Track|number} track The track
@@ -522,7 +524,7 @@ declare class Queue<T = unknown> {
522
524
  /**
523
525
  * Play stream in a voice/stage channel
524
526
  * @param {Track} [src] The track to play (if empty, uses first track from the queue)
525
- * @param {PlayOptions} [options={}] The options
527
+ * @param {PlayOptions} [options] The options
526
528
  * @returns {Promise<void>}
527
529
  */
528
530
  play(src?: Track, options?: PlayOptions): Promise<void>;
@@ -661,6 +663,7 @@ interface PlayerProgressbarOptions {
661
663
  length?: number;
662
664
  line?: string;
663
665
  indicator?: string;
666
+ queue?: boolean;
664
667
  }
665
668
  /**
666
669
  * @typedef {object} PlayerOptions
@@ -669,12 +672,12 @@ interface PlayerProgressbarOptions {
669
672
  * @property {boolean} [leaveOnEmpty=true] If it should leave on empty
670
673
  * @property {number} [leaveOnEmptyCooldown=1000] The cooldown in ms
671
674
  * @property {boolean} [autoSelfDeaf=true] If it should set the bot in deaf mode
672
- * @property {YTDLDownloadOptions} [ytdlOptions={}] The youtube download options
675
+ * @property {YTDLDownloadOptions} [ytdlOptions] The youtube download options
673
676
  * @property {number} [initialVolume=100] The initial player volume
674
677
  * @property {number} [bufferingTimeout=3000] Buffering timeout for the stream
675
678
  * @property {boolean} [spotifyBridge=true] If player should bridge spotify source to youtube
676
679
  * @property {boolean} [disableVolume=false] If player should disable inline volume
677
- * @property {boolean} [volumeSmoothness=0] The volume transition smoothness between volume changes (lower the value to get better result)
680
+ * @property {number} [volumeSmoothness=0] The volume transition smoothness between volume changes (lower the value to get better result)
678
681
  * Setting this or leaving this empty will disable this effect. Example: `volumeSmoothness: 0.1`
679
682
  * @property {Function} [onBeforeCreateStream] Runs before creating stream
680
683
  */
@@ -990,7 +993,7 @@ interface PlaylistJSON {
990
993
  /**
991
994
  * @typedef {object} PlayerInitOptions
992
995
  * @property {boolean} [autoRegisterExtractor=true] If it should automatically register `@discord-player/extractor`
993
- * @property {YTDLDownloadOptions} [ytdlOptions={}] The options passed to `ytdl-core`
996
+ * @property {YTDLDownloadOptions} [ytdlOptions] The options passed to `ytdl-core`
994
997
  * @property {number} [connectionTimeout=20000] The voice connection timeout
995
998
  */
996
999
  interface PlayerInitOptions {
@@ -1048,8 +1051,8 @@ declare const FilterList: {
1048
1051
  vibrato: string;
1049
1052
  reverse: string;
1050
1053
  treble: string;
1051
- normalizer: string;
1052
1054
  normalizer2: string;
1055
+ normalizer: string;
1053
1056
  surrounding: string;
1054
1057
  pulsator: string;
1055
1058
  subboost: string;
@@ -1184,6 +1187,7 @@ declare class Util {
1184
1187
  */
1185
1188
  static wait(time: number): Promise<unknown>;
1186
1189
  static noop(): void;
1190
+ static getFetch(): Promise<any>;
1187
1191
  }
1188
1192
 
1189
1193
  declare const version: string;
@@ -8,6 +8,6 @@ try {
8
8
  Reflect.set(mod, "VolumeTransformer", VolumeTransformer_1.VolumeTransformer);
9
9
  }
10
10
  }
11
- catch (_a) {
11
+ catch {
12
12
  /* do nothing */
13
13
  }
@@ -51,8 +51,8 @@ const FilterList = {
51
51
  vibrato: "vibrato=f=6.5",
52
52
  reverse: "areverse",
53
53
  treble: "treble=g=5",
54
- normalizer: "dynaudnorm=g=101",
55
- normalizer2: "acompressor",
54
+ normalizer2: "dynaudnorm=g=101",
55
+ normalizer: "acompressor",
56
56
  surrounding: "surround",
57
57
  pulsator: "apulsator=hz=1",
58
58
  subboost: "asubboost",
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.Util = void 0;
4
27
  class Util {
@@ -73,7 +96,7 @@ class Util {
73
96
  try {
74
97
  return require(id);
75
98
  }
76
- catch (_a) {
99
+ catch {
77
100
  return null;
78
101
  }
79
102
  }
@@ -86,5 +109,17 @@ class Util {
86
109
  return new Promise((r) => setTimeout(r, time).unref());
87
110
  }
88
111
  static noop() { } // eslint-disable-line @typescript-eslint/no-empty-function
112
+ static async getFetch() {
113
+ if ("fetch" in globalThis)
114
+ return globalThis.fetch;
115
+ for (const lib of ["undici", "node-fetch"]) {
116
+ try {
117
+ return await Promise.resolve().then(() => __importStar(require(lib))).then((res) => res.fetch || res.default?.fetch || res.default);
118
+ }
119
+ catch {
120
+ // uh?
121
+ }
122
+ }
123
+ }
89
124
  }
90
125
  exports.Util = Util;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discord-player",
3
- "version": "5.2.3-dev",
3
+ "version": "5.3.0-dev.2",
4
4
  "description": "Complete framework to facilitate music commands using discord.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,9 +23,9 @@
23
23
  "build:check": "tsc --noEmit --incremental false",
24
24
  "prepublishOnly": "rollup-type-bundler -e stream",
25
25
  "build:esm": "gen-esm-wrapper ./dist/index.js ./dist/index.mjs",
26
- "format": "prettier --write \"src/**/*.ts\" \"example/**/*.ts\"",
27
- "docs": "docgen --jsdoc jsdoc.json --source src/*.ts src/**/*.ts --custom docs/index.yml --output docs/docs.json",
28
- "docs:test": "docgen --jsdoc jsdoc.json --source src/*.ts src/**/*.ts --custom docs/index.yml",
26
+ "format": "prettier --write \"src/**/*.ts\"",
27
+ "docs": "typedoc --json docs/typedoc.json src/index.ts",
28
+ "postdocs": "node scripts/docgen.js",
29
29
  "lint": "eslint src --ext .ts",
30
30
  "prepare": "husky install",
31
31
  "lint:fix": "eslint src --ext .ts --fix"
@@ -65,37 +65,33 @@
65
65
  },
66
66
  "homepage": "https://discord-player.js.org",
67
67
  "dependencies": {
68
- "@discordjs/voice": "^0.8.0",
68
+ "@discordjs/voice": "^0.11.0",
69
69
  "discord-ytdl-core": "^5.0.4",
70
70
  "libsodium-wrappers": "^0.7.10",
71
- "soundcloud-scraper": "^5.0.2",
72
- "spotify-url-info": "^3.0.0",
71
+ "soundcloud-scraper": "^5.0.3",
72
+ "spotify-url-info": "^3.1.2",
73
73
  "tiny-typed-emitter": "^2.1.0",
74
- "youtube-sr": "^4.1.15",
74
+ "tslib": "^2.4.0",
75
+ "youtube-sr": "^4.2.0",
75
76
  "ytdl-core": "^4.11.0"
76
77
  },
77
78
  "devDependencies": {
78
- "@babel/cli": "^7.16.0",
79
- "@babel/core": "^7.16.0",
80
- "@babel/preset-env": "^7.16.4",
81
- "@babel/preset-typescript": "^7.16.0",
82
- "@devsnowflake/docgen": "devsnowflake/docgen#ts-patch",
83
- "@discord-player/extractor": "^3.0.2",
84
- "@discordjs/opus": "github:discordjs/opus",
85
- "@favware/rollup-type-bundler": "^1.0.6",
86
- "@types/node": "^16.11.10",
87
- "@types/ws": "^8.2.0",
88
- "@typescript-eslint/eslint-plugin": "^5.4.0",
89
- "@typescript-eslint/parser": "^5.4.0",
90
- "discord-api-types": "^0.24.0",
91
- "discord.js": "^13.6.0",
92
- "eslint": "^8.3.0",
79
+ "@discordjs/ts-docgen": "^0.4.1",
80
+ "@favware/rollup-type-bundler": "^1.0.9",
81
+ "@types/node": "^18.0.6",
82
+ "@types/ws": "^8.5.3",
83
+ "@typescript-eslint/eslint-plugin": "^5.30.7",
84
+ "@typescript-eslint/parser": "^5.30.7",
85
+ "discord-api-types": "^0.36.2",
86
+ "discord.js": "^14.0.2",
87
+ "eslint": "^8.20.0",
93
88
  "gen-esm-wrapper": "^1.1.3",
94
- "husky": "^7.0.4",
95
- "jsdoc-babel": "^0.5.0",
96
- "prettier": "^2.5.0",
89
+ "husky": "^8.0.1",
90
+ "opusscript": "^0.0.8",
91
+ "prettier": "^2.7.1",
97
92
  "rimraf": "^3.0.2",
98
- "ts-node": "^10.4.0",
99
- "typescript": "^4.5.2"
93
+ "ts-node": "^10.9.1",
94
+ "typedoc": "^0.23.8",
95
+ "typescript": "^4.7.4"
100
96
  }
101
97
  }