Exemplo n.º 1
0
        public async Task RandomAsync(CommandContext ctx)
        {
            XkcdComic comic = await XkcdService.GetRandomComicAsync();

            if (comic is null)
            {
                throw new CommandFailedException("Failed to retrieve comic from xkcd.");
            }

            await ctx.RespondAsync(embed : comic.ToDiscordEmbedBuilder(this.ModuleColor));
        }
Exemplo n.º 2
0
        public async Task ByIdAsync(CommandContext ctx,
                                    [Description("Comic ID.")] int?id = null)
        {
            XkcdComic comic = await XkcdService.GetComicAsync(id);

            if (comic is null)
            {
                throw new CommandFailedException("Failed to retrieve comic from xkcd.");
            }

            await ctx.RespondAsync(embed : comic.ToDiscordEmbedBuilder(this.ModuleColor));
        }