From a4ff9e9d41f05e7af3d7eb2debc186f6e1ad959e Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Fri, 13 Feb 2026 12:30:56 -0600 Subject: [PATCH] switch messages to base message type --- src/schemas/api/messages/Components.ts | 1 + src/schemas/responses/GuildMessagesSearchResponse.ts | 4 ++-- src/schemas/uncategorised/MessageCreateSchema.ts | 4 ++-- src/schemas/uncategorised/ThreadCreationSchema.ts | 4 ++-- src/util/entities/Message.ts | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/schemas/api/messages/Components.ts b/src/schemas/api/messages/Components.ts index 23d08957e..5fb888b5d 100644 --- a/src/schemas/api/messages/Components.ts +++ b/src/schemas/api/messages/Components.ts @@ -26,6 +26,7 @@ export interface ActionRowComponent extends MessageComponent { type: MessageComponentType.ActionRow; components: (ButtonComponent | StringSelectMenuComponent | SelectMenuComponent | TextInputComponent)[]; } +export type BaseMessageComponents = ActionRowComponent; export interface ButtonComponent extends MessageComponent { type: MessageComponentType.Button; diff --git a/src/schemas/responses/GuildMessagesSearchResponse.ts b/src/schemas/responses/GuildMessagesSearchResponse.ts index 555092ee2..8627b3fc2 100644 --- a/src/schemas/responses/GuildMessagesSearchResponse.ts +++ b/src/schemas/responses/GuildMessagesSearchResponse.ts @@ -18,7 +18,7 @@ // TODO: remove dependency on entities import { Attachment, Role } from "@spacebar/util"; -import { ActionRowComponent, Embed, MessageType, Poll, PublicUser } from "@spacebar/schemas"; +import { BaseMessageComponents, Embed, MessageType, Poll, PublicUser } from "@spacebar/schemas"; export interface GuildMessagesSearchMessage { id: string; @@ -36,7 +36,7 @@ export interface GuildMessagesSearchMessage { timestamp: string; edited_timestamp: string | null; flags: number; - components: ActionRowComponent[]; + components: BaseMessageComponents[]; poll: Poll; hit: true; } diff --git a/src/schemas/uncategorised/MessageCreateSchema.ts b/src/schemas/uncategorised/MessageCreateSchema.ts index f13132919..ae506ecc3 100644 --- a/src/schemas/uncategorised/MessageCreateSchema.ts +++ b/src/schemas/uncategorised/MessageCreateSchema.ts @@ -17,7 +17,7 @@ */ import { InteractionType, Snowflake } from "@spacebar/util"; -import { ActionRowComponent, ApplicationCommandType, Embed, PollAnswer, PollMedia, PublicUser } from "@spacebar/schemas"; +import { ApplicationCommandType, BaseMessageComponents, Embed, PollAnswer, PollMedia, PublicUser } from "@spacebar/schemas"; export type MessageCreateAttachment = { id: string; @@ -60,7 +60,7 @@ export interface MessageCreateSchema { // TODO: we should create an interface for attachments attachments?: (MessageCreateAttachment | MessageCreateCloudAttachment)[]; sticker_ids?: string[] | null; // null check: fixes Discord-Go - components?: ActionRowComponent[] | null; // null check: fixes Discord-Go + components?: BaseMessageComponents[] | null; // null check: fixes Discord-Go // TODO: Fix TypeScript errors in src\api\util\handlers\Message.ts once this is enabled poll?: PollCreationSchema; enforce_nonce?: boolean; // For Discord compatibility, it's the default behavior here diff --git a/src/schemas/uncategorised/ThreadCreationSchema.ts b/src/schemas/uncategorised/ThreadCreationSchema.ts index 1ad85ce75..76ed13851 100644 --- a/src/schemas/uncategorised/ThreadCreationSchema.ts +++ b/src/schemas/uncategorised/ThreadCreationSchema.ts @@ -16,7 +16,7 @@ along with this program. If not, see . */ -import { ActionRowComponent, ChannelType, Embed } from "#schemas/api"; +import { BaseMessageComponents, ChannelType, Embed } from "#schemas/api"; import { MessageActivity } from "./MessageActivity"; import { MessageCreateAttachment, MessageCreateCloudAttachment } from "./MessageCreateSchema"; @@ -37,7 +37,7 @@ export interface ThreadCreationSchema { users?: string[]; replied_user?: boolean; }; - components?: ActionRowComponent[] | null; + components?: BaseMessageComponents[] | null; sticker_ids?: string[]; activity?: MessageActivity; application_id?: string; diff --git a/src/util/entities/Message.ts b/src/util/entities/Message.ts index a4448a14a..05e7dea50 100644 --- a/src/util/entities/Message.ts +++ b/src/util/entities/Message.ts @@ -29,7 +29,7 @@ import { Webhook } from "./Webhook"; import { Sticker } from "./Sticker"; import { Attachment } from "./Attachment"; import { NewUrlUserSignatureData } from "../Signing"; -import { ActionRowComponent, ApplicationCommandType, Embed, MessageSnapshot, MessageType, PartialMessage, Poll, Reaction } from "@spacebar/schemas"; +import { ApplicationCommandType, BaseMessageComponents, Embed, MessageSnapshot, MessageType, PartialMessage, Poll, Reaction } from "@spacebar/schemas"; import { MessageFlags } from "@spacebar/util"; import { JsonRemoveEmpty } from "../util/Decorators"; @@ -209,7 +209,7 @@ export class Message extends BaseClass { @Column({ type: "simple-json", nullable: true }) @JsonRemoveEmpty - components?: ActionRowComponent[]; + components?: BaseMessageComponents[]; @Column({ type: "simple-json", nullable: true }) @JsonRemoveEmpty