made wgeList return an embed
This commit is contained in:
@@ -244,24 +244,48 @@ async function wgeParticipate(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`
|
||||
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}`
|
||||
})
|
||||
|
||||
interaction.reply({
|
||||
content: `WGE Participants:\r\n${messageContent}`,
|
||||
await interaction.reply({
|
||||
embeds: [embed],
|
||||
flags: MessageFlags.Ephemeral
|
||||
})
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user