feat(types,bot): Add attachment_id to UnfurledMediaItem (#4223)

* feat(types,bot): Add attachment_id to UnfurledMediaItem

* fix ci

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
This commit is contained in:
Fleny
2025-06-13 15:23:59 +02:00
committed by GitHub
parent adc10e3b28
commit 2f06b95f37
5 changed files with 8 additions and 1 deletions

View File

@@ -637,6 +637,7 @@ export function createDesiredPropertiesObject<T extends RecursivePartial<Transfo
height: defaultValue,
width: defaultValue,
contentType: defaultValue,
attachmentId: defaultValue,
...desiredProperties.unfurledMediaItem,
},
user: {

View File

@@ -78,6 +78,7 @@ export function transformUnfurledMediaItem(bot: Bot, payload: DiscordUnfurledMed
if (props.height && payload.height) mediaItem.height = payload.height
if (props.width && payload.width) mediaItem.width = payload.width
if (props.contentType && payload.content_type) mediaItem.contentType = payload.content_type
if (props.attachmentId && payload.attachment_id) mediaItem.attachmentId = bot.transformers.snowflake(payload.attachment_id)
return bot.transformers.customizers.unfurledMediaItem(bot, payload, mediaItem)
}

View File

@@ -50,13 +50,14 @@ export function transformComponentToDiscordComponent(bot: Bot, payload: Componen
}
}
export function transformUnfurledMediaItemToDiscordUnfurledMediaItem(_bot: Bot, payload: UnfurledMediaItem): DiscordUnfurledMediaItem {
export function transformUnfurledMediaItemToDiscordUnfurledMediaItem(bot: Bot, payload: UnfurledMediaItem): DiscordUnfurledMediaItem {
return {
url: payload.url,
proxy_url: payload.proxyUrl,
height: payload.height,
width: payload.width,
content_type: payload.contentType,
attachment_id: payload.attachmentId ? bot.transformers.reverse.snowflake(payload.attachmentId) : undefined,
}
}

View File

@@ -583,6 +583,8 @@ export interface UnfurledMediaItem {
width?: number | null
/** The media type of the content. This field is ignored and provided by the API as part of the response */
contentType?: string
/** The id of the uploaded attachment. Only present if the media was uploaded as an attachment. This field is ignored and provided by the API as part of the response */
attachmentId?: bigint
}
export interface MediaGalleryItem {

View File

@@ -345,4 +345,6 @@ export interface DiscordUnfurledMediaItem {
width?: number | null
/** The media type of the content. This field is ignored and provided by the API as part of the response */
content_type?: string
/** The id of the uploaded attachment. Only present if the media was uploaded as an attachment. This field is ignored and provided by the API as part of the response */
attachment_id?: string | null
}