mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
chore: remove container limit (#10867)
* chore: remove container limit * fix: typo * fix: setValidationEnabled
This commit is contained in:
@@ -57,7 +57,7 @@ export function assertReturnOfBuilder<ReturnType extends MediaGalleryItemBuilder
|
|||||||
input: unknown,
|
input: unknown,
|
||||||
ExpectedInstanceOf: new () => ReturnType,
|
ExpectedInstanceOf: new () => ReturnType,
|
||||||
): asserts input is ReturnType {
|
): asserts input is ReturnType {
|
||||||
s.instance(ExpectedInstanceOf).parse(input);
|
s.instance(ExpectedInstanceOf).setValidationEnabled(isValidationEnabled).parse(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function validateComponentArray<
|
export function validateComponentArray<
|
||||||
@@ -67,5 +67,6 @@ export function validateComponentArray<
|
|||||||
.array()
|
.array()
|
||||||
.lengthGreaterThanOrEqual(min)
|
.lengthGreaterThanOrEqual(min)
|
||||||
.lengthLessThanOrEqual(max)
|
.lengthLessThanOrEqual(max)
|
||||||
|
.setValidationEnabled(isValidationEnabled)
|
||||||
.parse(input);
|
.parse(input);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import type { AnyComponentBuilder, MessageActionRowComponentBuilder } from '../A
|
|||||||
import { ActionRowBuilder } from '../ActionRow.js';
|
import { ActionRowBuilder } from '../ActionRow.js';
|
||||||
import { ComponentBuilder } from '../Component.js';
|
import { ComponentBuilder } from '../Component.js';
|
||||||
import { createComponentBuilder, resolveBuilder } from '../Components.js';
|
import { createComponentBuilder, resolveBuilder } from '../Components.js';
|
||||||
import { containerColorPredicate, spoilerPredicate, validateComponentArray } from './Assertions.js';
|
import { containerColorPredicate, spoilerPredicate } from './Assertions.js';
|
||||||
import { FileBuilder } from './File.js';
|
import { FileBuilder } from './File.js';
|
||||||
import { SeparatorBuilder } from './Separator.js';
|
import { SeparatorBuilder } from './Separator.js';
|
||||||
import { TextDisplayBuilder } from './TextDisplay.js';
|
import { TextDisplayBuilder } from './TextDisplay.js';
|
||||||
@@ -231,7 +231,6 @@ export class ContainerBuilder extends ComponentBuilder<APIContainerComponent> {
|
|||||||
* {@inheritDoc ComponentBuilder.toJSON}
|
* {@inheritDoc ComponentBuilder.toJSON}
|
||||||
*/
|
*/
|
||||||
public toJSON(): APIContainerComponent {
|
public toJSON(): APIContainerComponent {
|
||||||
validateComponentArray(this.components, 1, 10);
|
|
||||||
return {
|
return {
|
||||||
...this.data,
|
...this.data,
|
||||||
components: this.components.map((component) => component.toJSON()),
|
components: this.components.map((component) => component.toJSON()),
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export class ThumbnailBuilder extends ComponentBuilder<APIThumbnailComponent> {
|
|||||||
* @example
|
* @example
|
||||||
* Creating a thumbnail from an API data object:
|
* Creating a thumbnail from an API data object:
|
||||||
* ```ts
|
* ```ts
|
||||||
* const thumbnaik = new ThumbnailBuilder({
|
* const thumbnail = new ThumbnailBuilder({
|
||||||
* description: 'some text',
|
* description: 'some text',
|
||||||
* media: {
|
* media: {
|
||||||
* url: 'https://cdn.discordapp.com/embed/avatars/4.png',
|
* url: 'https://cdn.discordapp.com/embed/avatars/4.png',
|
||||||
|
|||||||
Reference in New Issue
Block a user