made wgeList return an embed

This commit is contained in:
2026-06-10 15:54:12 +02:00
parent 0813beb2c0
commit 0f5ada6c0f
+37 -13
View File
@@ -244,24 +244,48 @@ async function wgeParticipate(interaction) {
} }
async function wgeList(interaction) { async function wgeList(interaction) {
const thing = interaction.options.getString('thing') const thing = interaction.options.getString('thing');
switch (thing) { switch (thing) {
case 'participants': case 'participants': {
const db = mClient.db('neo-db') const db = mClient.db('neo-db');
const participantColl = db.collection('items_wge') const participantColl = db.collection('items_wge');
const participants = await participantColl.find({ const participants = await participantColl.find({}).toArray();
status: true
}).toArray() const participating = participants
let messageContent = '' .filter(p => p.status)
participants.forEach((participant) => { .map(p => `<@${p.userID}>`);
messageContent += `<@${participant.userID}>\r\n`
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}`
}) })
interaction.reply({ await interaction.reply({
content: `WGE Participants:\r\n${messageContent}`, embeds: [embed],
flags: MessageFlags.Ephemeral flags: MessageFlags.Ephemeral
}) });
break; break;
}
default: default:
break; break;