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

@@ -259,12 +259,17 @@ namespace AnimeAnnouncer
String overview = !String.IsNullOrWhiteSpace(cachedShow.LatestSeasonOverview) ? cachedShow.LatestSeasonOverview : cachedShow.Overview ?? String.Empty;
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))];
}
statusText += $"..{anidbLink}";
_ = mastodonClient.PublishStatus(statusText,
Visibility.Public, mediaIds: attachment != null ? new String[] { attachment.Id } : null);