diff --git a/helpers/interactions/sendInteractionResponse.ts b/helpers/interactions/sendInteractionResponse.ts index e37655cb6..f75dcbe6a 100644 --- a/helpers/interactions/sendInteractionResponse.ts +++ b/helpers/interactions/sendInteractionResponse.ts @@ -25,55 +25,7 @@ export async function sendInteractionResponse( const data = { content: options.data.content, tts: options.data.tts, - embeds: options.data.embeds?.map((embed) => ({ - title: embed.title, - type: embed.type, - description: embed.description, - url: embed.url, - timestamp: embed.timestamp, - color: embed.color, - footer: embed.footer - ? { - text: embed.footer.text, - icon_url: embed.footer.iconUrl, - proxy_icon_url: embed.footer.proxyIconUrl, - } - : undefined, - image: embed.image - ? { - url: embed.image.url, - proxy_url: embed.image.proxyUrl, - height: embed.image.height, - width: embed.image.width, - } - : undefined, - thumbnail: embed.thumbnail - ? { - url: embed.thumbnail.url, - proxy_url: embed.thumbnail.proxyUrl, - height: embed.thumbnail.height, - width: embed.thumbnail.width, - } - : undefined, - video: embed.video - ? { - url: embed.video.url, - proxy_url: embed.video.proxyUrl, - height: embed.video.height, - width: embed.video.width, - } - : undefined, - provider: embed.provider, - author: embed.author - ? { - name: embed.author.name, - url: embed.author.url, - icon_url: embed.author.iconUrl, - proxy_icon_url: embed.author.proxyIconUrl, - } - : undefined, - fields: embed.fields, - })), + embeds: options.data.embeds?.map((embed) => bot.transformers.reverse.embed(bot, embed)), allowed_mentions: { parse: options.data.allowedMentions!.parse, replied_user: options.data.allowedMentions!.repliedUser, diff --git a/helpers/messages/editMessage.ts b/helpers/messages/editMessage.ts index 28a7081fd..442d60947 100644 --- a/helpers/messages/editMessage.ts +++ b/helpers/messages/editMessage.ts @@ -13,55 +13,7 @@ export async function editMessage(bot: Bot, channelId: bigint, messageId: bigint bot.constants.endpoints.CHANNEL_MESSAGE(channelId, messageId), { content: content.content, - embeds: content.embeds?.map((embed) => ({ - title: embed.title, - type: embed.type, - description: embed.description, - url: embed.url, - timestamp: embed.timestamp ? new Date(embed.timestamp).toISOString() : undefined, - color: embed.color, - footer: embed.footer - ? { - text: embed.footer.text, - icon_url: embed.footer.iconUrl, - proxy_icon_url: embed.footer.proxyIconUrl, - } - : undefined, - image: embed.image - ? { - url: embed.image.url, - proxy_url: embed.image.proxyUrl, - height: embed.image.height, - width: embed.image.width, - } - : undefined, - thumbnail: embed.thumbnail - ? { - url: embed.thumbnail.url, - proxy_url: embed.thumbnail.proxyUrl, - height: embed.thumbnail.height, - width: embed.thumbnail.width, - } - : undefined, - video: embed.video - ? { - url: embed.video.url, - proxy_url: embed.video.proxyUrl, - height: embed.video.height, - width: embed.video.width, - } - : undefined, - provider: embed.provider, - author: embed.author - ? { - name: embed.author.name, - url: embed.author.url, - icon_url: embed.author.iconUrl, - proxy_icon_url: embed.author.proxyIconUrl, - } - : undefined, - fields: embed.fields, - })), + embeds: content.embeds?.map((embed) => bot.transformers.reverse.embed(bot, embed)), allowed_mentions: { parse: content.allowedMentions?.parse, roles: content.allowedMentions?.roles?.map((id) => id.toString()), diff --git a/helpers/messages/sendMessage.ts b/helpers/messages/sendMessage.ts index c14c2bf4d..9e99d471a 100644 --- a/helpers/messages/sendMessage.ts +++ b/helpers/messages/sendMessage.ts @@ -13,55 +13,7 @@ export async function sendMessage(bot: Bot, channelId: bigint, content: CreateMe { content: content.content, tts: content.tts, - embeds: content.embeds?.map((embed) => ({ - title: embed.title, - type: embed.type, - description: embed.description, - url: embed.url, - timestamp: embed.timestamp, - color: embed.color, - footer: embed.footer - ? { - text: embed.footer.text, - icon_url: embed.footer.iconUrl, - proxy_icon_url: embed.footer.proxyIconUrl, - } - : undefined, - image: embed.image - ? { - url: embed.image.url, - proxy_url: embed.image.proxyUrl, - height: embed.image.height, - width: embed.image.width, - } - : undefined, - thumbnail: embed.thumbnail - ? { - url: embed.thumbnail.url, - proxy_url: embed.thumbnail.proxyUrl, - height: embed.thumbnail.height, - width: embed.thumbnail.width, - } - : undefined, - video: embed.video - ? { - url: embed.video.url, - proxy_url: embed.video.proxyUrl, - height: embed.video.height, - width: embed.video.width, - } - : undefined, - provider: embed.provider, - author: embed.author - ? { - name: embed.author.name, - url: embed.author.url, - icon_url: embed.author.iconUrl, - proxy_icon_url: embed.author.proxyIconUrl, - } - : undefined, - fields: embed.fields, - })), + embeds: content.embeds?.map((embed) => bot.transformers.reverse.embed(bot, embed)), allowed_mentions: content.allowedMentions ? { parse: content.allowedMentions?.parse,