Fix showing example image of commands

This commit is contained in:
Supositware 2022-08-31 23:03:10 +02:00
parent 4846604fdf
commit a73fd2b893

View file

@ -1,4 +1,4 @@
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js'; import { SlashCommandBuilder, EmbedBuilder, AttachmentBuilder } from 'discord.js';
import fs from 'node:fs'; import fs from 'node:fs';
const { ownerId, prefix } = process.env; const { ownerId, prefix } = process.env;
@ -66,8 +66,9 @@ export default {
} }
if (fs.existsSync(`./asset/img/command/${command.category}/${command.data.name}.png`)) { if (fs.existsSync(`./asset/img/command/${command.category}/${command.data.name}.png`)) {
embed.attachFiles(`./asset/img/command/${command.category}/${command.data.name}.png`); const file = new AttachmentBuilder(`./asset/img/command/${command.category}/${command.data.name}.png`);
embed.setImage(`attachment://${command.data.name}.png`); embed.setImage(`attachment://${command.data.name}.png`);
return interaction.reply({ embeds: [embed], files: [file] });
} }
return interaction.reply({ embeds: [embed] }); return interaction.reply({ embeds: [embed] });
} }