hoshimi
    Preparing search index...

    Class Rest

    Class representing the REST for the node. Rest

    Index

    Constructors

    • Create a new REST.

      Parameters

      • node: Node

        The node for the REST.

      Returns Rest

      const node = new Node({
      host: "localhost",
      port: 2333,
      password: "youshallnotpass",
      secure: false,
      });

      const rest = new Rest(node);
      console.log(rest.restUrl); // http://localhost:2333/v4

    Properties

    node: Node

    The node for the REST.

    restTimeout: number

    The timeout for the REST.

    url: string

    The URL for the REST.

    userAgent: UserAgent

    The user agent for the REST.

    version: string = "v4"

    The version for the REST.

    Accessors

    Methods

    • Destroy the player for the guild.

      Parameters

      • guildId: string

        The guild id to destroy the player.

      Returns Promise<void>

      The updated player data.

      await node.rest.destroyPlayer("guildId");
      
      
      
    • Get all players for the current session.

      Returns Promise<LavalinkPlayer[]>

      The players for the current session.

      const players = await node.rest.getPlayers();
      console.log(players); // The lavalink players for the current session
    • Stop the track in player for the guild.

      Parameters

      • guildId: string

        The guild id to stop the player.

      Returns Promise<LavalinkPlayer | null>

      The updated player data.

      const player = await node.rest.stopPlayer("guildId");
      if (player) console.log(player); // The lavalink player
    • Update the player data.

      Parameters

      Returns Promise<LavalinkPlayer | null>

      The updated player data.

      const player = await node.rest.updatePlayer({
      guildId: "guildId",
      noReplace: true,
      playerOptions: {
      paused: false,
      track: { encoded: "encoded track" },
      },
      });

      console.log(player); // The updated lavalink player data