feat(bot,types): Add name and size to FileComponent (#4224)

* feat(bot,types): Add name and size to FileComponent

* fix ci

* more fix ci

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
This commit is contained in:
Fleny
2025-06-13 15:29:53 +02:00
committed by GitHub
parent 2f06b95f37
commit f500c00434
6 changed files with 18 additions and 0 deletions

View File

@@ -317,6 +317,8 @@ export function createDesiredPropertiesObject<T extends RecursivePartial<Transfo
file: defaultValue,
media: defaultValue,
accentColor: defaultValue,
name: defaultValue,
size: defaultValue,
...desiredProperties.component,
},
forumTag: {

View File

@@ -232,6 +232,8 @@ function transformFileComponent(bot: Bot, payload: DiscordFileComponent): Compon
if (props.id && payload.id) file.id = payload.id
if (props.file && payload.file) file.file = bot.transformers.unfurledMediaItem(bot, payload.file)
if (props.spoiler && payload.spoiler) file.spoiler = payload.spoiler
if (props.name && payload.name) file.name = payload.name
if (props.size && payload.size) file.size = payload.size
return file
}

View File

@@ -171,6 +171,8 @@ function transformFileComponent(bot: Bot, payload: Component): DiscordFileCompon
id: payload.id,
file: bot.transformers.reverse.unfurledMediaItem(bot, payload.file!),
spoiler: payload.spoiler,
name: payload.name!,
size: payload.size!,
}
}

View File

@@ -570,6 +570,10 @@ export interface Component {
media?: UnfurledMediaItem
/** Color for the accent on the container as RGB from 0x000000 to 0xFFFFFF */
accentColor?: number
/** The name of the file. This field is ignored and provided by the API as part of the response */
name?: string
/** The size of the file in bytes. This field is ignored and provided by the API as part of the response */
size?: number
}
export interface UnfurledMediaItem {

View File

@@ -296,6 +296,10 @@ export interface DiscordFileComponent extends DiscordBaseComponent {
file: DiscordUnfurledMediaItem
/** Whether the media should be a spoiler (or blurred out). Defaults to `false` */
spoiler?: boolean
/** The name of the file. This field is ignored and provided by the API as part of the response */
name: string
/** The size of the file in bytes. This field is ignored and provided by the API as part of the response */
size: number
}
/** https://discord.com/developers/docs/components/reference#separator-separator-structure */

View File

@@ -383,6 +383,10 @@ export interface FileComponent extends BaseComponent {
file: DiscordUnfurledMediaItem
/** Whether the media should be a spoiler (or blurred out). Defaults to `false` */
spoiler?: boolean
/** The name of the file. This field is ignored and provided by the API as part of the response */
name: string
/** The size of the file in bytes. This field is ignored and provided by the API as part of the response */
size: number
}
/** https://discord.com/developers/docs/components/reference#separator */