示例#1
0
        public RuntimeEmbed Query(string embed)
        {
            string[] cutEmbed = embed.Slice();

            foreach (string x in cutEmbed)
            {
                switch (x.Split('{')[0].ToLower().Trim(' '))
                {
                case "title":
                {
                    Title = x.Peel();
                }
                break;

                case "description":
                case "desc":
                {
                    Description = x.Peel();
                } break;

                case "url":
                {
                    Url = x.Peel();
                } break;

                case "imageurl":
                {
                    ImageUrl = x.Peel();
                } break;

                case "color":
                case "c":
                {
                    string[] colorSplit = x.Peel().Split(',');
                    Color = new Color(float.Parse(colorSplit[0]), float.Parse(colorSplit[1]), float.Parse(colorSplit[2]));
                } break;

                case "author":
                {
                    Author = (Author as IQuery <RuntimeEmbedAuthor>).Query(x.Peel());
                } break;

                case "footer":
                {
                    Footer = (Footer as IQuery <RuntimeEmbedFooter>).Query(x.Peel());
                } break;

                case "field":
                {
                    RuntimeEmbedField em = new RuntimeEmbedField();
                    AddField((em as IQuery <RuntimeEmbedField>).Query(x.Peel()));
                } break;
                }
            }

            return(this);
        }
示例#2
0
        public IDiscordEmbed AddField(Action <IEmbedField> field)
        {
            IEmbedField f = new RuntimeEmbedField("", "");

            field.Invoke(f);

            embed.AddField(x =>
            {
                x.Name     = f.Name;
                x.Value    = f.Value;
                x.IsInline = f.IsInline;
            });

            return(this);
        }