This commit is contained in:
parent
18f43ac639
commit
5b4079f578
@ -1,7 +1,7 @@
|
||||
// comandos/add.js
|
||||
const { InteractionContextType, EmbedBuilder, PermissionFlagsBits, SlashCommandBuilder, MessageFlags } = require('discord.js');
|
||||
const conn = require('../../../database/db'); // Ajusta o caminho
|
||||
const { Table } = require('embed-table');
|
||||
//const { Table } = require('embed-table');
|
||||
|
||||
|
||||
console.error("--------------------- lista_membro.js ---------------------");
|
||||
@ -52,31 +52,26 @@ module.exports = {
|
||||
|
||||
const [rows] = await conn.execute('SELECT discord_id, discord_username, cargo FROM users'); // Altere para a sua consulta
|
||||
|
||||
const table = new Table({
|
||||
titles: ['Level', 'Money', 'Wins', 'Wins'],
|
||||
titleIndexes: [0, 18, 33, 40],
|
||||
columnIndexes: [0, 18, 33, 40],
|
||||
start: '`',
|
||||
end: '`',
|
||||
padEnd: 3
|
||||
});
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.addFields(
|
||||
rows.forEach(row => {
|
||||
{
|
||||
name: "",
|
||||
value: "<@row.discord_id> asdsadadasddasasda```sddasasdasddasasdasddasasdasddasasdasddasasd```",
|
||||
inline: true
|
||||
},
|
||||
});
|
||||
)
|
||||
.setColor("#00b0f4")
|
||||
.setTimestamp();
|
||||
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
|
||||
// rows.forEach(row => {
|
||||
// table.addRow(['row.discord_id', 'row.discord_username', 'row.cargo']);
|
||||
//});
|
||||
|
||||
table.addRow(['123456789101112', '2', '3', '3']);
|
||||
table.addRow(['123456789101112', '2', '3', '3']);
|
||||
table.addRow(['123456789101112', '2', '3', '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();
|
||||
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
|
||||
} catch (error) {
|
||||
console.error('DEV:', error);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user