From 2f72720ed24f1242b3f77aa9350249e307c016a1 Mon Sep 17 00:00:00 2001 From: moonleay Date: Sun, 29 Oct 2023 11:30:29 +0100 Subject: [PATCH 1/3] fix: fixed the automated feed showing it is manual --- src/main/kotlin/net/moonleay/rssbot/jobs/FeedUpdater.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/net/moonleay/rssbot/jobs/FeedUpdater.kt b/src/main/kotlin/net/moonleay/rssbot/jobs/FeedUpdater.kt index 0a9ea24..2253b5a 100644 --- a/src/main/kotlin/net/moonleay/rssbot/jobs/FeedUpdater.kt +++ b/src/main/kotlin/net/moonleay/rssbot/jobs/FeedUpdater.kt @@ -94,10 +94,10 @@ object FeedUpdater : ICronjob { if (rssData.description == null) "No description" else Remark(EmbedUtil.getHTMLtoMarkdownOptions()).convertFragment( rssData.description!! ), - rssData.link ?: "https://moonleay.net/", + rssData.link ?: "https://moonleay.net/404", rssData.image ?: "", if (rssData.link != null) EmbedUtil.getSiteLogo(rssData.link!!) else "https://static.moonleay.net/img/rssbot/no-image.png", - "Manual Feed", + data.feedName, rssData.pubDate ?: "unknown" ) ) From a7ee34d8656e2423691a54d5272b197d9d6535eb Mon Sep 17 00:00:00 2001 From: moonleay Date: Sun, 29 Oct 2023 11:31:12 +0100 Subject: [PATCH 2/3] feat: improved the length management of RSSEmbeds --- .../net/moonleay/rssbot/util/MessageUtil.kt | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/net/moonleay/rssbot/util/MessageUtil.kt b/src/main/kotlin/net/moonleay/rssbot/util/MessageUtil.kt index 21b109e..f4848d0 100644 --- a/src/main/kotlin/net/moonleay/rssbot/util/MessageUtil.kt +++ b/src/main/kotlin/net/moonleay/rssbot/util/MessageUtil.kt @@ -178,15 +178,27 @@ object MessageUtil { ): EmbedBuilder { val ebb = EmbedBuilder() val now: LocalDateTime = LocalDateTime.now() - if (title.length > 25) - ebb.title = title.substring(0, 25) + "..." + var desc = if (description != "No description") description else "" + val articleLink = "\n[[open full article]($url)]" + if (title.length > 255){ + ebb.title = title.substring(0, 252) + "..." + if (title != desc) + desc = "..." + title.substring(252, title.length) + "\n\n" + desc + } else ebb.title = title + var athr = author + if (author.length > 255) { + athr = author.substring(0, 252) + "..." + } ebb.author { - this.name = author + this.name = athr this.icon = logo } - ebb.description = "${if (description != "No description") description else ""}\n[[open full article]($url)]" + if (desc.length > 4096 - 2 - articleLink.length){ + desc = desc.substring(0, 4096 - 2 - articleLink.length) + "..." + } + ebb.description = "${desc}${articleLink}" ebb.color = color.color.color ebb.footer { this.text = "> rssbot, ($feedName) \n/ pub $published \n/ rel ${dtf.format(now)}" From 2a18a0bedda739823b6048387c1adb1526416c36 Mon Sep 17 00:00:00 2001 From: moonleay Date: Sun, 29 Oct 2023 11:31:21 +0100 Subject: [PATCH 3/3] fix: bump version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2b549ee..bd7378a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,7 +14,7 @@ val ownerID = 372703841151614976L group = "net.moonleay.rssbot" version = System.getenv("CI_COMMIT_TAG")?.let { "$it-${System.getenv("CI_COMMIT_SHORT_SHA")}-prod" } ?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" } - ?: "0.3.3" + ?: "0.3.4" val kordver = "1.5.10-SNAPSHOT" val coroutinesver = "1.7.3"