Пример #1
0
        public async Task SearchColor(params string[] args)
        {
            Base.Utilities.CheckAvailability(Context.Guild, Program.Module.Code);
            await Program.p.DoAction(Context.User, Program.Module.Code);

            var result = await Features.Tools.Code.SearchColor(args, Program.p.rand);

            switch (result.error)
            {
            case Features.Tools.Error.Image.InvalidArg:
                await ReplyAsync(Sentences.HelpColor(Context.Guild));

                break;

            case Features.Tools.Error.Image.InvalidColor:
                await ReplyAsync(Sentences.InvalidColor(Context.Guild));

                break;

            case Features.Tools.Error.Image.None:
                await ReplyAsync("", false, new EmbedBuilder()
                {
                    Title       = result.answer.name,
                    Color       = result.answer.discordColor,
                    ImageUrl    = result.answer.colorUrl,
                    Description = Sentences.Rgb(Context.Guild) + ": " + result.answer.discordColor.R + ", " + result.answer.discordColor.G + ", " + result.answer.discordColor.B + Environment.NewLine +
                                  Sentences.Hex(Context.Guild) + ": #" + result.answer.colorHex
                }.Build());

                break;

            default:
                throw new NotImplementedException();
            }
        }