From 866d69e1993cf18cbbac025593538c01914c11a9 Mon Sep 17 00:00:00 2001 From: Bxio Date: Tue, 29 Apr 2025 15:04:57 +0100 Subject: [PATCH] --- src/commands/Community/lista_membros.js | 54 ++++++++++++++++--------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/src/commands/Community/lista_membros.js b/src/commands/Community/lista_membros.js index c667b8c..0491a81 100644 --- a/src/commands/Community/lista_membros.js +++ b/src/commands/Community/lista_membros.js @@ -48,27 +48,41 @@ module.exports = { + try { - const table = new Table({ - titles: ['Level', 'Money', 'Wins'], - titleIndexes: [0, 8, 16], - columnIndexes: [0, 6, 14], - start: '`', - end: '`', - padEnd: 3 - }); - - table.addRow(['1', '$120', '2'], { override: 4 }); - table.addRow(['72', '$10', '25'], { override: 3 }); - table.addRow(['614', '$1220', '12']); - - // Use this 'embed' when sending a message to a channel. - const embed = new EmbedBuilder().setFields(table.toField()); - - // Use this 'tableString' in a plain text area, (embed description or a regular message) - const string = table.toString(); - - await interaction.editReply({ embeds: [embed] }); + const [rows] = await conn.execute('SELECT discord_id, discord_username, cargo FROM users'); // Altere para a sua consulta + + const table = new Table({ + titles: ['discord_id', 'discord_username', 'cargo'], + titleIndexes: [0, 8, 16], + columnIndexes: [0, 6, 14], + start: '`', + end: '`', + padEnd: 3 + }); + + + rows.forEach(row => { + table.addRow([row.discord_id, row.discord_username, row.cargo]); + }); + table.addRow(['1', '$120', '2'], { override: 4 }); + table.addRow(['72', '$10', '25'], { override: 3 }); + table.addRow(['614', '$1220', '12']); + + // Use this 'embed' when sending a message to a channel. + const embed = new EmbedBuilder().setFields(table.toField()); + + // Use this 'tableString' in a plain text area, (embed description or a regular message) + const string = table.toString(); + + await interaction.editReply({ embeds: [embed] }); + + } catch (error) { + console.error('DEV:', error); + await interaction.editReply({ content: 'dev erro!' }); + } + +