magmastream 2.9.1-dev.4 → 2.9.1-dev.6

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/index.d.ts CHANGED
@@ -106,17 +106,27 @@ declare enum PlayerStateEventTypes {
106
106
  * Track Source Types Enum
107
107
  */
108
108
  declare enum TrackSourceTypes {
109
- AppleMusic = "applemusic",
110
- Audius = "audius",
111
- Bandcamp = "bandcamp",
112
- Deezer = "deezer",
113
- Jiosaavn = "jiosaavn",
114
- Qobuz = "qobuz",
115
- SoundCloud = "soundcloud",
116
- Spotify = "spotify",
117
- Tidal = "tidal",
118
- VKMusic = "vkmusic",
119
- YouTube = "youtube"
109
+ AppleMusic = "AppleMusic",
110
+ Audius = "Audius",
111
+ Bandcamp = "Bandcamp",
112
+ Deezer = "Deezer",
113
+ Jiosaavn = "Jiosaavn",
114
+ Qobuz = "Qobuz",
115
+ SoundCloud = "SoundCloud",
116
+ Spotify = "Spotify",
117
+ Tidal = "Tidal",
118
+ VKMusic = "VKMusic",
119
+ YouTube = "YouTube",
120
+ Pornhub = "Pornub",
121
+ TikTok = "TikTok",
122
+ Flowertts = "Flowertts",
123
+ Ocremix = "Ocremix",
124
+ Mixcloud = "Mixcloud",
125
+ Soundgasm = "Soundgasm",
126
+ Reddit = "Reddit",
127
+ Clypit = "Clypit",
128
+ Http = "Http",
129
+ Tts = "Tts"
120
130
  }
121
131
  /**
122
132
  * Use Node Options Enum
@@ -1766,6 +1776,8 @@ interface PlayerOptions {
1766
1776
  selfMute?: boolean;
1767
1777
  /** If the player should deaf itself. */
1768
1778
  selfDeafen?: boolean;
1779
+ /** Whether to apply the volume as a filter. */
1780
+ applyVolumeAsFilter?: boolean;
1769
1781
  }
1770
1782
  /**
1771
1783
  * PlayOptions interface
@@ -97,17 +97,27 @@ var PlayerStateEventTypes;
97
97
  */
98
98
  var TrackSourceTypes;
99
99
  (function (TrackSourceTypes) {
100
- TrackSourceTypes["AppleMusic"] = "applemusic";
101
- TrackSourceTypes["Audius"] = "audius";
102
- TrackSourceTypes["Bandcamp"] = "bandcamp";
103
- TrackSourceTypes["Deezer"] = "deezer";
104
- TrackSourceTypes["Jiosaavn"] = "jiosaavn";
105
- TrackSourceTypes["Qobuz"] = "qobuz";
106
- TrackSourceTypes["SoundCloud"] = "soundcloud";
107
- TrackSourceTypes["Spotify"] = "spotify";
108
- TrackSourceTypes["Tidal"] = "tidal";
109
- TrackSourceTypes["VKMusic"] = "vkmusic";
110
- TrackSourceTypes["YouTube"] = "youtube";
100
+ TrackSourceTypes["AppleMusic"] = "AppleMusic";
101
+ TrackSourceTypes["Audius"] = "Audius";
102
+ TrackSourceTypes["Bandcamp"] = "Bandcamp";
103
+ TrackSourceTypes["Deezer"] = "Deezer";
104
+ TrackSourceTypes["Jiosaavn"] = "Jiosaavn";
105
+ TrackSourceTypes["Qobuz"] = "Qobuz";
106
+ TrackSourceTypes["SoundCloud"] = "SoundCloud";
107
+ TrackSourceTypes["Spotify"] = "Spotify";
108
+ TrackSourceTypes["Tidal"] = "Tidal";
109
+ TrackSourceTypes["VKMusic"] = "VKMusic";
110
+ TrackSourceTypes["YouTube"] = "YouTube";
111
+ TrackSourceTypes["Pornhub"] = "Pornub";
112
+ TrackSourceTypes["TikTok"] = "TikTok";
113
+ TrackSourceTypes["Flowertts"] = "Flowertts";
114
+ TrackSourceTypes["Ocremix"] = "Ocremix";
115
+ TrackSourceTypes["Mixcloud"] = "Mixcloud";
116
+ TrackSourceTypes["Soundgasm"] = "Soundgasm";
117
+ TrackSourceTypes["Reddit"] = "Reddit";
118
+ TrackSourceTypes["Clypit"] = "Clypit";
119
+ TrackSourceTypes["Http"] = "Http";
120
+ TrackSourceTypes["Tts"] = "Tts";
111
121
  })(TrackSourceTypes || (exports.TrackSourceTypes = TrackSourceTypes = {}));
