adder list

This commit is contained in:
2026-06-10 15:35:03 +02:00
parent d749f8f16b
commit 0813beb2c0
2 changed files with 82 additions and 7 deletions
+47 -1
View File
@@ -237,7 +237,35 @@ async function wgeParticipate(interaction) {
upsert: true
})
interaction.reply(`You are ${status ? '' : 'no longer '}participating!`)
interaction.reply({
content: `You are ${status ? '' : 'no longer '}participating!`,
flags: MessageFlags.Ephemeral
})
}
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`
})
interaction.reply({
content: `WGE Participants:\r\n${messageContent}`,
flags: MessageFlags.Ephemeral
})
break;
default:
break;
}
}
module.exports = {
@@ -294,6 +322,22 @@ module.exports = {
.addBooleanOption(o =>
o.setName('status')
.setDescription('choose')
.setRequired(true)
)
)
// List the previous WGE Sessions
.addSubcommand(s =>
s
.setName('list')
.setDescription('list things')
.addStringOption(o =>
o.setName('thing')
.setDescription('what would you like to be listed')
.addChoices(
{ name: 'participants', value: 'participants'},
{ name: 'history', value: 'history'}
)
)
)
,
@@ -324,6 +368,8 @@ module.exports = {
case 'participate':
wgeParticipate(interaction)
break;
case 'list':
wgeList(interaction)
default:
break;
}