示例#1
0
 public EmbedBuilder()
 {
     _model = new Embed {
         Type = "rich"
     };
     _fields = new List <Field>();
 }
示例#2
0
 internal static Embed Create(Model model)
 {
     return(new Embed(model.Type, model.Title, model.Description, model.Url,
                      model.Color.HasValue ? new Color(model.Color.Value) : (Color?)null,
                      model.Author.IsSpecified ? EmbedAuthor.Create(model.Author.Value) : (EmbedAuthor?)null,
                      model.Footer.IsSpecified ? EmbedFooter.Create(model.Footer.Value) : (EmbedFooter?)null,
                      model.Provider.IsSpecified ? EmbedProvider.Create(model.Provider.Value) : (EmbedProvider?)null,
                      model.Thumbnail.IsSpecified ? EmbedThumbnail.Create(model.Thumbnail.Value) : (EmbedThumbnail?)null,
                      model.Fields.IsSpecified ? model.Fields.Value.Select(x => EmbedField.Create(x)).ToImmutableArray() : ImmutableArray.Create <EmbedField>()));
 }
示例#3
0
        public async Task <IUserMessage> SendMessageAsync(string text, bool isTTS, Discord.API.Embed embed = null)
        {
            var args = new CreateMessageParams(text)
            {
                Content = text, IsTTS = isTTS, Embed = embed
            };
            var model = await Discord.ApiClient.CreateDMMessageAsync(Id, args).ConfigureAwait(false);

            return(CreateOutgoingMessage(model));
        }
示例#4
0
        public Embed(Model model)
        {
            Url         = model.Url;
            Type        = model.Type;
            Title       = model.Title;
            Description = model.Description;

            if (model.Provider.IsSpecified)
            {
                Provider = new EmbedProvider(model.Provider.Value);
            }
            if (model.Thumbnail.IsSpecified)
            {
                Thumbnail = new EmbedThumbnail(model.Thumbnail.Value);
            }
        }
示例#5
0
        public Embed(Model model)
        {
            Url         = model.Url;
            Type        = model.Type;
            Title       = model.Title;
            Description = model.Description;
            Color       = model.Color.Value;
            Timestamp   = model.Timestamp.Value;

            if (model.Provider.IsSpecified)
            {
                Provider = new EmbedProvider(model.Provider.Value);
            }
            if (model.Provider.IsSpecified)
            {
                Provider = new EmbedProvider(model.Provider.Value);
            }
            if (model.Thumbnail.IsSpecified)
            {
                Thumbnail = new EmbedThumbnail(model.Thumbnail.Value);
            }
            if (model.Author.IsSpecified)
            {
                Author = new EmbedAuthor(model.Author.Value);
            }
            if (model.Image.IsSpecified)
            {
                Image = EmbedImage.Create(model.Image.Value);
            }
            if (model.Video.IsSpecified)
            {
                Video = EmbedVideo.Create(model.Video.Value);
            }
            if (model.Footer.IsSpecified)
            {
                Footer = new EmbedFooter(model.Footer.Value);
            }
            if (model.Fields.IsSpecified)
            {
                Fields = model.Fields.Value.Select(EmbedField.Create).ToImmutableArray();
            }
            else
            {
                Fields = ImmutableArray.Create <EmbedField>();
            }
        }