@ -33,11 +33,11 @@ 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 ;
}
}
@ -126,6 +126,22 @@ export async function execute(interaction : CommandInteraction) {
if ( answerMsg ? . author . id === interaction . client . user ? . id ) return ;
if ( answerMsg ? . author . id === interaction . client . user ? . id ) return ;
const doc = userScore . findOne ( {
authorID : authorId ,
} ) ;
if ( ! doc ) {
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 ( ) ;
answerMsg ? . author . send ( { embeds : [ firstTimeEmbed ] } ) ;
}
let predicted = '' ;
let predicted = '' ;
if ( answerMsg ? . content . toLowerCase ( ) === tossupAnswer . toLowerCase ( ) || answers . includes ( answerMsg ? . content . toUpperCase ( ) ) ) {
if ( answerMsg ? . content . toLowerCase ( ) === tossupAnswer . toLowerCase ( ) || answers . includes ( answerMsg ? . content . toUpperCase ( ) ) ) {
predicted = 'correct' ;
predicted = 'correct' ;