@ -145,25 +145,31 @@ export async function execute(interaction) {
. setDescription ( 'It seems your answer was incorrect. Please react with <:override:955265585086857236> to override your answer if you think you got it right.' )
. setDescription ( 'It seems your answer was incorrect. Please react with <:override:955265585086857236> to override your answer if you think you got it right.' )
. setColor ( '#ffffff' )
. setColor ( '#ffffff' )
. setTimestamp ( ) ;
. setTimestamp ( ) ;
const overrideButton = new MessageActionRow ( )
. addComponents (
new MessageButton ( )
. setCustomId ( 'override' )
. setEmoji ( '<:override:955265585086857236>' )
. setStyle ( 'SECONDARY' ) ,
) ;
answerMsg . channel . send ( {
answerMsg . channel . send ( {
embeds : [ overrideEmbed ] ,
embeds : [ overrideEmbed ] ,
components : [ overrideButton ] ,
} )
} )
. then ( overrideMsg = > {
. then ( overrideMsg = > {
overrideMsg . react ( '<:override:955265585086857236>' ) ;
const overrideFilter = i = > {
const filter = ( reaction , user ) = > {
return (
return (
[ 'override' ] . includes ( reaction . emoji . name ) &&
[ 'override' ] . includes ( i . customId ) &&
user . id === answerMsg . author . id
i . user . id === answerMsg . author . id
) ;
) ;
} ;
} ;
overrideMsg
overrideMsg
. awaitReactions ( {
. awaitMessageComponent ( {
filter : filter ,
filter : overrideFilter ,
max : 1 ,
} )
} )
. then ( ( ) = > {
. then ( i = > {
updateScore ( true , score , authorId ) . then ( ( msgToReply ) = >
updateScore ( true , score , authorId ) . then ( ( msgToReply ) = >
answerMsg . reply ( msgToReply ) ,
i . reply ( msgToReply ) ,
) ;
) ;
} ) . catch ( err = > log ( { logger : 'train' , content : ` Failed to override score: ${ err } ` , level : 'error' } ) ) ;
} ) . catch ( err = > log ( { logger : 'train' , content : ` Failed to override score: ${ err } ` , level : 'error' } ) ) ;
} ) . catch ( err = > log ( { logger : 'train' , content : ` Failed to send override message: ${ err } ` , level : 'error' } ) ) ;
} ) . catch ( err = > log ( { logger : 'train' , content : ` Failed to send override message: ${ err } ` , level : 'error' } ) ) ;