@ -5,47 +5,25 @@ import gitlog from 'gitlog';
import userScore from '../models/userScore' ;
import { paginateInteraction } from '../helpers/util/pagination' ;
export const data = new SlashCommandBuilder ( )
. setName ( 'about' )
. setDescription ( 'Commands regarding the creation/development of the bot' )
. addSubcommand ( subcommand = > {
subcommand
. setName ( 'contributors' )
. setDescription ( 'Lists contributors to the AwesomeSciBo bot' ) ;
return subcommand ;
} )
. addSubcommand ( subcommand = > {
subcommand
. setName ( 'changelog' )
. setDescription ( 'Lists the 5 most recent changes in a "git log" type format' ) ;
return subcommand ;
} )
. addSubcommand ( subcommand = > {
subcommand
. setName ( 'bot' )
. setDescription ( 'Lists information about AwesomeSciBo' ) ;
return subcommand ;
} ) ;
. setDescription ( 'Commands regarding the creation/development of the bot' ) ;
export async function execute ( interaction : CommandInteraction ) {
await interaction . deferReply ( ) ;
const client = interaction . client ;
const embeds : MessageEmbed [ ] = [ ] ;
switch ( interaction . options . getSubcommand ( ) ) {
case 'contributors' : {
const contributorEmbed = new MessageEmbed ( ) . setTitle ( 'Contributors' )
. addField ( 'Creator' , '<@745063586422063214> [ADawesomeguy#3602]' , true )
. addField ( 'Contributors' , '<@650525101048987649> [tEjAs#8127]\n<@426864344463048705> [tetrident#9396]' , true ) // Add more contributors here, first one is Abheek, second one is Tejas
. setTimestamp ( )
. setColor ( '#ffffff' ) ;
embeds . push ( contributorEmbed ) ;
interaction . followUp ( { embeds : [ contributorEmbed ] } ) ;
break ;
}
case 'changelog' : {
const gitRepoLocation = __dirname ;
const commits = gitlog ( {
@ -63,13 +41,8 @@ export async function execute(interaction : CommandInteraction) {
commits . forEach ( commit = > {
changelogEmbed . addField ( commit . abbrevHash , ` > \` Hash: \` ${ commit . hash } \ n> \` Subject: \` ${ commit . subject } \ n> \` Author: \` ${ commit . authorName } \ n> \` Date: \` ${ commit . authorDateRel } \ n> \` Link \` : [GitHub](https://github.com/ADawesomeguy/AwesomeSciBo/commit/ ${ commit . hash } ) \ n ` ) ;
} ) ;
embeds . push ( changelogEmbed ) ;
interaction . followUp ( { embeds : [ changelogEmbed ] } ) ;
break ;
}
case 'bot' : {
await client . guilds . fetch ( ) ;
const trainingDocuments = await userScore . countDocuments ( { } ) ;
const aboutBotEmbed = new MessageEmbed ( )
@ -79,9 +52,7 @@ export async function execute(interaction : CommandInteraction) {
. addField ( 'Training Users' , ` ${ trainingDocuments } ` , true )
. setTimestamp ( ) ;
interaction . followUp ( { embeds : [ aboutBotEmbed ] } ) ;
embeds . push ( aboutBotEmbed ) ;
break ;
}
}
paginateInteraction ( interaction , embeds ) ;
}