add info cmd
parent
9802240e94
commit
b0239282f4
|
@ -8,6 +8,7 @@ export { default as emailcode } from './emailcode';
|
|||
export { default as eval } from './eval';
|
||||
export { default as exec } from './exec';
|
||||
export { default as help } from './help';
|
||||
export { default as info } from './info';
|
||||
export { default as limits } from './limits';
|
||||
export { default as load } from './load';
|
||||
export { default as lock } from './lock';
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
import { Message } from 'eris';
|
||||
import { totalmem } from 'os';
|
||||
import { Client, Command, RichEmbed } from '../class';
|
||||
import { version as erisVersion } from '../../node_modules/eris/package.json';
|
||||
import { version as expressVersion } from '../../node_modules/express/package.json';
|
||||
import { version as mongooseVersion } from '../../node_modules/mongoose/package.json';
|
||||
import { version as ioredisVersion } from '../../node_modules/ioredis/package.json';
|
||||
import { version as tscVersion } from '../../node_modules/typescript/package.json';
|
||||
|
||||
export default class Info extends Command {
|
||||
constructor(client: Client) {
|
||||
super(client);
|
||||
this.name = 'info';
|
||||
this.description = 'Provides information about CSD.';
|
||||
this.usage = `${this.client.config.prefix}info`;
|
||||
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)', '<:ts:604565354554982401> TypeScript, <:Go:703449475405971466> Go', true);
|
||||
embed.addField('Runtime', `Node (${process.version})`, true);
|
||||
embed.addField('Compilers/Transpilers', `TypeScript [tsc] (${tscVersion}) | Go [gc] (${await this.client.util.exec('go version')})`, true);
|
||||
embed.addField('Process Manager', `SystemD (${await this.client.util.exec('systemd --version')})`, true);
|
||||
embed.addField('Discord Library', `Eris (${erisVersion})`, true);
|
||||
embed.addField('HTTP Server Library', `Express (${expressVersion})`, true);
|
||||
embed.addField('Database Library', `MongoDB w/ Mongoose ODM (${mongooseVersion})`, true);
|
||||
embed.addField('Cache Library', `Redis w/ IORedis (${ioredisVersion})`, true);
|
||||
embed.addField('Memory Usage', `${Math.round(process.memoryUsage().rss / 1024 / 1024)} MB / ${Math.round(totalmem() / 1024 / 1024 / 1024)} GB`, true);
|
||||
embed.addField('Repository', 'https://loc.sh/csdgit | Licensed under GNU Affero General Public License V3', true);
|
||||
return message.channel.createMessage({ embed });
|
||||
} catch (err) {
|
||||
return this.client.util.handleError(err, message, this);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue