예제 #1
0
        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>);
        }
예제 #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);
        }