magmastream 2.10.1-dev.0 → 2.10.1-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.
@@ -4,7 +4,7 @@ import { EventEmitter } from "events";
4
4
  import { Node } from "./Node";
5
5
  import { Player } from "./Player";
6
6
  import { Redis as RedisClient } from "ioredis";
7
- import { AnyGuild, AnyUser, ManagerEvents, ManagerInitOptions, ManagerOptions, NodeOptions, PlayerOptions, SearchQuery, SearchResult, TrackData, VoicePacket, VoiceServer, VoiceState } from "./Types";
7
+ import { AnyGuild, AnyUser, DiscordVoiceState, ManagerEvents, ManagerInitOptions, ManagerOptions, NodeOptions, PlayerOptions, SearchQuery, SearchResult, TrackData, VoicePacket, VoiceServer } from "./Types";
8
8
  /**
9
9
  * The main hub for interacting with Lavalink and using Magmastream.
10
10
  */
@@ -95,7 +95,7 @@ export declare class Manager extends EventEmitter {
95
95
  * @returns A promise that resolves when the voice state update is handled.
96
96
  * @emits {debug} - Emits a debug message indicating the voice state is being updated.
97
97
  */
98
- updateVoiceState(data: VoicePacket | VoiceServer | VoiceState): Promise<void>;
98
+ updateVoiceState(data: VoicePacket | VoiceServer | DiscordVoiceState): Promise<void>;
99
99
  /**
100
100
  * Decodes an array of base64 encoded tracks and returns an array of TrackData.
101
101
  * Emits a debug event with the tracks being decoded.
@@ -544,7 +544,8 @@ class Manager extends events_1.EventEmitter {
544
544
  await player.play(Utils_1.TrackUtils.build(lavaPlayer.track, currentTrack.requester, currentTrack.isAutoplay), { startTime: lavaPlayer.state.position ?? 0 });
545
545
  await node.rest.delete(`/v4/sessions/${state.node.sessionId}/players/${state.guildId}`);
546
546
  }
547
- await player.pause(state.paused);
547
+ if (state.paused)
548
+ await player.pause(true);
548
549
  await cleanup();
549
550
  this.emit(Enums_1.ManagerEventTypes.PlayerRestored, player, node);
550
551
  await this.sleep(1000);
@@ -1,7 +1,7 @@
1
1
  import { Filters } from "./Filters";
2
2
  import { Manager } from "./Manager";
3
3
  import { Node } from "./Node";
4
- import { AnyMessage, IQueue, Lyrics, PlayerOptions, PlayOptions, SearchQuery, SearchResult, Track, VoiceState } from "./Types";
4
+ import { AnyMessage, IQueue, Lyrics, PlayerOptions, PlayerVoiceState, PlayOptions, SearchQuery, SearchResult, Track } from "./Types";
5
5
  import { SponsorBlockSegment, StateTypes } from "./Enums";
6
6
  import { WebSocket } from "ws";
7
7
  export declare class Player {
@@ -38,8 +38,8 @@ export declare class Player {
38
38
  state: StateTypes;
39
39
  /** The equalizer bands array. */
40
40
  bands: number[];
41
- /** The voice state object from Discord. */
42
- voiceState: VoiceState;
41
+ /** The voice state object from the node. */
42
+ voiceState: PlayerVoiceState;
43
43
  /** The Manager. */
44
44
  manager: Manager;
45
45
  /** The autoplay state of the player. */
@@ -46,7 +46,7 @@ class Player {
46
46
  state = Enums_1.StateTypes.Disconnected;
47
47
  /** The equalizer bands array. */
48
48
  bands = new Array(15).fill(0.0);
49
- /** The voice state object from Discord. */
49
+ /** The voice state object from the node. */
50
50
  voiceState;
51
51
  /** The Manager. */
52
52
  manager;
@@ -95,10 +95,7 @@ class Player {
95
95
  };
96
96
  // Set the guild ID and voice state.
97
97
  this.guildId = options.guildId;
98
- this.voiceState = Object.assign({
99
- op: "voiceUpdate",
100
- guild_id: options.guildId,
101
- });
98
+ this.voiceState = {};
102
99
  // Set the voice and text channels if they exist.
103
100
  if (options.voiceChannelId)
104
101
  this.voiceChannelId = options.voiceChannelId;
@@ -736,7 +733,9 @@ class Player {
736
733
  this.node.rest.updatePlayer({
737
734
  guildId: this.guildId,
738
735
  data: {
739
- track: null,
736
+ track: {
737
+ encoded: null,
738
+ },
740
739
  },
741
740
  });
742
741
  this.manager.emit(Enums_1.ManagerEventTypes.PlayerStateUpdate, oldPlayer, this, {
@@ -645,7 +645,7 @@ export interface ManagerEvents {
645
645
  */
646
646
  export interface VoicePacket {
647
647
  t?: "VOICE_SERVER_UPDATE" | "VOICE_STATE_UPDATE";
648
- d: VoiceState | VoiceServer;
648
+ d: DiscordVoiceState | VoiceServer;
649
649
  }
650
650
  /**
651
651
  * Voice Server
@@ -663,7 +663,7 @@ export interface Extendable {
663
663
  /**
664
664
  * Voice State
665
665
  */
666
- export interface VoiceState {
666
+ export interface PlayerVoiceState {
667
667
  op: "voiceUpdate";
668
668
  guildId: string;
669
669
  event: VoiceServer;
@@ -673,12 +673,14 @@ export interface VoiceState {
673
673
  /**
674
674
  * Voice State
675
675
  */
676
- export interface VoiceState {
676
+ export interface DiscordVoiceState {
677
677
  guild_id: string;
678
678
  user_id: string;
679
679
  session_id: string;
680
680
  channel_id: string;
681
681
  }
682
+ /** @deprecated Use DiscordVoiceState or PlayerVoiceState instead */
683
+ export type VoiceState = DiscordVoiceState | PlayerVoiceState;
682
684
  /**
683
685
  * NodeStats interface
684
686
  */
@@ -1115,7 +1117,7 @@ export interface SerializedPlayerState {
1115
1117
  queueRepeat: boolean;
1116
1118
  dynamicRepeat: boolean;
1117
1119
  dynamicLoopInterval?: number;
1118
- voiceState: VoiceState;
1120
+ voiceState: PlayerVoiceState;
1119
1121
  options: PlayerOptions;
1120
1122
  node: {
1121
1123
  sessionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magmastream",
3
- "version": "2.10.1-dev.0",
3
+ "version": "2.10.1-dev.2",
4
4
  "description": "A user-friendly Lavalink client designed for NodeJS.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",