Added anidb search link for the mastodon post
This commit is contained in:
@@ -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))];
|
||||||
}
|
}
|
||||||
|
statusText += $"..{anidbLink}";
|
||||||
|
|
||||||
_ = mastodonClient.PublishStatus(statusText,
|
_ = mastodonClient.PublishStatus(statusText,
|
||||||
Visibility.Public, mediaIds: attachment != null ? new String[] {attachment.Id} : null);
|
Visibility.Public, mediaIds: attachment != null ? new String[] { attachment.Id } : null);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user