From 2bb92ccabc7a98e8529c77d238ca42867ee58bee Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 25 Apr 2020 00:32:56 -0400 Subject: [PATCH] info command --- src/commands/info.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/commands/info.ts diff --git a/src/commands/info.ts b/src/commands/info.ts new file mode 100644 index 0000000..278c9f9 --- /dev/null +++ b/src/commands/info.ts @@ -0,0 +1,34 @@ +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 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); + 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); + } + } +}