add info cmd

merge-requests/4/head
Matthew 2020-07-04 23:44:49 -04:00
parent 9802240e94
commit b0239282f4
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
2 changed files with 40 additions and 0 deletions

View File

@ -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';

39
src/commands/info.ts Normal file
View File

@ -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);
}
}
}