public async Task RandomAsync(CommandContext ctx) { XkcdComic comic = await XkcdService.GetRandomComicAsync(); if (comic == null) { throw new CommandFailedException("Failed to retrieve comic from xkcd."); } await ctx.RespondAsync(embed : comic.ToDiscordEmbed(this.ModuleColor)); }
public async Task ByIdAsync(CommandContext ctx, [Description("Comic ID.")] int?id = null) { XkcdComic comic = await XkcdService.GetComicAsync(id); if (comic == null) { throw new CommandFailedException("Failed to retrieve comic from xkcd."); } await ctx.RespondAsync(embed : comic.ToDiscordEmbed(this.ModuleColor)); }