Esempio n. 1
0
        /// <summary>
        ///     Adds text components to <see cref="TextComponents"/>.
        /// </summary>
        /// <param name="configure">Text Component builder factory.</param>
        /// <returns>
        ///     The builder instance.
        /// </returns>
        public ModalBuilder AddTextComponent(Action <TextInputComponentBuilder> configure)
        {
            var builder = new TextInputComponentBuilder(this);

            configure(builder);
            _components.Add(builder);
            return(this);
        }
Esempio n. 2
0
 internal ModalInfo(Builders.ModalBuilder builder)
 {
     Title      = builder.Title;
     Type       = builder.Type;
     Components = builder.Components.Select(x => x switch
     {
         Builders.TextInputComponentBuilder textComponent => textComponent.Build(this),
         _ => throw new InvalidOperationException($"{x.GetType().FullName} isn't a supported modal input component builder type.")
     }).ToImmutableArray();