Update message schema to handle cloud attachments

This commit is contained in:
Rory& 2025-09-23 23:25:08 +02:00
parent c167a7b541
commit db765d8ff0
3 changed files with 5 additions and 7 deletions

View File

@ -93,6 +93,7 @@ router.post(
id: a.userAttachmentId,
upload_filename: a.uploadFilename,
upload_url: `${cdnUrl}/attachments/${a.uploadFilename}`,
original_content_type: a.userOriginalContentType
}
})} as UploadAttachmentResponseSchema);
},

View File

@ -16,12 +16,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {
ActionRowComponent,
Embed,
PollAnswer,
PollMedia,
} from "@spacebar/util";
import { ActionRowComponent, Embed, PollAnswer, PollMedia, UploadAttachmentResponse } from "@spacebar/util";
import { CloudAttachment } from "../entities/CloudAttachment";
export type MessageCreateAttachment = {
id: string;
@ -57,7 +53,7 @@ export interface MessageCreateSchema {
TODO: we should create an interface for attachments
TODO: OpenWAAO<-->attachment-style metadata conversion
**/
attachments?: MessageCreateAttachment[];
attachments?: (MessageCreateAttachment | UploadAttachmentResponse)[];
sticker_ids?: string[];
components?: ActionRowComponent[];
// TODO: Fix TypeScript errors in src\api\util\handlers\Message.ts once this is enabled

View File

@ -25,4 +25,5 @@ export interface UploadAttachmentResponse {
id?: string;
upload_url: string;
upload_filename: string;
original_content_type?: string;
}