@ -17,13 +17,15 @@ export const data = new SlashCommandBuilder()
. setName ( 'subject' )
. setName ( 'subject' )
. setDescription ( 'Optional subject to be used as a filter' )
. setDescription ( 'Optional subject to be used as a filter' )
. setRequired ( false )
. setRequired ( false )
. addChoice ( 'astro' , 'astro' )
. addChoices (
. addChoice ( 'bio' , 'bio' )
{ name : 'astro' , value : 'astro' } ,
. addChoice ( 'ess' , 'ess' )
{ name : 'bio' , value : 'bio' } ,
. addChoice ( 'chem' , 'chem' )
{ name : 'chem' , value : 'chem' } ,
. addChoice ( 'phys' , 'phys' )
{ name : 'ess' , value : 'ess' } ,
. addChoice ( 'math' , 'math' )
{ name : 'phys' , value : 'phys' } ,
. addChoice ( 'energy' , 'energy' )
{ name : 'math' , value : 'math' } ,
{ name : 'energy' , value : 'energy' } ,
)
. setRequired ( false ) ;
. setRequired ( false ) ;
return option ;
return option ;
} ) ;
} ) ;
@ -33,13 +35,21 @@ export async function execute(interaction : CommandInteraction) {
const subject = interaction . options . get ( 'subject' ) ? interaction . options . get ( 'subject' ) ? . value : null ;
const subject = interaction . options . get ( 'subject' ) ? interaction . options . get ( 'subject' ) ? . value : null ;
const authorId = interaction . user . id ;
const authorId = interaction . user . id ;
let score ;
let score : number ;
userScore
userScore
. findOne ( { authorID : authorId } )
. findOne ( { authorID : authorId } )
. lean ( )
. lean ( )
. then ( ( obj , err ) = > {
. then ( ( obj : { score : number ; } , err : unknown ) = > {
if ( ! obj ) {
if ( ! obj ) {
score = 0 ;
score = 0 ;
const firstTimeEmbed = new MessageEmbed ( )
. setAuthor ( { name : interaction.client.user?.tag ? interaction . client . user ? . tag : '' , iconURL : interaction.client.user?.displayAvatarURL ( ) } )
. setDescription ( 'Hey! It seems like it\'s your first time using AwesomeSciBo. Here\'s some information regarding the bot if you need it (for issues, contributions, etc.):' )
. addField ( 'Creator' , '<@745063586422063214> [@abheekd#3602]' )
. addField ( 'GitHub' , '[Link](https://github.com/ADawesomeguy/AwesomeSciBo) (a star couldn\'t hurt...)' )
. setColor ( '#ffffff' )
. setTimestamp ( ) ;
interaction . user . send ( { embeds : [ firstTimeEmbed ] } ) ;
}
}
else if ( obj ) {
else if ( obj ) {
score = obj . score ;
score = obj . score ;