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({
titles: ['Level', 'Money', 'Wins'],
titleIndexes: [0, 8, 16],
columnIndexes: [0, 6, 14],
start: '`',
end: '`',
padEnd: 3
});
const [rows] = await conn.execute('SELECT discord_id, discord_username, cargo FROM users'); // Altere para a sua consulta
table.addRow(['1', '$120', '2'], { override: 4 });
table.addRow(['72', '$10', '25'], { override: 3 });
table.addRow(['614', '$1220', '12']);
const table = new Table({
titles: ['discord_id', 'discord_username', 'cargo'],
titleIndexes: [0, 8, 16],
columnIndexes: [0, 6, 14],
start: '`',
end: '`',
padEnd: 3
});
// 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();
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!' });
}
await interaction.editReply({ embeds: [embed] });