UNPKG

lavacord

Version:

A simple by design lavalink wrapper made for any discord library.

64 lines (63 loc) 2.72 kB
import type { LavalinkNode } from "./LavalinkNode"; import type { TrackLoadingResult, DecodeTrackResult, DecodeTracksResult, GetLavalinkVersionResult, UpdateSessionResult, ErrorResponse, UpdatePlayerData, UpdatePlayerResult, DestroyPlayerResult } from "lavalink-types/v4"; export declare class RestError extends Error { json: ErrorResponse; constructor(json: ErrorResponse); } /** * A Rest helper for Lavalink */ export declare class Rest { /** * Private base request function * @param node The lavalink node * @param path Route starting with / * @param init Request init if any * @param requires Properties of the lavalink node the route requires * @throws {RestError} If lavalink encounters an error */ private static baseRequest; /** * A helper for /v?/loadtracks endpoint * @param node The LavalinkNode * @param identifer The thing you want to load * @throws {RestError} If lavalink encounters an error */ static load(node: LavalinkNode, identifer: string): Promise<TrackLoadingResult>; /** * A helper for /v?/decodetrack & /v?/decodetracks * @param node The lavalink node * @param track The track(s) you want to decode * @throws {RestError} If lavalink encounters an error */ static decode(node: LavalinkNode, track: string): Promise<DecodeTrackResult>; static decode(node: LavalinkNode, tracks: string[]): Promise<DecodeTracksResult>; /** * A helper for /version * @param node The lavalink node * @throws {RestError} If lavalink encounters an error */ static version(node: LavalinkNode): Promise<GetLavalinkVersionResult>; /** * A helper for PATCH /v?/sessions/:sessionId * @param node The lavalink node * @throws {RestError} If lavalink encounters an error */ static updateSession(node: LavalinkNode): Promise<UpdateSessionResult>; /** * A helper for PATCH /v?/sessions/:sessionId/players/:guildId * @param node The lavalink node * @param guildId The Id of the guild * @param data The update data * @param noReplace If the event should be dropped if there's a currently playing track * @throws {RestError} If lavalink encounters an error */ static updatePlayer(node: LavalinkNode, guildId: string, data: UpdatePlayerData, noReplace?: boolean): Promise<UpdatePlayerResult>; /** * A helper for DELETE /v?/sessions/:sessionId/players/:guildId * @param node The lavalink node * @param guildId The Id of the guild * @throws {RestError} If lavalink encounters an error */ static destroyPlayer(node: LavalinkNode, guildId: string): Promise<DestroyPlayerResult>; }