diff --git a/commands/slash/applications/wge.js b/commands/slash/applications/wge.js index 027506b..dc3da3d 100644 --- a/commands/slash/applications/wge.js +++ b/commands/slash/applications/wge.js @@ -243,26 +243,50 @@ async function wgeParticipate(interaction) { }) } -async function wgeList(interaction){ - const thing = interaction.options.getString('thing') - switch (thing) { - case 'participants': - const db = mClient.db('neo-db') - const participantColl = db.collection('items_wge') - const participants = await participantColl.find({ - status: true - }).toArray() - let messageContent = '' - participants.forEach((participant) => { - messageContent += `<@${participant.userID}>\r\n` - }) +async function wgeList(interaction) { + const thing = interaction.options.getString('thing'); - interaction.reply({ - content: `WGE Participants:\r\n${messageContent}`, + switch (thing) { + case 'participants': { + const db = mClient.db('neo-db'); + const participantColl = db.collection('items_wge'); + const participants = await participantColl.find({}).toArray(); + + const participating = participants + .filter(p => p.status) + .map(p => `<@${p.userID}>`); + + const notParticipating = participants + .filter(p => !p.status) + .map(p => `<@${p.userID}>`); + + const embed = new EmbedBuilder() + .setTitle('WGE Participation') + .setColor(0x5865F2) + .addFields( + { + name: `Participating (${participating.length})`, + value: participating.join('\n') || 'No participants found.', + inline: true + }, + { + name: `Not Participating (${notParticipating.length})`, + value: notParticipating.join('\n') || 'No entries found.', + inline: true + } + ) + .setFooter({ + text: `Total entries: ${participants.length}` + }) + + await interaction.reply({ + embeds: [embed], flags: MessageFlags.Ephemeral - }) + }); + break; - + } + default: break; }