Add missing attachment fields

This commit is contained in:
Rory&
2026-08-23 16:41:37 +02:00
parent 74df883a44
commit a491279b67
4 changed files with 57 additions and 9 deletions
Binary file not shown.
Binary file not shown.
+39 -5
View File
@@ -16,12 +16,46 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { PartialUser } from "@spacebar/schemas";
export interface PublicAttachment {
filename: string; // name of file attached
size: number; // size of file in bytes
height?: number; // height of file (if image)
width?: number; // width of file (if image)
filename: string;
size: number;
content_type?: string;
url: string;
proxy_url: string;
proxy_url: string; // only relevant for images/video, but returns a 415 Unsupported Media Type for others, always included
description?: string; // alt text
flags?: AttachmentFlags;
// image metadata
height?: number;
width?: number;
// content scanning
content_scan_version?: number;
// thumbhash - https://github.com/evanw/thumbhash
placeholder_version?: number;
placeholder?: string;
// voice messages
duration_secs?: number;
waveform?: string; // base64 byte array
// clips
title?: string; // clips only? Documentation kinda sucks...
clip_created_at?: Date;
clip_participants?: PartialUser[];
// application?: PartialApplication[];
}
export enum AttachmentFlags {
IS_CLIP = 1 << 0,
IS_THUMBNAIL = 1 << 1,
IS_REMIX = 1 << 2,
IS_SPOILER = 1 << 3,
CONTAINS_EXPLICIT_MEDIA = 1 << 4,
IS_ANIMATED = 1 << 5,
CONTAINS_GORE_CONTENT = 1 << 6,
CONTAINS_SELF_HARM_CONTENT = 1 << 7,
}
@@ -19,14 +19,28 @@
import { Snowflake } from "../Identifiers";
import { InteractionType, AllowedMentions, MessageReference, ApplicationCommandType, BaseMessageComponents, Embed, PollAnswer, PollMedia, PublicUser } from "@spacebar/schemas";
export type MessageCreateAttachment = {
id: string;
export type BaseMessageCreateAttachment = {
filename: string;
title?: string; // clips only?
description?: string; // alt text
duration_secs?: number; //flat
waveform?: string; //base64 byte array
is_clip?: boolean;
is_thumbnail?: boolean;
is_remix?: boolean;
is_spoiler?: boolean;
clip_created_at?: Date;
clip_participant_ids?: Snowflake[];
};
export type MessageCreateCloudAttachment = {
export type MessageCreateAttachment = BaseMessageCreateAttachment & {
id: string;
};
export type MessageCreateCloudAttachment = BaseMessageCreateAttachment & {
id?: string;
filename: string;
uploaded_filename: string;
original_content_type?: string;
};