示例#1
0
        private Embed CreateEmbed(bool isAnime, Response.AnimeManga res)
        {
            string       fullName = res.name + ((res.alternativeTitles == null || res.alternativeTitles.Length == 0) ? ("") : (" (" + string.Join(", ", res.alternativeTitles) + ")"));
            EmbedBuilder embed    = new EmbedBuilder()
            {
                Title       = fullName.Length > 256 ? res.name : fullName,
                Url         = res.animeUrl,
                Color       = Color.Green,
                ImageUrl    = res.imageUrl,
                Description = res.synopsis
            };

            if (isAnime && res.episodeCount != null)
            {
                embed.AddField(Sentences.AnimeEpisodes(Context.Guild), res.episodeCount.Value + ((res.episodeLength != null) ? (" " + Sentences.AnimeLength(Context.Guild, res.episodeLength.Value)) : ("")), true);
            }
            if (res.rating != null)
            {
                embed.AddField(Sentences.AnimeRating(Context.Guild), res.rating.Value, true);
            }
            embed.AddField(Sentences.ReleaseDate(Context.Guild), ((res.startDate != null) ? res.startDate.Value.ToString(Base.Sentences.DateHourFormatShort(Context.Guild)) + " - " + ((res.endDate != null) ? (res.endDate.Value.ToString(Base.Sentences.DateHourFormatShort(Context.Guild))) : (Sentences.Unknown(Context.Guild))) : (Sentences.ToBeAnnounced(Context.Guild))), true);
            if (!string.IsNullOrEmpty(res.ageRating))
            {
                embed.AddField(Sentences.AnimeAudiance(Context.Guild), res.ageRating, true);
            }
            return(embed.Build());
        }