예제 #1
0
        public EmbedBuilder ToEmbed()
        {
            EmbedBuilder embedBuilder = new EmbedBuilder();

            embedBuilder.WithTitle(Name)
            .WithUrl(SiteDetailUrl)
            .WithDescription(Deck ?? "No Deck on Giant Bomb.")
            .WithImageUrl(Image?.MediumUrl ?? Image?.SmallUrl ?? Image?.ThumbUrl ?? Image?.SuperUrl ?? "https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/No_image_available.svg/200px-No_image_available.svg.png")
            .WithFooter(x => x.Text = "Giant Bomb")
            .WithColor(new Discord.Color(0x00CC00))
            .WithCurrentTimestamp();

            if (OriginalReleaseDate != null)
            {
                embedBuilder.AddField(x =>
                {
                    x.Name     = "First release date";
                    x.Value    = OriginalReleaseDate?.Replace(" 00:00:00", "");
                    x.IsInline = true;
                });
            }
            else if (ExpectedReleaseDay != null && ExpectedReleaseMonth != null && ExpectedReleaseYear != null)
            {
                embedBuilder.AddField(x =>
                {
                    x.Name  = "Expected release date";
                    x.Value =
                        $"{ExpectedReleaseYear}-{(ExpectedReleaseMonth < 10 ? "0" + ExpectedReleaseMonth : ExpectedReleaseMonth.ToString())}-{ExpectedReleaseDay}";
                    x.IsInline = true;
                });
            }
            else if (ExpectedReleaseQuarter != null && ExpectedReleaseYear != null)
            {
                embedBuilder.AddField(x =>
                {
                    x.Name     = "Expected release quarter";
                    x.Value    = $"Q{ExpectedReleaseQuarter} {ExpectedReleaseYear}";
                    x.IsInline = true;
                });
            }

            if (Platforms != null && Platforms.Any())
            {
                embedBuilder.AddField(x =>
                {
                    x.Name     = "Platforms";
                    x.Value    = Platforms != null ? string.Join(", ", Platforms?.Select(y => y.Name)) : null;
                    x.IsInline = true;
                });
            }

            return(embedBuilder);
        }
예제 #2
0
        public override string ToString()
        {
            string s = "";

            s += Name != null ? "`Title:` **" + Name : "";
            s += Deck != null ? "**\n`Deck:` " + Deck : "";
            s += OriginalReleaseDate != null ? "\n`Release Date:` " + OriginalReleaseDate.Replace(" 00:00:00", "") : "";
            s += Platforms != null ? "\n`Platforms:` " + string.Join(", ", Platforms?.Select(x => x.Name)) : "";
            s += SiteDetailUrl != null ? "\n`Link:` " + SiteDetailUrl : "";
            s += Image?.SmallUrl != null ? "\n`img:` " + Image?.SmallUrl : "";
            return(s);
        }