diff --git a/package.json b/package.json index b5c9e08..b4d2068 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "seyfert", - "version": "3.1.0", + "version": "3.1.1", "description": "The most advanced framework for discord bots", "main": "./lib/index.js", "module": "./lib/index.js", diff --git a/src/builders/TextDisplay.ts b/src/builders/TextDisplay.ts index 93bf73b..f2c809c 100644 --- a/src/builders/TextDisplay.ts +++ b/src/builders/TextDisplay.ts @@ -1,4 +1,4 @@ -import { type APITextDispalyComponent, ComponentType } from '../types'; +import { type APITextDisplayComponent, ComponentType } from '../types'; import { BaseComponentBuilder } from './Base'; /** @@ -9,12 +9,12 @@ import { BaseComponentBuilder } from './Base'; * const text = new TextDisplay().content('Hello, world!'); * ``` */ -export class TextDisplay extends BaseComponentBuilder { +export class TextDisplay extends BaseComponentBuilder { /** * Constructs a new TextDisplay component. * @param data Optional initial data for the text display component. */ - constructor(data: Partial = {}) { + constructor(data: Partial = {}) { super({ type: ComponentType.TextDisplay, ...data }); } diff --git a/src/common/types/write.ts b/src/common/types/write.ts index edbef6e..6635330 100644 --- a/src/common/types/write.ts +++ b/src/common/types/write.ts @@ -17,7 +17,7 @@ import type { OmitInsert } from './util'; export interface ResolverProps { embeds?: Embed[] | APIEmbed[] | undefined; - components?: TopLevelBuilders[]; + components?: TopLevelBuilders[] | ReturnType[]; files?: AttachmentBuilder[] | Attachment[] | RawFile[] | undefined; } diff --git a/src/components/BaseComponent.ts b/src/components/BaseComponent.ts index 72258c1..c78c572 100644 --- a/src/components/BaseComponent.ts +++ b/src/components/BaseComponent.ts @@ -29,7 +29,7 @@ import { type APISectionComponent, type APISeparatorComponent, type APIStringSelectComponent, - type APITextDispalyComponent, + type APITextDisplayComponent, type APITextInputComponent, type APIThumbnailComponent, type APIUserSelectComponent, @@ -66,7 +66,7 @@ export interface APIComponentsMap { [ComponentType.Container]: APIContainerComponent; [ComponentType.MediaGallery]: APIMediaGalleryComponent; [ComponentType.Separator]: APISeparatorComponent; - [ComponentType.TextDisplay]: APITextDispalyComponent; + [ComponentType.TextDisplay]: APITextDisplayComponent; } export interface BuilderComponentsMap { diff --git a/src/structures/Interaction.ts b/src/structures/Interaction.ts index a2407a3..05281fa 100644 --- a/src/structures/Interaction.ts +++ b/src/structures/Interaction.ts @@ -196,7 +196,7 @@ export class BaseInteraction< poll: poll ? (poll instanceof PollBuilder ? poll.toJSON() : poll) : undefined, }; - if ('attachments' in body) { + if (Array.isArray(body.attachments)) { payload.attachments = body.attachments?.map((x, i) => ({ id: x.id ?? i.toString(), diff --git a/src/types/payloads/components.ts b/src/types/payloads/components.ts index a5c7214..55024c8 100644 --- a/src/types/payloads/components.ts +++ b/src/types/payloads/components.ts @@ -448,7 +448,7 @@ export interface APISectionComponent { /** Optional identifier for component */ id?: number; /** One to three text components */ - components: APITextDispalyComponent[]; + components: APITextDisplayComponent[]; /** A thumbnail or a button component, with a future possibility of adding more compatible components */ accessory: APIButtonComponent | APIThumbnailComponent; } @@ -459,7 +459,7 @@ export interface APISectionComponent { * A Text Display is a top-level content component that allows you to add text to your message formatted with markdown and mention users and roles. This is similar to the content field of a message, but allows you to add multiple text components, controlling the layout of your message. * Text Displays are only available in messages. */ -export interface APITextDispalyComponent { +export interface APITextDisplayComponent { /** 10 for text display */ type: ComponentType.TextDisplay; /** Optional identifier for component */ @@ -553,7 +553,7 @@ export enum Spacing { export type APIContainerComponents = | APIActionRowComponent - | APITextDispalyComponent + | APITextDisplayComponent | APISectionComponent | APIMediaGalleryComponent | APIFileComponent @@ -591,4 +591,4 @@ export type APITopLevelComponent = | APIMediaGalleryComponent | APISectionComponent | APISeparatorComponent - | APITextDispalyComponent; + | APITextDisplayComponent;