made wgeList return an embed
This commit is contained in:
@@ -243,25 +243,49 @@ 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;
|
||||||
|
|||||||
Reference in New Issue
Block a user