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}"); }));
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); }
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()); }