protected LocalSlashCommandOption(LocalSlashCommandOption other)
        {
            Guard.IsNotNull(other);

            Type         = other.Type;
            Name         = other.Name;
            Description  = other.Description;
            IsRequired   = other.IsRequired;
            Choices      = Optional.Convert(other.Choices, choices => choices?.Select(choice => choice?.Clone()).ToList() as IList <LocalSlashCommandOptionChoice>);
            Options      = Optional.Convert(other.Options, options => options?.Select(option => option?.Clone()).ToList() as IList <LocalSlashCommandOption>);
            ChannelTypes = Optional.Convert(other.ChannelTypes, channelTypes => channelTypes?.ToList() as IList <ChannelType>);
        }
Esempio n. 2
0
        public static TSlashCommand AddOption <TSlashCommand>(this TSlashCommand @this, LocalSlashCommandOption option)
            where TSlashCommand : LocalSlashCommand
        {
            Guard.IsNotNull(option);

            if ([email protected](option, out var list))
            {
                @this.Options = new(list);
            }

            return(@this);
        }