From a2f0794838e209bfe42704cc8a15b836138fa073 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Mon, 28 Oct 2019 20:30:55 -0400 Subject: [PATCH] edit responses for cwg and add data command --- src/commands/cwg.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/cwg.ts b/src/commands/cwg.ts index 616af20..481be00 100644 --- a/src/commands/cwg.ts +++ b/src/commands/cwg.ts @@ -86,13 +86,14 @@ export default class CWG extends Command { } else if (args[0] === 'data') { if (!args[1]) return this.client.commands.get('help').run(message, [this.name]); const domain = await this.client.db.Domain.findOne({ $or: [{ domain: args[1] }, { port: args[1] }] }); + if (!domain) return message.channel.createMessage(`***${this.client.stores.emojis.error} The domain or port you provided could not be found.***`); const embed = new RichEmbed(); embed.setTitle('Domain Information'); embed.addField('Account Username', domain.account.username, true); embed.addField('Account ID', domain.account.userID, true); embed.addField('Domain', domain.domain, true); embed.addField('Port', String(domain.port), true); - embed.addField('Certificate Issuer', x509.getIssuer(await fs.readFile(domain.x509.cert, { encoding: 'utf8 ' })).organizationName, true); + embed.addField('Certificate Issuer', x509.getIssuer(await fs.readFile(domain.x509.cert, { encoding: 'utf8' })).organizationName, true); embed.addField('Certificate Subject', x509.getSubject(await fs.readFile(domain.x509.cert, { encoding: 'utf8' })).commonName, true); embed.addField('Certificate Expiration Date', moment(x509.parseCert(await fs.readFile(domain.x509.cert, { encoding: 'utf8' })).notAfter).format('dddd, MMMM Do YYYY, h:mm:ss A'), true); embed.setFooter(this.client.user.username, this.client.user.avatarURL);