fix(typo): Builders

This commit is contained in:
socram03 2022-07-13 18:56:36 -04:00
parent 161f0fc4ce
commit c81691daa4
5 changed files with 14 additions and 9 deletions

View File

@ -8,6 +8,7 @@ import type {
FileContent, FileContent,
MessageActivityTypes, MessageActivityTypes,
MessageTypes, MessageTypes,
DiscordMessageComponents
} from "../../discordeno/mod.ts"; } from "../../discordeno/mod.ts";
import type { Component } from "./components/Component.ts"; import type { Component } from "./components/Component.ts";
import type { GetReactions } from "../Routes.ts"; import type { GetReactions } from "../Routes.ts";
@ -20,7 +21,6 @@ import Member from "./Member.ts";
import Attachment from "./Attachment.ts"; import Attachment from "./Attachment.ts";
import ComponentFactory from "./components/ComponentFactory.ts"; import ComponentFactory from "./components/ComponentFactory.ts";
import MessageReaction from "./MessageReaction.ts"; import MessageReaction from "./MessageReaction.ts";
import Sticker from "./Sticker.ts";
import * as Routes from "../Routes.ts"; import * as Routes from "../Routes.ts";
import { StickerItem } from "./Sticker.ts"; import { StickerItem } from "./Sticker.ts";
@ -51,6 +51,7 @@ export interface CreateMessage {
files?: FileContent[]; files?: FileContent[];
messageReference?: CreateMessageReference; messageReference?: CreateMessageReference;
tts?: boolean; tts?: boolean;
components?: DiscordMessageComponents;
} }
/** /**
@ -290,6 +291,7 @@ export class Message implements Model {
: undefined, : undefined,
embeds: options.embeds, embeds: options.embeds,
tts: options.tts, tts: options.tts,
components: options.components,
}, },
); );

View File

@ -43,7 +43,7 @@ export class InputTextBuilder {
this.#data.required = required; this.#data.required = required;
return this; return this;
} }
toJSON() { toJSON(): DiscordInputTextComponent {
return { ...this.#data }; return { ...this.#data, type: this.type };
} }
} }

View File

@ -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"; import type { ComponentBuilder } from "../../Util.ts";
export class ActionRowBuilder<T extends ComponentBuilder> { export class ActionRowBuilder<T extends ComponentBuilder> {
@ -23,7 +23,10 @@ export class ActionRowBuilder<T extends ComponentBuilder> {
return this; return this;
} }
toJSON() { toJSON(): DiscordActionRow {
return { type: this.type, components: this.components.map((c) => c.toJSON()) }; return {
type: this.type,
components: this.components.map((c) => c.toJSON()) as DiscordActionRow["components"],
};
} }
} }

View File

@ -39,6 +39,6 @@ export class ButtonBuilder {
} }
toJSON(): DiscordButtonComponent { toJSON(): DiscordButtonComponent {
return { ...this.#data }; return { ...this.#data, type: this.type };
} }
} }

View File

@ -47,7 +47,7 @@ export class SelectMenuBuilder {
); );
} }
toJSON() { toJSON(): DiscordSelectMenuComponent {
return { ...this.#data, options: this.options.map((option) => option.toJSON()) }; return { ...this.#data, type: this.type, options: this.options.map((option) => option.toJSON()) };
} }
} }