mirror of
https://github.com/discordjs/discord.js.git
synced 2026-05-23 12:00:09 +00:00
Compare commits
2 Commits
@discordjs
...
@discordjs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93cf7721d0 | ||
|
|
e6370ae378 |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@discordjs/builders",
|
||||
"version": "1.11.1",
|
||||
"version": "1.11.2",
|
||||
"description": "A set of builders that you can use when creating your bot",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
|
||||
@@ -57,7 +57,7 @@ export function assertReturnOfBuilder<ReturnType extends MediaGalleryItemBuilder
|
||||
input: unknown,
|
||||
ExpectedInstanceOf: new () => ReturnType,
|
||||
): asserts input is ReturnType {
|
||||
s.instance(ExpectedInstanceOf).parse(input);
|
||||
s.instance(ExpectedInstanceOf).setValidationEnabled(isValidationEnabled).parse(input);
|
||||
}
|
||||
|
||||
export function validateComponentArray<
|
||||
@@ -67,5 +67,6 @@ export function validateComponentArray<
|
||||
.array()
|
||||
.lengthGreaterThanOrEqual(min)
|
||||
.lengthLessThanOrEqual(max)
|
||||
.setValidationEnabled(isValidationEnabled)
|
||||
.parse(input);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import type { AnyComponentBuilder, MessageActionRowComponentBuilder } from '../A
|
||||
import { ActionRowBuilder } from '../ActionRow.js';
|
||||
import { ComponentBuilder } from '../Component.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 { SeparatorBuilder } from './Separator.js';
|
||||
import { TextDisplayBuilder } from './TextDisplay.js';
|
||||
@@ -231,7 +231,6 @@ export class ContainerBuilder extends ComponentBuilder<APIContainerComponent> {
|
||||
* {@inheritDoc ComponentBuilder.toJSON}
|
||||
*/
|
||||
public toJSON(): APIContainerComponent {
|
||||
validateComponentArray(this.components, 1, 10);
|
||||
return {
|
||||
...this.data,
|
||||
components: this.components.map((component) => component.toJSON()),
|
||||
|
||||
@@ -11,7 +11,7 @@ export class ThumbnailBuilder extends ComponentBuilder<APIThumbnailComponent> {
|
||||
* @example
|
||||
* Creating a thumbnail from an API data object:
|
||||
* ```ts
|
||||
* const thumbnaik = new ThumbnailBuilder({
|
||||
* const thumbnail = new ThumbnailBuilder({
|
||||
* description: 'some text',
|
||||
* media: {
|
||||
* url: 'https://cdn.discordapp.com/embed/avatars/4.png',
|
||||
|
||||
Reference in New Issue
Block a user