This commit is contained in:
Bxio 2025-04-27 03:16:25 +01:00
parent cde8b0e96a
commit 29e4d4cd32

View File

@ -1,5 +1,5 @@
// comandos/add.js // comandos/add.js
const { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, MessageFlags } = require('discord.js'); const { InteractionContextType, EmbedBuilder, PermissionFlagsBits, SlashCommandBuilder, MessageFlags } = require('discord.js');
const conn = require('../../../database/db'); // Ajusta o caminho const conn = require('../../../database/db'); // Ajusta o caminho
@ -53,10 +53,7 @@ module.exports = {
try { try {
// 1 - Verificar se já existe no banco // 1 - Verificar se já existe no banco
const [existing] = await conn.execute( const [existing] = await conn.execute(`SELECT * FROM users WHERE discord_id = ?`, [nome.id]);
`SELECT * FROM users WHERE discord_id = ?`,
[nome.id]
);
if (existing.length > 0) { if (existing.length > 0) {
return await interaction.editReply({ content: `❗ O membro ${nome.username} já está registrado no banco de dados.`, ephemeral: true }); return await interaction.editReply({ content: `❗ O membro ${nome.username} já está registrado no banco de dados.`, ephemeral: true });
@ -92,5 +89,23 @@ module.exports = {
console.error('❌ Erro ao adicionar o cargo:', error); console.error('❌ Erro ao adicionar o cargo:', error);
} }
const embed = new EmbedBuilder()
.setTitle('📋 Informações do Membro')
.setColor('Green')
.setDescription(`
\`\`\`
Nome | Cargo | ID
-------------------------------------------
${nome.username} | ${cargo} | ${nome.id}
\`\`\`
`)
.setFooter({ text: 'Adicionado à base de dados ✅' });
await interaction.editReply({ embeds: [embed] });
}, },
}; };