@@ -30,10 +30,12 @@ import me.duncte123.skybot.objects.command.CommandContext
3030import me.duncte123.skybot.objects.command.MusicCommand
3131import me.duncte123.skybot.utils.chunkForEmbed
3232import net.dv8tion.jda.api.EmbedBuilder
33+ import net.dv8tion.jda.api.entities.MessageEmbed
3334import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
3435import net.dv8tion.jda.api.interactions.commands.OptionType
3536import net.dv8tion.jda.api.interactions.commands.build.SubcommandData
3637import kotlin.jvm.optionals.getOrNull
38+ import kotlin.math.min
3739
3840class LyricsCommand : MusicCommand () {
3941 init {
@@ -180,6 +182,7 @@ class LyricsCommand : MusicCommand() {
180182 cb(buildLyricsEmbed(info))
181183 }
182184 }) {
185+ it.printStackTrace()
183186 cb(null )
184187 }
185188 }
@@ -189,11 +192,16 @@ class LyricsCommand : MusicCommand() {
189192 .setTitle(" Lyrics for ${data.title} " , data.url)
190193 .setThumbnail(data.artUrl)
191194
192- data.lyrics.chunkForEmbed(450 ).forEachIndexed { index, chunk ->
195+ val lyrics = data.lyrics
196+ val trimmedLyrics = lyrics.substring(
197+ 0 until min(lyrics.length, 5800 ) // seems like a good max length
198+ )
199+
200+ trimmedLyrics.chunkForEmbed(450 ).forEachIndexed { index, chunk ->
193201 builder.addField(" **[${index + 1 } ]**" , chunk, true )
194202 }
195203
196- builder.setFooter(" Lyrics provided by ${data.source} " )
204+ builder.setFooter(" Source: ${data.source} " )
197205
198206 return builder
199207 }
0 commit comments