This commit is contained in:
Bxio 2025-04-29 15:04:57 +01:00
parent 3012089769
commit 866d69e199

View File

@ -48,27 +48,41 @@ module.exports = {
try {
const table = new Table({ const [rows] = await conn.execute('SELECT discord_id, discord_username, cargo FROM users'); // Altere para a sua consulta
titles: ['Level', 'Money', 'Wins'],
titleIndexes: [0, 8, 16], const table = new Table({
columnIndexes: [0, 6, 14], titles: ['discord_id', 'discord_username', 'cargo'],
start: '`', titleIndexes: [0, 8, 16],
end: '`', columnIndexes: [0, 6, 14],
padEnd: 3 start: '`',
}); end: '`',
padEnd: 3
table.addRow(['1', '$120', '2'], { override: 4 }); });
table.addRow(['72', '$10', '25'], { override: 3 });
table.addRow(['614', '$1220', '12']);
rows.forEach(row => {
// Use this 'embed' when sending a message to a channel. table.addRow([row.discord_id, row.discord_username, row.cargo]);
const embed = new EmbedBuilder().setFields(table.toField()); });
table.addRow(['1', '$120', '2'], { override: 4 });
// Use this 'tableString' in a plain text area, (embed description or a regular message) table.addRow(['72', '$10', '25'], { override: 3 });
const string = table.toString(); table.addRow(['614', '$1220', '12']);
await interaction.editReply({ embeds: [embed] }); // 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!' });
}