diff --git a/src/main/kotlin/space/lachy/lachsbot/database/mongo/collection/RecordMessageDelete.kt b/src/main/kotlin/space/lachy/lachsbot/database/mongo/collection/RecordMessageDelete.kt index 96f2be9..32e99d5 100644 --- a/src/main/kotlin/space/lachy/lachsbot/database/mongo/collection/RecordMessageDelete.kt +++ b/src/main/kotlin/space/lachy/lachsbot/database/mongo/collection/RecordMessageDelete.kt @@ -1,6 +1,7 @@ package space.lachy.lachsbot.database.mongo.collection import net.dv8tion.jda.api.EmbedBuilder +import net.dv8tion.jda.api.entities.MessageEmbed.VALUE_MAX_LENGTH import org.bson.BsonDateTime import org.bson.codecs.pojo.annotations.BsonId import org.bson.codecs.pojo.annotations.BsonProperty @@ -57,7 +58,7 @@ data class RecordMessageDelete( return EmbedBuilder() .setTitle("Message Deleted") .setDescription("Discord's API does not advise who caused this, use Audit Log to check.") - .addField("Last Known Message Raw", messageRawLastKnown?.truncate() ?: "N/A", false) + .addField("Last Known Message Raw", messageRawLastKnown?.truncate(VALUE_MAX_LENGTH) ?: "N/A", false) .addField("Message ID", "$messageId", true) .addField("Timestamp Epoch", "${timestampEpoch.value}", true) .addField("Timestamp FMT", "${Date(timestampEpoch.value)}", true) diff --git a/src/main/kotlin/space/lachy/lachsbot/database/mongo/collection/RecordMessageUpdate.kt b/src/main/kotlin/space/lachy/lachsbot/database/mongo/collection/RecordMessageUpdate.kt index 4d68331..42867f8 100644 --- a/src/main/kotlin/space/lachy/lachsbot/database/mongo/collection/RecordMessageUpdate.kt +++ b/src/main/kotlin/space/lachy/lachsbot/database/mongo/collection/RecordMessageUpdate.kt @@ -1,6 +1,7 @@ package space.lachy.lachsbot.database.mongo.collection import net.dv8tion.jda.api.EmbedBuilder +import net.dv8tion.jda.api.entities.MessageEmbed.VALUE_MAX_LENGTH import org.bson.BsonDateTime import org.bson.codecs.pojo.annotations.BsonId import org.bson.codecs.pojo.annotations.BsonProperty @@ -66,8 +67,8 @@ data class RecordMessageUpdate( fun toEmbedBuilder(): EmbedBuilder { val builder = EmbedBuilder() .setTitle("Message Updated") - .addField("New Message Raw", messageRawNew.truncate(), false) - .addField("Old Message Raw Last Known", messageRawLastKnown?.truncate() ?: "N/A", false) + .addField("New Message Raw", messageRawNew.truncate(VALUE_MAX_LENGTH), false) + .addField("Old Message Raw Last Known", messageRawLastKnown?.truncate(VALUE_MAX_LENGTH) ?: "N/A", false) .addField("Message ID", "$messageId", true) .addField("Timestamp Epoch", "${timestampEpoch.value}", true) .addField("Timestamp FMT", "${Date(timestampEpoch.value)}", true) @@ -82,7 +83,7 @@ data class RecordMessageUpdate( .addField("Author Username", authorUsername, true) .addField("Author Effective Name", authorEffectiveName, true) .addField("Author Tag", "<@${authorId}>", true) - .addField("Jump URL", jumpUrl.truncate(), true) + .addField("Jump URL", jumpUrl.truncate(VALUE_MAX_LENGTH), true) .setFooter("${javaClass.simpleName} - ID#$id") .setColor(Color.LIGHT_GRAY) diff --git a/src/main/kotlin/space/lachy/lachsbot/listener/record/RecordListenerManager.kt b/src/main/kotlin/space/lachy/lachsbot/listener/record/RecordListenerManager.kt index ebc2d22..ac87428 100644 --- a/src/main/kotlin/space/lachy/lachsbot/listener/record/RecordListenerManager.kt +++ b/src/main/kotlin/space/lachy/lachsbot/listener/record/RecordListenerManager.kt @@ -5,6 +5,7 @@ import com.mongodb.client.model.Sorts import kotlinx.coroutines.flow.firstOrNull import net.dv8tion.jda.api.EmbedBuilder import net.dv8tion.jda.api.entities.Message +import net.dv8tion.jda.api.entities.MessageEmbed.VALUE_MAX_LENGTH import org.bson.BsonDateTime import org.bson.BsonInt64 import space.lachy.lachsbot.database.mongo.Mongo @@ -83,7 +84,7 @@ object RecordListenerManager { for(att in attachments) { builder.addField( "Attachment ${i}", - "Name: '${att.name}'; Extension: '${att.extension}'; URL: '${att.url}'".truncate(), + "Name: '${att.name}'; Extension: '${att.extension}'; URL: '${att.url}'".truncate(VALUE_MAX_LENGTH), false )