refactor(tags): pull embed options to top level and adopt embed images

This commit is contained in:
Ryan Cao 2023-05-14 17:49:51 +08:00
parent 845f79fe9b
commit 8e279ae5cf
No known key found for this signature in database
18 changed files with 78 additions and 102 deletions

View file

@ -24,17 +24,15 @@ export const tagsCommand = async (
return;
}
const embed = new EmbedBuilder();
embed.setTitle(tag.title ?? tag.name);
embed.setDescription(tag.content);
if (tag.color) embed.setColor(tag.color);
if (tag.image) embed.setImage(tag.image);
if (tag.fields) embed.setFields(tag.fields);
await i.reply({
content:
(mention ? `<@${mention.id}> ` : '') +
(tag.text ? `**${tag.name}**\n\n` + tag.text : ''),
embeds: tag.embed
? [
new EmbedBuilder(tag.embed).setFooter({
text: `Requested by ${i.user.tag}`,
iconURL: i.user.avatarURL() ?? undefined,
}),
]
: [],
content: mention ? `<@${mention.id}> ` : undefined,
embeds: [embed],
});
};