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

            var result = await Features.Tools.Linguist.Kanji(words);

            switch (result.error)
            {
            case Features.Tools.Error.Kanji.Help:
                await ReplyAsync(Sentences.KanjiHelp(Context.Guild));

                break;

            case Features.Tools.Error.Kanji.NotFound:
                await ReplyAsync(Sentences.UrbanNotFound(Context.Guild));

                break;

            case Features.Tools.Error.Kanji.None:
                await ReplyAsync("", false, new EmbedBuilder
                {
                    Title       = result.answer.kanji.ToString(),
                    Description = result.answer.meaning,
                    ImageUrl    = result.answer.strokeOrder,
                    Color       = Color.Blue,
                    Fields      = new List <EmbedFieldBuilder>
                    {
                        new EmbedFieldBuilder()
                        {
                            Name  = Sentences.Radical(Context.Guild),
                            Value = result.answer.radicalKanji + ": " + result.answer.radicalMeaning
                        },
                        new EmbedFieldBuilder()
                        {
                            Name  = Sentences.Parts(Context.Guild),
                            Value = string.Join(Environment.NewLine, result.answer.parts.Select(x => x.Value == "" ? x.Key : x.Key + ": " + x.Value))
                        },
                        new EmbedFieldBuilder()
                        {
                            Name  = "Onyomi",
                            Value = result.answer.onyomi.Count == 0 ? Base.Sentences.None(Context.Guild) : string.Join(Environment.NewLine, result.answer.onyomi.Select(x => x.Key + " (" + x.Value + ")"))
                        },
                        new EmbedFieldBuilder()
                        {
                            Name  = "Kunyomi",
                            Value = result.answer.kunyomi.Count == 0 ? Base.Sentences.None(Context.Guild) : string.Join(Environment.NewLine, result.answer.kunyomi.Select(x => x.Key + " (" + x.Value + ")"))
                        }
                    }
                }.Build());

                break;

            default:
                throw new NotImplementedException();
            }
        }