From 20c991653511ecd55c28cc3b655b8e4cd7838525 Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Wed, 29 Nov 2023 21:08:08 +0800 Subject: [PATCH] add show retweet weibo --- gradle.properties | 2 +- .../cono/morny/data/social/SocialWeiboParser.scala | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index f42f3ab..c61b7ab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ MORNY_ARCHIVE_NAME = morny-coeur MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono MORNY_COMMIT_PATH = https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s -VERSION = 1.3.0-dev12 +VERSION = 1.3.0-dev13 USE_DELTA = false VERSION_DELTA = diff --git a/src/main/scala/cc/sukazyo/cono/morny/data/social/SocialWeiboParser.scala b/src/main/scala/cc/sukazyo/cono/morny/data/social/SocialWeiboParser.scala index 44b9482..9fac0d7 100644 --- a/src/main/scala/cc/sukazyo/cono/morny/data/social/SocialWeiboParser.scala +++ b/src/main/scala/cc/sukazyo/cono/morny/data/social/SocialWeiboParser.scala @@ -11,12 +11,23 @@ object SocialWeiboParser { @throws[HttpError[?] | SttpClientException | ParsingFailure | DecodingFailure] def parseMStatus (api: MApi[MStatus]): SocialContent = { + def retweetedMessage (retweetedStatus: Option[MStatus]): String = + retweetedStatus match + case Some(status) => + val pic_preview = if status.pic_ids.isEmpty then "" else + "\n" + (for (pic <- status.pic_ids) yield "🖼️").mkString(" ") + // language=html + s""" + |//${h(status.user.screen_name)}: + |${ch(status.text)}$pic_preview + |""".stripMargin + case None => "" val content = // language=html s"""🔸${h(api.data.user.screen_name)} | |${ch(api.data.text)} - | + |${retweetedMessage(api.data.retweeted_status)} |${h(api.data.created_at)}""".stripMargin api.data.pics match case None =>