Skip to content

Commit

Permalink
Update getting_lyrics.mdx (#1943)
Browse files Browse the repository at this point in the history
Fix lrclib url
lrclib return:
  id: 1064245,
  name: 'unlasting',
  trackName: 'unlasting',
  artistName: 'LiSA',
  albumName: 'unlasting',
  duration: 297,
  instrumental: false,
  ....
  • Loading branch information
zijipia authored Oct 3, 2024
1 parent cefd30f commit 625bf4e
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions apps/website/src/pages/guide/_guides/examples/getting_lyrics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Discord Player provides two different methods for getting lyrics of a song. The

## New Method

This method is built into discord-player itself and provides both plaintext and synced lyrics. This method is more robust and reliable than the old method. It is powered by [lrclib](https://liclib.net).
This method is built into discord-player itself and provides both plaintext and synced lyrics. This method is more robust and reliable than the old method. It is powered by [lrclib](https://lrclib.net).

#### Plain Lyrics

Expand All @@ -18,14 +18,7 @@ if (!lyrics.length) return interaction.followUp({ content: 'No lyrics found', ep
const trimmedLyrics = lyrics[0].plainLyrics.substring(0, 1997);

const embed = new EmbedBuilder()
.setTitle(lyrics[0].title)
.setURL(lyrics[0].url)
.setThumbnail(lyrics[0].thumbnail)
.setAuthor({
name: lyrics[0].artist.name,
iconURL: lyrics[0].artist.image,
url: lyrics[0].artist.url
})
.setTitle(`${lyrics[0].trackName} - ${lyrics[0].artistName}`)
.setDescription(trimmedLyrics.length === 1997 ? `${trimmedLyrics}...` : trimmedLyrics)
.setColor('Yellow');

Expand All @@ -46,7 +39,7 @@ if (!first.syncedLyrics) {
}

// load raw lyrics to the queue
const syncedLyrics = queue.syncedLyrics(lyrics);
const syncedLyrics = queue.syncedLyrics(first);

syncedLyrics.at(timestampInMilliseconds); // manually get a line at a specific timestamp

Expand Down

0 comments on commit 625bf4e

Please sign in to comment.