mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 16:30:08 +00:00
fix: use embed reverse transformer
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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()),
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user