Пример #1
0
        /// <summary>
        /// Adds a select menu to a new action row
        /// </summary>
        /// <param name="customId">Unique ID for the select menu</param>
        /// <param name="placeholder">Text to display if no value is selected yet</param>
        /// <param name="minValues">The min number of options you must select</param>
        /// <param name="maxValues">The max number of options you can select</param>
        /// <param name="disabled">If the select menu should be disabled</param>
        /// <returns><see cref="SelectMenuComponentBuilder"/></returns>
        public SelectMenuComponentBuilder AddSelectMenu(string customId, string placeholder, int minValues = 1, int maxValues = 1, bool disabled = false)
        {
            if (string.IsNullOrEmpty(customId))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(customId));
            }

            UpdateActionRow <SelectMenuComponent>();
            SelectMenuComponent menu = new SelectMenuComponent
            {
                CustomId    = customId,
                Placeholder = placeholder,
                MinValues   = minValues,
                MaxValues   = maxValues,
                Disabled    = disabled
            };

            _current.Components.Add(menu);
            return(new SelectMenuComponentBuilder(menu, this));
        }
Пример #2
0
 internal SelectMenuComponentBuilder(SelectMenuComponent menu, MessageComponentBuilder builder)
 {
     _menu    = menu;
     _builder = builder;
 }