@@ -647,17 +647,26 @@ export class LavalinkNode {
647647 *
648648 * ```ts
649649 * const lyrics = await player.node.lyrics.get(track, true);
650+ * // use it of player instead:
651+ * // const lyrics = await player.getLyrics(track, true);
650652 * ```
651653 */
652- //Get lyrics for a track
653654 get : async ( track : Track , skipTrackSource : boolean = false ) => {
654655 if ( ! this . sessionId ) throw new Error ( "the Lavalink-Node is either not ready, or not up to date!" ) ;
656+
657+ if (
658+ ! this . info . plugins . find ( v => v . name === "lavalyrics-plugin" )
659+ ) throw new RangeError ( `there is no lavalyrics-plugin available in the lavalink node (required for lyrics): ${ this . id } ` ) ;
660+
661+ if (
662+ ! this . info . plugins . find ( v => v . name === "lavasrc-plugin" ) &&
663+ ! this . info . plugins . find ( v => v . name === "java-lyrics-plugin" )
664+ ) throw new RangeError ( `there is no lyrics source (via lavasrc-plugin / java-lyrics-plugin) available in the lavalink node (required for lyrics): ${ this . id } ` ) ;
665+
655666 const url = `/lyrics?track=${ track . encoded } &skipTrackSource=${ skipTrackSource } ` ;
656667 return ( await this . request ( url ) ) as LyricsResult | null ;
657668 } ,
658669
659- //Get current playing track lyrics
660-
661670 /**
662671 * Get the lyrics of the current playing track
663672 *
@@ -666,11 +675,23 @@ export class LavalinkNode {
666675 * @returns the lyrics of the current playing track
667676 * @example
668677 * ```ts
669- * const lyrics = await player.node.lyrics.getCurrentTrack(guildId);
678+ * const lyrics = await player.node.lyrics.getCurrent(guildId);
679+ * // use it of player instead:
680+ * // const lyrics = await player.getCurrentLyrics();
670681 * ```
671682 */
672- getCurrentTrack : async ( guildId : string , skipTrackSource : boolean = false ) => {
683+ getCurrent : async ( guildId : string , skipTrackSource : boolean = false ) => {
673684 if ( ! this . sessionId ) throw new Error ( "the Lavalink-Node is either not ready, or not up to date!" ) ;
685+
686+ if (
687+ ! this . info . plugins . find ( v => v . name === "lavalyrics-plugin" )
688+ ) throw new RangeError ( `there is no lavalyrics-plugin available in the lavalink node (required for lyrics): ${ this . id } ` ) ;
689+
690+ if (
691+ ! this . info . plugins . find ( v => v . name === "lavasrc-plugin" ) &&
692+ ! this . info . plugins . find ( v => v . name === "java-lyrics-plugin" )
693+ ) throw new RangeError ( `there is no lyrics source (via lavasrc-plugin / java-lyrics-plugin) available in the lavalink node (required for lyrics): ${ this . id } ` ) ;
694+
674695 const url = `/sessions/${ this . sessionId } /players/${ guildId } /track/lyrics?skipTrackSource=${ skipTrackSource } ` ;
675696 return ( await this . request ( url ) ) as LyricsResult | null ;
676697 } ,
@@ -683,11 +704,23 @@ export class LavalinkNode {
683704 * @example
684705 * ```ts
685706 * await player.node.lyrics.subscribe(guildId);
707+ * // use it of player instead:
708+ * // const lyrics = await player.subscribeLyrics();
686709 * ```
687710 */
688711
689712 subscribe : async ( guildId : string ) => {
690713 if ( ! this . sessionId ) throw new Error ( "the Lavalink-Node is either not ready, or not up to date!" ) ;
714+
715+ if (
716+ ! this . info . plugins . find ( v => v . name === "lavalyrics-plugin" )
717+ ) throw new RangeError ( `there is no lavalyrics-plugin available in the lavalink node (required for lyrics): ${ this . id } ` ) ;
718+
719+ if (
720+ ! this . info . plugins . find ( v => v . name === "lavasrc-plugin" ) &&
721+ ! this . info . plugins . find ( v => v . name === "java-lyrics-plugin" )
722+ ) throw new RangeError ( `there is no lyrics source (via lavasrc-plugin / java-lyrics-plugin) available in the lavalink node (required for lyrics): ${ this . id } ` ) ;
723+
691724 return await this . request ( `/sessions/${ this . sessionId } /players/${ guildId } /lyrics/subscribe` , ( options ) => {
692725 options . method = "POST" ;
693726 } ) . catch ( ( ) => { } ) ;
@@ -700,10 +733,22 @@ export class LavalinkNode {
700733 * @example
701734 * ```ts
702735 * await player.node.lyrics.unsubscribe(guildId);
736+ * // use it of player instead:
737+ * // const lyrics = await player.unsubscribeLyrics();
703738 * ```
704739 */
705740 unsubscribe : async ( guildId : string ) => {
706741 if ( ! this . sessionId ) throw new Error ( "the Lavalink-Node is either not ready, or not up to date!" ) ;
742+
743+ if (
744+ ! this . info . plugins . find ( v => v . name === "lavalyrics-plugin" )
745+ ) throw new RangeError ( `there is no lavalyrics-plugin available in the lavalink node (required for lyrics): ${ this . id } ` ) ;
746+
747+ if (
748+ ! this . info . plugins . find ( v => v . name === "lavasrc-plugin" ) &&
749+ ! this . info . plugins . find ( v => v . name === "java-lyrics-plugin" )
750+ ) throw new RangeError ( `there is no lyrics source (via lavasrc-plugin / java-lyrics-plugin) available in the lavalink node (required for lyrics): ${ this . id } ` ) ;
751+
707752 return await this . request ( `/sessions/${ this . sessionId } /players/${ guildId } /lyrics/unsubscribe` , ( options ) => {
708753 options . method = "DELETE" ;
709754 } ) . catch ( ( ) => { } ) ;
0 commit comments