harmonylink
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -14,2 +14,3 @@ /// <reference types="node" /> | ||
import { Player } from "./player"; | ||
import { TrackData } from "./typings/track"; | ||
export declare interface HarmonyLink { | ||
@@ -64,2 +65,8 @@ on: <K extends keyof HarmonyLinkEvents>(event: K, listener: HarmonyLinkEvents[K]) => this; | ||
removeNode(nodeName: string): Promise<Node | null>; | ||
/** | ||
* Decodes a or multiple encoded tracks. | ||
* @param {string | string[]} tracks - The track to decode. | ||
* @returns {Promise<TrackData[]>} - A Promise that resolves to the decoded track. | ||
*/ | ||
decodeTracks(tracks: string[] | string, node?: Node): Promise<TrackData[] | null>; | ||
} |
@@ -111,4 +111,21 @@ "use strict"; | ||
; | ||
/** | ||
* Decodes a or multiple encoded tracks. | ||
* @param {string | string[]} tracks - The track to decode. | ||
* @returns {Promise<TrackData[]>} - A Promise that resolves to the decoded track. | ||
*/ | ||
async decodeTracks(tracks, node) { | ||
if (!Array.isArray(tracks)) | ||
tracks = [tracks]; | ||
node ??= await this.nodeManager.getLeastUsedNode(); | ||
if (!node) { | ||
this.emit("debug", "[HarmonyLink] [PlayerManager] No nodes available to decode tracks."); | ||
return null; | ||
} | ||
; | ||
return node.rest.decodeTracks(tracks); | ||
} | ||
; | ||
} | ||
exports.HarmonyLink = HarmonyLink; | ||
//# sourceMappingURL=HarmonyLink.js.map |
@@ -11,2 +11,3 @@ /// <reference types="node" /> | ||
import { Filters } from "./Filters"; | ||
import { TrackData } from "../typings/track"; | ||
export declare interface Player { | ||
@@ -56,2 +57,8 @@ on: <K extends keyof PlayerEvents>(event: K, listener: PlayerEvents[K]) => this; | ||
/** | ||
* Decodes a or multiple encoded tracks. | ||
* @param {string | string[]} tracks - The track to decode. | ||
* @returns {Promise<TrackData[]>} - A Promise that resolves to the decoded track. | ||
*/ | ||
decodeTracks(tracks: string[] | string): Promise<TrackData[]>; | ||
/** | ||
* Sets the loop mode for the player. | ||
@@ -58,0 +65,0 @@ * @param {PlayerLoop | "NONE" | "QUEUE" | "TRACK"} mode - The loop mode to set. |
@@ -159,2 +159,13 @@ "use strict"; | ||
/** | ||
* Decodes a or multiple encoded tracks. | ||
* @param {string | string[]} tracks - The track to decode. | ||
* @returns {Promise<TrackData[]>} - A Promise that resolves to the decoded track. | ||
*/ | ||
async decodeTracks(tracks) { | ||
if (!Array.isArray(tracks)) | ||
tracks = [tracks]; | ||
return this.node.rest.decodeTracks(tracks); | ||
} | ||
; | ||
/** | ||
* Sets the loop mode for the player. | ||
@@ -161,0 +172,0 @@ * @param {PlayerLoop | "NONE" | "QUEUE" | "TRACK"} mode - The loop mode to set. |
{ | ||
"name": "harmonylink", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "HarmonyLink: Seamlessly connect to LavaLink nodes for high-quality audio streaming in your applications. HarmonyLink offers a reliable and easy-to-use interface, perfect for building music bots and audio applications with superior performance.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -31,2 +31,3 @@ /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ | ||
import { Player } from "./player"; | ||
import { TrackData } from "./typings/track"; | ||
@@ -141,2 +142,19 @@ export declare interface HarmonyLink { | ||
}; | ||
/** | ||
* Decodes a or multiple encoded tracks. | ||
* @param {string | string[]} tracks - The track to decode. | ||
* @returns {Promise<TrackData[]>} - A Promise that resolves to the decoded track. | ||
*/ | ||
public async decodeTracks(tracks: string[] | string, node?: Node): Promise<TrackData[] | null> { | ||
if (!Array.isArray(tracks)) tracks = [tracks]; | ||
node ??= await this.nodeManager.getLeastUsedNode(); | ||
if (!node) { | ||
this.emit("debug", "[HarmonyLink] [PlayerManager] No nodes available to decode tracks."); | ||
return null; | ||
}; | ||
return node.rest.decodeTracks(tracks); | ||
}; | ||
} |
@@ -17,2 +17,3 @@ /* eslint-disable max-lines, @typescript-eslint/no-unused-expressions, @typescript-eslint/no-unsafe-declaration-merging, no-sequences, @typescript-eslint/naming-convention */ | ||
import { Filters } from "./Filters"; | ||
import { TrackData } from "@/typings/track"; | ||
@@ -192,2 +193,13 @@ export declare interface Player { | ||
/** | ||
* Decodes a or multiple encoded tracks. | ||
* @param {string | string[]} tracks - The track to decode. | ||
* @returns {Promise<TrackData[]>} - A Promise that resolves to the decoded track. | ||
*/ | ||
public async decodeTracks(tracks: string[] | string): Promise<TrackData[]> { | ||
if (!Array.isArray(tracks)) tracks = [tracks]; | ||
return this.node.rest.decodeTracks(tracks); | ||
}; | ||
/** | ||
* Sets the loop mode for the player. | ||
@@ -194,0 +206,0 @@ * @param {PlayerLoop | "NONE" | "QUEUE" | "TRACK"} mode - The loop mode to set. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
547860
9920