mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
fix: fixed lyrics being cut off
This commit is contained in:
1 parent
c328e30914
commit
002f520e8e
1 file changed
+5
-7
@@ -159,15 +159,14 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(lyricsResult.lyrics);
|
|
||||||
logger.info(`Length: ${lyricsResult.lyrics.length}`);
|
|
||||||
|
|
||||||
// If message length is too long, split into multiple messages
|
// If message length is too long, split into multiple messages
|
||||||
if (lyricsResult.lyrics.length > 3800) {
|
if (lyricsResult.lyrics.length > 3800) {
|
||||||
logger.info(`[Shard ${interaction.guild.shardId}] Lyrics too long, splitting into multiple messages.`);
|
logger.debug(`[Shard ${interaction.guild.shardId}] Lyrics too long, splitting into multiple messages.`);
|
||||||
const messageCount = Math.ceil(lyricsResult.lyrics.length / 3800);
|
const messageCount = Math.ceil(lyricsResult.lyrics.length / 3800);
|
||||||
for (let i = 0; i < messageCount; i++) {
|
for (let i = 0; i < messageCount; i++) {
|
||||||
logger.info(`[Shard ${interaction.guild.shardId}] Sending message ${i + 1} of ${messageCount}.`);
|
logger.debuf(
|
||||||
|
`[Shard ${interaction.guild.shardId}] Lyrics, sending message ${i + 1} of ${messageCount}.`
|
||||||
|
);
|
||||||
const message = lyricsResult.lyrics.slice(i * 3800, (i + 1) * 3800);
|
const message = lyricsResult.lyrics.slice(i * 3800, (i + 1) * 3800);
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
@@ -184,7 +183,6 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
logger.info(`[Shard ${interaction.guild.shardId}] ELSE.`);
|
|
||||||
await interaction.channel.send({
|
await interaction.channel.send({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
@@ -209,7 +207,7 @@ module.exports = {
|
|||||||
`**${embedOptions.icons.queue} Showing lyrics**\n` +
|
`**${embedOptions.icons.queue} Showing lyrics**\n` +
|
||||||
`**Track: [${lyricsResult.title}](${lyricsResult.url})**\n` +
|
`**Track: [${lyricsResult.title}](${lyricsResult.url})**\n` +
|
||||||
`**Artist: [${lyricsResult.artist.name}](${lyricsResult.artist.url})**` +
|
`**Artist: [${lyricsResult.artist.name}](${lyricsResult.artist.url})**` +
|
||||||
`\n\n\`\`\`fix\n${lyricsResult.lyrics.slice(0, 3096)}\`\`\``
|
`\n\n\`\`\`fix\n${lyricsResult.lyrics}\`\`\``
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(embedOptions.colors.info)
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in new issue
Block a user