made wgeList return an embed

This commit is contained in:
2026-06-10 15:54:12 +02:00
parent 0813beb2c0
commit 0f5ada6c0f
+41 -17
View File
@@ -243,26 +243,50 @@ 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) {
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`
})
interaction.reply({ switch (thing) {
content: `WGE Participants:\r\n${messageContent}`, 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 flags: MessageFlags.Ephemeral
}) });
break; break;
}
default: default:
break; break;
} }