112
122
  /**
113
123
  * Use Node Options Enum
@@ -80,6 +80,13 @@ class Player {
80
80
  this.clusterId = this.manager.options.clusterId || 0;
81
81
  // Check the player options for errors.
82
82
  (0, playerCheck_1.default)(options);
83
+ this.options = {
84
+ ...options,
85
+ applyVolumeAsFilter: options.applyVolumeAsFilter ?? false,
86
+ selfMute: options.selfMute ?? false,
87
+ selfDeafen: options.selfDeafen ?? false,
88
+ volume: options.volume ?? 100,
89
+ };
83
90
  // Set the guild ID and voice state.
84
91
  this.guildId = options.guildId;
85
92
  this.voiceState = Object.assign({
@@ -112,7 +119,7 @@ class Player {
112
119
  // Add the player to the manager's player collection.
113
120
  this.manager.players.set(options.guildId, this);
114
121
  // Set the initial volume.
115
- this.setVolume(options.volume ?? 100);
122
+ this.setVolume(options.volume);
116
123
  // Initialize the filters.
117
124
  this.filters = new Filters_1.Filters(this, this.manager);
118
125
  // Emit the playerCreate event.
@@ -416,9 +423,10 @@ class Player {
416
423
  throw new RangeError("Volume must be between 0 and 1000.");
417
424
  const oldVolume = this.volume;
418
425
  const oldPlayer = { ...this };
426
+ const data = this.options.applyVolumeAsFilter ? { filters: { volume } } : { volume };
419
427
  await this.node.rest.updatePlayer({
420
428
  guildId: this.options.guildId,
421
- data: { volume },
429
+ data,
422
430
  });
423
431
  this.volume = volume;
424
432
  this.manager.emit(Enums_1.ManagerEventTypes.PlayerStateUpdate, oldPlayer, this, {
@@ -853,6 +861,7 @@ class Player {
853
861
  filters: this.filters,
854
862
  nowPlayingMessage: this.nowPlayingMessage,
855
863
  isAutoplay: this.isAutoplay,
864
+ applyVolumeAsFilter: this.options.applyVolumeAsFilter,
856
865
  };
857
866
  // If force is true, destroy the existing player for the new guild
858
867
  if (force && newPlayer) {
@@ -862,6 +871,7 @@ class Player {
862
871
  newOptions.selfDeafen = newOptions.selfDeafen ?? oldPlayerProperties.selfDeafen;
863
872
  newOptions.selfMute = newOptions.selfMute ?? oldPlayerProperties.selfMute;
864
873
  newOptions.volume = newOptions.volume ?? oldPlayerProperties.volume;
874
+ newOptions.applyVolumeAsFilter = newOptions.applyVolumeAsFilter ?? oldPlayerProperties.applyVolumeAsFilter;
865
875
  // Deep clone the current player
866
876
  const clonedPlayer = this.manager.create(newOptions);
867
877
  // Connect the cloned player to the new voice channel
@@ -98,6 +98,16 @@ class TrackUtils {
98
98
  youtube: "YouTube",
99
99
  vkmusic: "VKMusic",
100
100
  qobuz: "Qobuz",
101
+ http: "Http",
102
+ tts: "Tts",
103
+ clypit: "Clypit",
104
+ pornhub: "Pornhub",
105
+ soundgasm: "Soundgasm",
106
+ reddit: "Reddit",
107
+ flowertts: "Flowertts",
108
+ ocremix: "Ocremix",
109
+ mixcloud: "Mixcloud",
110
+ tiktok: "TikTok",
101
111
  };
102
112
  const track = {
103
113
  track: data.encoded,
@@ -11,8 +11,8 @@ function playerCheck(options) {
11
11
  if (!options) {
12
12
  throw new TypeError("PlayerOptions must not be empty.");
13
13
  }
14
- // Get the guild ID, node, selfDeafen, selfMute, textChannelId, voiceChannelId, and volume from the options.
15
- const { guildId, nodeIdentifier, selfDeafen, selfMute, textChannelId, voiceChannelId, volume } = options;
14
+ // Get the guild ID, node, selfDeafen, selfMute, textChannelId, voiceChannelId, volume, and applyVolumeAsFilter from the options.
15
+ const { guildId, nodeIdentifier, selfDeafen, selfMute, textChannelId, voiceChannelId, volume, applyVolumeAsFilter } = options;
16
16
  // Validate the guild ID option
17
17
  // The guild ID option must be a non-empty string.
18
18
  if (!/^\d+$/.test(guildId)) {
@@ -48,4 +48,9 @@ function playerCheck(options) {
48
48
  if (typeof volume !== "undefined" && typeof volume !== "number") {
49
49
  throw new TypeError('Player option "volume" must be a number.');
50
50
  }
51
+ // Validate the applyVolumeAsFilter option
52
+ // The applyVolumeAsFilter option must be a boolean.
53
+ if (typeof applyVolumeAsFilter !== "undefined" && typeof applyVolumeAsFilter !== "boolean") {
54
+ throw new TypeError('Player option "applyVolumeAsFilter" must be a boolean.');
55
+ }
51
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magmastream",
3
- "version": "2.9.1-dev.4",
3
+ "version": "2.9.1-dev.6",
4
4
  "description": "A user-friendly Lavalink client designed for NodeJS.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",