1+ const { EmbedBuilder } = require ( "discord.js" ) ;
2+ const SlashCommand = require ( "../../../structures/base/BaseSlashCommand" ) ;
3+
4+ class RegistrationNumbersCommand extends SlashCommand {
5+ /**
6+ * @param {import("../../index.js") } client HackRUBot's Discord Client.
7+ */
8+ constructor ( client ) {
9+ super ( client , {
10+ name : "registration-numbers" ,
11+ category : "team" ,
12+ guildRequired : true ,
13+ cooldown : 3 ,
14+ commandData : {
15+ description : "Fetch registration data from HackRU's database." ,
16+ } ,
17+ } ) ;
18+ }
19+
20+ /**
21+ * @param {import("discord.js").ChatInputCommandInteraction } interaction
22+ */
23+ async run ( interaction ) {
24+ await interaction . deferReply ( ) ;
25+
26+ const users = await this . HackRUBot . db . getCollection ( "users" ) ;
27+
28+ const unregistered = await users . countDocuments ( { registration_status : "unregistered" , created_at : { $gt : "2024-08-28" } } ) ;
29+ const registered = await users . countDocuments ( { registration_status : "registered" } ) ;
30+ const confirmation = await users . countDocuments ( { registration_status : "confirmation" } ) ;
31+ const rejected = await users . countDocuments ( { registration_status : "rejected" } ) ;
32+ const coming = await users . countDocuments ( { registration_status : "coming" } ) ;
33+ const notComing = await users . countDocuments ( { registration_status : "not_coming" } ) ;
34+ const confirmed = await users . countDocuments ( { registration_status : "confirmed" } ) ;
35+ const waitlist = await users . countDocuments ( { registration_status : "waitlist" } ) ;
36+ const checkedIn = await users . countDocuments ( { registration_status : "checked_in" } ) ;
37+
38+ const infoEmbed = new EmbedBuilder ( )
39+ . setAuthor ( { name : "HackRU Registration Information" , iconURL : interaction . guild . iconURL ( ) } )
40+ . setFields ( [
41+ { name : "Unregistered:" , value : `\`${ unregistered } \`` , inline : true } ,
42+ { name : "Registered:" , value : `\`${ registered } \`` , inline : true } ,
43+ { name : "Confirmation:" , value : `\`${ confirmation } \`` , inline : true } ,
44+ { name : "Rejected:" , value : `\`${ rejected } \`` , inline : true } ,
45+ { name : "Coming:" , value : `\`${ coming } \`` , inline : true } ,
46+ { name : "Not Coming:" , value : `\`${ notComing } \`` , inline : true } ,
47+ { name : "Confirmed:" , value : `\`${ confirmed } \`` , inline : true } ,
48+ { name : "Waitlist:" , value : `\`${ waitlist } \`` , inline : true } ,
49+ { name : "Checked In:" , value : `\`${ checkedIn } \`` , inline : true } ,
50+ ] )
51+ . setColor ( "Blurple" )
52+ . setFooter ( { text : "Data as of" } )
53+ . setTimestamp ( ) ;
54+
55+ interaction . editReply ( { embeds : [ infoEmbed ] } ) ;
56+
57+ return ;
58+ }
59+ }
60+
61+ module . exports = RegistrationNumbersCommand ;
0 commit comments