Esempio n. 1
0
        public async Task XkcdSearch(params string[] args)
        {
            Base.Utilities.CheckAvailability(Context.Guild.Id, Program.Module.Xkcd);
            await p.DoAction(Context.User, Context.Guild.Id, Program.Module.Xkcd);

            var result = await Features.Entertainment.Xkcd.SearchXkcd(args, Program.p.rand);

            switch (result.error)
            {
            case Features.Entertainment.Error.Xkcd.InvalidNumber:
                await ReplyAsync(Sentences.XkcdWrongArg(Context.Guild.Id));

                break;

            case Features.Entertainment.Error.Xkcd.NotFound:
                await ReplyAsync(Sentences.XkcdWrongId(Context.Guild.Id, result.answer.maxNb));

                break;

            case Features.Entertainment.Error.Xkcd.None:
                await ReplyAsync("", false, new EmbedBuilder()
                {
                    Title    = result.answer.title,
                    Color    = Color.Blue,
                    ImageUrl = result.answer.imageUrl,
                    Footer   = new EmbedFooterBuilder()
                    {
                        Text = result.answer.alt
                    }
                }.Build());

                break;

            default:
                throw new NotImplementedException();
            }
        }