diff --git a/src/Player.ts b/src/Player.ts index 36b0c4b..3cd809b 100644 --- a/src/Player.ts +++ b/src/Player.ts @@ -1,6 +1,6 @@ import { EventEmitter } from 'events'; import { Client, Collection, Snowflake, Collector, Message, VoiceChannel, VoiceState } from 'discord.js'; -import { PlayerOptions, PlayerProgressbarOptions, QueueFilters } from './types/types'; +import { LyricsData, PlayerOptions, PlayerProgressbarOptions, QueueFilters } from './types/types'; import Util from './utils/Util'; import AudioFilters from './utils/AudioFilters'; import { Queue } from './Structures/Queue'; @@ -853,6 +853,17 @@ export class Player extends EventEmitter { } } + /** + * Gets lyrics of a song + * @param query Search query + */ + async lyrics(query: string) { + const data = await DP_EXTRACTORS.Lyrics(query); + if (Array.isArray(data)) return null; + + return data as LyricsData; + } + private _handleVoiceStateUpdate(oldState: VoiceState, newState: VoiceState) { const queue = this.queues.find((g) => g.guildID === oldState.guild.id); if (!queue) return; diff --git a/src/types/types.ts b/src/types/types.ts index e626c96..000fd06 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -94,3 +94,18 @@ export interface PlayerProgressbarOptions { queue?: boolean; length?: number; } + +export interface LyricsData { + title: string; + id: number; + thumbnail: string; + image: string; + url: string; + artist: { + name: string; + id: number; + url: string; + image: string; + }; + lyrics?: string; +} \ No newline at end of file