mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 16:30:08 +00:00
* (transformers) return as Optionalize<typeof> * fix check error Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
22 lines
694 B
TypeScript
22 lines
694 B
TypeScript
import { Bot } from "../bot.ts";
|
|
import { DiscordAttachment } from "../types/discord.ts";
|
|
import { Optionalize } from "../types/shared.ts";
|
|
|
|
export function transformAttachment(bot: Bot, payload: DiscordAttachment) {
|
|
const attachment = {
|
|
id: bot.transformers.snowflake(payload.id),
|
|
filename: payload.filename,
|
|
contentType: payload.content_type,
|
|
size: payload.size,
|
|
url: payload.url,
|
|
proxyUrl: payload.proxy_url,
|
|
height: payload.height ?? undefined,
|
|
width: payload.width ?? undefined,
|
|
ephemeral: payload.ephemeral,
|
|
};
|
|
|
|
return attachment as Optionalize<typeof attachment>;
|
|
}
|
|
|
|
export interface Attachment extends ReturnType<typeof transformAttachment> {}
|