diff --git a/packages/biscuit/structures/Message.ts b/packages/biscuit/structures/Message.ts index 7f0b8ad..251a3b1 100644 --- a/packages/biscuit/structures/Message.ts +++ b/packages/biscuit/structures/Message.ts @@ -8,6 +8,7 @@ import type { FileContent, MessageActivityTypes, MessageTypes, + DiscordMessageComponents } from "../../discordeno/mod.ts"; import type { Component } from "./components/Component.ts"; import type { GetReactions } from "../Routes.ts"; @@ -20,7 +21,6 @@ import Member from "./Member.ts"; import Attachment from "./Attachment.ts"; import ComponentFactory from "./components/ComponentFactory.ts"; import MessageReaction from "./MessageReaction.ts"; -import Sticker from "./Sticker.ts"; import * as Routes from "../Routes.ts"; import { StickerItem } from "./Sticker.ts"; @@ -51,6 +51,7 @@ export interface CreateMessage { files?: FileContent[]; messageReference?: CreateMessageReference; tts?: boolean; + components?: DiscordMessageComponents; } /** @@ -290,6 +291,7 @@ export class Message implements Model { : undefined, embeds: options.embeds, tts: options.tts, + components: options.components, }, ); diff --git a/packages/biscuit/structures/builders/InputTextComponentBuilder.ts b/packages/biscuit/structures/builders/InputTextComponentBuilder.ts index b4c7e98..71e7521 100644 --- a/packages/biscuit/structures/builders/InputTextComponentBuilder.ts +++ b/packages/biscuit/structures/builders/InputTextComponentBuilder.ts @@ -43,7 +43,7 @@ export class InputTextBuilder { this.#data.required = required; return this; } - toJSON() { - return { ...this.#data }; + toJSON(): DiscordInputTextComponent { + return { ...this.#data, type: this.type }; } } diff --git a/packages/biscuit/structures/builders/MessageActionRow.ts b/packages/biscuit/structures/builders/MessageActionRow.ts index 262f2fc..237f6fa 100644 --- a/packages/biscuit/structures/builders/MessageActionRow.ts +++ b/packages/biscuit/structures/builders/MessageActionRow.ts @@ -1,4 +1,4 @@ -import type { MessageComponentTypes } from "../../../discordeno/mod.ts"; +import type { DiscordActionRow, MessageComponentTypes } from "../../../discordeno/mod.ts"; import type { ComponentBuilder } from "../../Util.ts"; export class ActionRowBuilder { @@ -23,7 +23,10 @@ export class ActionRowBuilder { return this; } - toJSON() { - return { type: this.type, components: this.components.map((c) => c.toJSON()) }; + toJSON(): DiscordActionRow { + return { + type: this.type, + components: this.components.map((c) => c.toJSON()) as DiscordActionRow["components"], + }; } } diff --git a/packages/biscuit/structures/builders/MessageButton.ts b/packages/biscuit/structures/builders/MessageButton.ts index 943012b..3b96bb9 100644 --- a/packages/biscuit/structures/builders/MessageButton.ts +++ b/packages/biscuit/structures/builders/MessageButton.ts @@ -39,6 +39,6 @@ export class ButtonBuilder { } toJSON(): DiscordButtonComponent { - return { ...this.#data }; + return { ...this.#data, type: this.type }; } } diff --git a/packages/biscuit/structures/builders/MessageSelectMenu.ts b/packages/biscuit/structures/builders/MessageSelectMenu.ts index b8f1229..0b3c1db 100644 --- a/packages/biscuit/structures/builders/MessageSelectMenu.ts +++ b/packages/biscuit/structures/builders/MessageSelectMenu.ts @@ -47,7 +47,7 @@ export class SelectMenuBuilder { ); } - toJSON() { - return { ...this.#data, options: this.options.map((option) => option.toJSON()) }; + toJSON(): DiscordSelectMenuComponent { + return { ...this.#data, type: this.type, options: this.options.map((option) => option.toJSON()) }; } }