hoshimi
    Preparing search index...

    Class Player

    Class representing a Hoshimi player. Player

    Index

    Constructors

    • Create a new player.

      Parameters

      Returns Player

      const player = Structures.Player(manager, {
      guildId: "guildId",
      voiceId: "voiceId",
      textId: "textId",
      selfDeaf: true,
      selfMute: false,
      volume: 100,
      });

      console.log(player.guildId); // guildId
      console.log(player.voiceId); // voiceId
      console.log(player.textId);

    Properties

    connected: boolean = false

    Check if the player is connected.

    false
    
    createdTimestamp: number = 0

    The timestamp when the player was created.

    The data for the player.

    filterManager: FilterManager

    The filter manager for the player.

    guildId: string

    Guild id of the player.

    lastPosition: number = 0

    The last position received from Lavalink.

    lastPositionUpdate: number | null = null

    The timestamp when the last position change update happened.

    loop: LoopMode = LoopMode.Off

    Loop mode of the player.

    LoopMode.Off
    
    lyrics: LyricsMethods = ...

    The lyrics methods for the player.

    manager: Hoshimi

    The manager for the player.

    node: Node

    The node for the player.

    options: PlayerOptions

    The options for the player.

    paused: boolean = false

    Check if the player is paused.

    false
    
    ping: number = 0

    The ping of the player.

    playing: boolean = false

    Check if the player is playing.

    false
    
    queue: Queue

    The queue for the player.

    selfDeaf: boolean = false

    Check if the player is self deafened.

    selfMute: boolean = false

    Check if the player is self muted.

    textId: string | undefined = undefined

    Text channel id of the player.

    The voice connection details.

    voiceId: string | undefined = undefined

    Voice channel id of the player.

    volume: number = 100

    Volume of the player.

    100
    

    Accessors

    Methods

    • Destroy and disconnect the player.

      Parameters

      • Optionalreason: DestroyReasons = DestroyReasons.Stop

        The reason for destroying the player.

      Returns Promise<boolean>

      const player = manager.getPlayer("guildId");
      player.destroy(DestroyReasons.Stop);
    • Change the node the player is connected to.

      Parameters

      Returns Promise<void>

      A promise that resolves when the node has been changed.

      If the target node is not found, not connected, or missing source managers.

      const player = manager.getPlayer("guildId");
      player.move("newNodeId");
    • Play a track in the player.

      Parameters

      • Optionaloptions: Partial<PlayOptions> = {}

        The options to play the track.

      Returns Promise<void>

      If there are no tracks to play.

      const player = manager.getPlayer("guildId");

      player.play({
      track: track,
      noReplace: true,
      });
    • Search for a track or playlist.

      Parameters

      Returns Promise<QueryResult>

      The search result.

      const player = manager.getPlayer("guildId");
      const result = await player.search({
      query: "track name",
      source: SearchSource.Youtube,
      requester: {},
      });

      console.log(result) // the search result
    • Seek to a specific position in the current track.

      Parameters

      • position: number

        The position to seek to in milliseconds.

      Returns Promise<void>

      If the position is invalid.

      const player = manager.getPlayer("guildId");
      player.seek(30000); // seek to 30 seconds
    • Set the loop mode of the player.

      Parameters

      Returns this

      If the loop mode is invalid.

      const player = manager.getPlayer("guildId");
      player.setLoop(LoopMode.Track);
    • Pause or resume the player.

      Parameters

      • paused: boolean = ...

      Returns Promise<boolean>

      const player = manager.getPlayer("guildId");
      player.setPaused();
    • Set the volume of the player.

      Parameters

      • volume: number

        The volume to set.

      Returns Promise<void>

      const player = manager.getPlayer("guildId");
      player.setVolume(50); // set the volume to 50%
    • Play the next track in the queue.

      Parameters

      Returns Promise<void>

      If there are no tracks to skip.

      const player = manager.getPlayer("guildId");
      player.skip(2); // skip 2 tracks
      player.skip(); // skip 1 track
    • Stop the player from playing.

      Parameters

      • Optionaldestroy: boolean = true

        Whether to destroy the player or not.

      Returns Promise<void>

      const player = manager.getPlayer("guildId");
      player.stop();
    • Update the player with new data.

      Parameters

      • data: NonGuildUpdatePlayerInfo

        The data to update the player with.

      Returns Promise<LavalinkPlayer | null>

      The updated player data.

      const player = manager.getPlayer("guildId");
      const updatedPlayer = await player.updatePlayer({ volume: 50 });
      console.log(updatedPlayer); // the updated player data