Added anidb search link for the mastodon post

This commit is contained in:
2024-10-09 20:37:36 -04:00
parent c1103564bb
commit 310978054d

View File

@@ -257,16 +257,21 @@ namespace AnimeAnnouncer
//Prepare Status //Prepare Status
String statusText = $"{cachedShow.Title} ({cachedShow.VoteAverage}/10) DUBBED has finished airing season {cachedShow.LatestSeasonNumber}! Episode {cachedShow.LastEpisodeNumber} is now available for download. {Environment.NewLine + Environment.NewLine}"; String statusText = $"{cachedShow.Title} ({cachedShow.VoteAverage}/10) DUBBED has finished airing season {cachedShow.LatestSeasonNumber}! Episode {cachedShow.LastEpisodeNumber} is now available for download. {Environment.NewLine + Environment.NewLine}";
String overview = !String.IsNullOrWhiteSpace(cachedShow.LatestSeasonOverview) ? cachedShow.LatestSeasonOverview : cachedShow.Overview ?? String.Empty; String overview = !String.IsNullOrWhiteSpace(cachedShow.LatestSeasonOverview) ? cachedShow.LatestSeasonOverview : cachedShow.Overview ?? String.Empty;
if(!String.IsNullOrWhiteSpace(overview)) if (!String.IsNullOrWhiteSpace(overview))
{ {
statusText += $"Overview: {overview}"; statusText += $"{overview}";
} }
if(statusText.Length >= 500) String anidbLink = $"{Environment.NewLine}https://anilist.co/search/anime?search={cachedShow.Title.Replace(" ", "%20")}";
int linkLength = anidbLink.Length;
if (statusText.Length + linkLength + 3 >= 500)
{ {
statusText = statusText[..497] + ".."; statusText = statusText[..(500 - (linkLength + 3))];
} }
_ = mastodonClient.PublishStatus(statusText, statusText += $"..{anidbLink}";
Visibility.Public, mediaIds: attachment != null ? new String[] {attachment.Id} : null);
_ = mastodonClient.PublishStatus(statusText,
Visibility.Public, mediaIds: attachment != null ? new String[] { attachment.Id } : null);
} }
} }