fix colors for embeds

This commit is contained in:
Ryan Cao 2022-07-26 22:33:16 +08:00
parent 7c0b91e1be
commit 5a7d5f3467
No known key found for this signature in database
GPG key ID: 528A2C1B6656B97F
3 changed files with 25 additions and 10 deletions

View file

@ -36,9 +36,17 @@ interface Tag {
}
export const getTags = async (): Promise<Tag[]> => {
return JSON.parse(
const raw = JSON.parse(
await readFile(join(__dirname, 'tags.json'), { encoding: 'utf8' })
);
) as Tag[];
return raw.map((tag) => {
if (tag.embed?.color) {
tag.embed.color = BuildConfig.COLORS[tag.embed.color];
}
return tag;
});
};
const client = new Client({
@ -123,7 +131,7 @@ async function parseMsgForCommands(e: Message) {
} catch (err: unknown) {
const em = new EmbedBuilder()
.setTitle('Error')
.setColor('Red')
.setColor(BuildConfig.COLORS.red)
// @ts-expect-error no why
.setDescription(err['message'] as string);