Exemplo n.º 1
0
 private Task PrintComicAsync(CommandContext ctx, XkcdComic comic)
 {
     return(ctx.RespondWithLocalizedEmbedAsync(emb => {
         emb.WithTitle($"xkcd #{comic.Id} - {comic.Title}");
         emb.WithImageUrl(comic.ImageUrl);
         string?url = XkcdService.CreateUrlForComic(comic.Id);
         if (url is { })
         {
             emb.WithUrl(url);
         }
         emb.WithColor(this.ModuleColor);
         emb.WithLocalizedFooter("fmt-xkcd", null, $"{comic.Month}/{comic.Year}");
     }));
Exemplo n.º 2
0
        public static DiscordEmbedBuilder ToDiscordEmbedBuilder(this XkcdComic comic, DiscordColor?color = null)
        {
            var emb = new DiscordEmbedBuilder {
                Title    = $"xkcd #{comic.Id} : {comic.Title}",
                ImageUrl = comic.ImageUrl,
                Url      = XkcdService.CreateUrlForComic(comic.Id)
            };

            if (!(color is null))
            {
                emb.WithColor(color.Value);
            }

            emb.WithFooter($"Publish date: {comic.Month}/{comic.Year}");

            return(emb);
        }
Exemplo n.º 3
0
        public DiscordEmbed ToDiscordEmbed(DiscordColor?color = null)
        {
            var emb = new DiscordEmbedBuilder()
            {
                Title    = $"xkcd #{this.Id} : {this.Title}",
                ImageUrl = ImageUrl,
                Url      = XkcdService.CreateUrlForComic(this.Id)
            };

            if (color != null)
            {
                emb.WithColor(color.Value);
            }

            emb.WithFooter($"Publish date: {this.Month}/{this.Year}");

            return(emb.Build());
        }