mirror of
https://github.com/MinazukiAmane/Tinasha-Bot.git
synced 2025-03-15 12:35:58 +08:00
change from lyrics using java timed now used lavalyrics
this change now make the needed of lavalink plugins requirements from java-timed-lyrics to lavalyrics
This commit is contained in:
parent
9090aa0916
commit
12cc645120
@ -69,7 +69,7 @@ async function getLyric({ client, guild, member }, query) {
|
|||||||
|
|
||||||
// Try default lyrics endpoint first
|
// Try default lyrics endpoint first
|
||||||
try {
|
try {
|
||||||
const defaultLyricsUrl = `${baseUrl}/v4/sessions/${node.sessionId}/players/${guild.id}/lyrics`;
|
const defaultLyricsUrl = `${baseUrl}/v4/sessions/${node.sessionId}/players/${guild.id}/track/lyrics?skipTrackSource=true`;
|
||||||
const defaultRes = await fetch(defaultLyricsUrl, {
|
const defaultRes = await fetch(defaultLyricsUrl, {
|
||||||
headers: { Authorization: node.options.authorization }
|
headers: { Authorization: node.options.authorization }
|
||||||
});
|
});
|
||||||
@ -115,16 +115,10 @@ function createLyricsEmbed(lyrics, member, track) {
|
|||||||
.setThumbnail(track.info.artworkUrl)
|
.setThumbnail(track.info.artworkUrl)
|
||||||
.setFooter({ text: `Requested by: ${member.user.displayName} | Source: ${lyrics.source || 'Unknown'}` });
|
.setFooter({ text: `Requested by: ${member.user.displayName} | Source: ${lyrics.source || 'Unknown'}` });
|
||||||
|
|
||||||
let ltext;
|
const lines = lyrics.lines.map(line => line.line).filter(Boolean).join("\n");
|
||||||
if (lyrics.type === 'text') {
|
const truncatedLyrics = lines.length > 4096 ? `${lines.slice(0, 4093)}...` : lines;
|
||||||
ltext = lyrics.text;
|
|
||||||
} else if (lyrics.type === 'timed') {
|
|
||||||
ltext = lyrics.lines.map(line => line.line).join('\n');
|
|
||||||
} else {
|
|
||||||
return "Unsupported lyrics format";
|
|
||||||
}
|
|
||||||
|
|
||||||
embed.setDescription(ltext.length > 4096 ? ltext.slice(0, 4093) + "..." : ltext);
|
embed.setDescription(truncatedLyrics);
|
||||||
|
|
||||||
return { embeds: [embed] };
|
return { embeds: [embed] };
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user