This commit is contained in:
Bxio 2025-04-27 13:49:41 +01:00
parent 29e4d4cd32
commit 53f9be3042

View File

@ -59,23 +59,19 @@ module.exports = {
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 });
} }
// 2 - Inserir no banco // 2 - Inserir no banco
await conn.execute( await conn.execute(
`INSERT INTO users (discord_id, discord_avatar, discord_username, cargo, level) VALUES (?, ?, ?, ?, ?)`, `INSERT INTO users (discord_id, discord_avatar, discord_username, cargo, level) VALUES (?, ?, ?, ?, ?)`,
[nome.id, idavatar,nome.username, cargo, "0"] [nome.id, idavatar,nome.username, cargo, "0"]
); );
} catch (error) { } catch (error) {
console.error(error); console.error(error);
await interaction.editReply({ content: '❌ Erro ao adicionar membro ou atribuir cargo.', ephemeral: true }); await interaction.editReply({ content: '❌ Erro ao adicionar membro ou atribuir cargo.', ephemeral: true });
} }
try { try {
// 3 - Pegar o membro na guilda
// 3 - Pegar o membro na guilda
const member = await interaction.guild.members.fetch(nome.id); const member = await interaction.guild.members.fetch(nome.id);
// 4 - Verificar se o membro já tem o cargo // 4 - Verificar se o membro já tem o cargo