mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 17:00:08 +00:00
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:
@@ -637,6 +637,7 @@ export function createDesiredPropertiesObject<T extends RecursivePartial<Transfo
|
||||
height: defaultValue,
|
||||
width: defaultValue,
|
||||
contentType: defaultValue,
|
||||
attachmentId: defaultValue,
|
||||
...desiredProperties.unfurledMediaItem,
|
||||
},
|
||||
user: {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user