2020-04-25 00:32:56 -04:00
import { Message } from 'eris' ;
import { totalmem } from 'os' ;
import { Client , Command , RichEmbed } from '../class' ;
import { version as erisVersion } from '../../node_modules/eris/package.json' ;
2020-06-27 23:51:15 -04:00
import { version as expressVersion } from '../../node_modules/express/package.json' ;
2020-04-25 00:32:56 -04:00
import { version as mongooseVersion } from '../../node_modules/mongoose/package.json' ;
export default class Info extends Command {
constructor ( client : Client ) {
super ( client ) ;
this . name = 'info' ;
this . description = 'System information.' ;
this . usage = 'info' ;
this . permissions = 0 ;
this . enabled = true ;
}
public async run ( message : Message ) {
try {
const embed = new RichEmbed ( ) ;
embed . setTitle ( 'Information' ) ;
embed . setThumbnail ( this . client . user . avatarURL ) ;
embed . addField ( 'Language(s)' , '<:TypeScript:703451285789343774> TypeScript' , true ) ;
embed . addField ( 'Discord Library' , ` Eris ( ${ erisVersion } ) ` , true ) ;
2020-06-27 23:51:15 -04:00
embed . addField ( 'HTTP Server Library' , ` Express ( ${ expressVersion } ) ` , true ) ;
2020-04-25 00:32:56 -04:00
embed . addField ( 'Database Library' , ` MongoDB w/ Mongoose ODM ( ${ mongooseVersion } ) ` , true ) ;
embed . addField ( 'Repository' , 'https://gitlab.libraryofcode.org/engineering/communityrelations | Licensed under GNU Affero General Public License V3' , true ) ;
embed . addField ( 'Memory Usage' , ` ${ Math . round ( process . memoryUsage ( ) . rss / 1024 / 1024 ) } MB / ${ Math . round ( totalmem ( ) / 1024 / 1024 / 1024 ) } GB ` , true ) ;
embed . setFooter ( this . client . user . username , this . client . user . avatarURL ) ;
embed . setTimestamp ( ) ;
message . channel . createMessage ( { embed } ) ;
} catch ( err ) {
this . client . util . handleError ( err , message , this ) ;
}
}
}