diff --git a/src/commands/cwg.ts b/src/commands/cwg.ts index b4c0982..593f531 100644 --- a/src/commands/cwg.ts +++ b/src/commands/cwg.ts @@ -55,15 +55,15 @@ export default class CWG extends Command {

Library of Code sp-us | Cloud Services

Hello, this is an email informing you that a new domain under your account has been binded. Information is below.

- Domain: ${domain.domain} - Port: ${domain.port} - Certificate Issuer: ${cert.issuer.organizationName} - Certificate Subject: ${cert.subject.commonName} - Responsible Engineer: ${message.author.username}#${message.author.discriminator} + Domain: ${domain.domain} + Port: ${domain.port} + Certificate Issuer: ${cert.issuer.organizationName} + Certificate Subject: ${cert.subject.commonName} + Responsible Engineer: ${message.author.username}#${message.author.discriminator} If you have any questions about additional setup, you can reply to this email or send a message in #cloud-support in our Discord server. - Library of Code sp-us | Support Team + Library of Code sp-us | Support Team `, }); if (!domain.domain.includes('cloud.libraryofcode.org')) { diff --git a/src/commands/lock.ts b/src/commands/lock.ts index 69e81de..f1ad4e7 100644 --- a/src/commands/lock.ts +++ b/src/commands/lock.ts @@ -18,22 +18,20 @@ export default class Lock extends Command { try { const account = await this.client.db.Account.findOne({ $or: [{ account: args[0] }, { userID: args[0].replace(/[<@!>]/gi, '') }] }); if (!account) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot find user.***`); + if (account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already locked.***`); const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Locking account...***`); - if (account.locked) return edit.edit(`***${this.client.stores.emojis.error} This account is already locked.***`); if (account.username === 'matthew' || account.root) return edit.edit(`***${this.client.stores.emojis.error} Permission denied.***`); await this.client.util.exec(`lock ${account.username}`); await account.update({ locked: true }); const expiry = new Date(); + const lockLength = args[1].match(/[a-z]+|[^a-z]+/gi); // @ts-ignore - const momentMilliseconds = moment.duration(Number(args[1].split('')[0]), args[1].split('')[1]).asMilliseconds; + const momentMilliseconds = moment.duration(Number(lockLength[0]), lockLength[1]).asMilliseconds; expiry.setMilliseconds(momentMilliseconds); - let processed: boolean; - if (momentMilliseconds) { - processed = false; - } else { - processed = true; - } + let processed: boolean = false; + if (!momentMilliseconds) processed = true; + const moderation = new this.client.db.Moderation({ username: account.username, userID: account.userID, @@ -71,11 +69,11 @@ export default class Lock extends Command { html: `

Library of Code | Cloud Services

Your Cloud Account has been locked until ${momentMilliseconds ? moment(expiry).calendar() : 'indefinitely'} under the EULA.

-

Reason: ${momentMilliseconds ? args.slice(2).join(' ') : args.slice(1).join(' ')}

-

Supervisor: ${message.author.username}

-

Expiration: ${momentMilliseconds ? moment(expiry).format('dddd, MMMM Do YYYY, h:mm:ss A') : 'N/A'}

+

Reason: ${momentMilliseconds ? args.slice(2).join(' ') : args.slice(1).join(' ')}

+

Supervisor: ${message.author.username}

+

Expiration: ${momentMilliseconds ? moment(expiry).format('dddd, MMMM Do YYYY, h:mm:ss A') : 'N/A'}

- Library of Code sp-us | Support Team + Library of Code sp-us | Support Team `, }); } catch (error) { diff --git a/src/commands/unlock.ts b/src/commands/unlock.ts index 2a1c46e..b16a9d8 100644 --- a/src/commands/unlock.ts +++ b/src/commands/unlock.ts @@ -1,5 +1,4 @@ import uuid from 'uuid/v4'; -import moment from 'moment'; import { Message } from 'eris'; import { Client } from '..'; import { Command, RichEmbed } from '../class'; @@ -17,8 +16,8 @@ export default class Unlock extends Command { try { const account = await this.client.db.Account.findOne({ $or: [{ account: args[0] }, { userID: args[0].replace(/[<@!>]/gi, '') }] }); if (!account) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot find user.***`); + if (!account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already unlocked.***`); const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Unlocking account...***`); - if (!account.locked) return edit.edit(`***${this.client.stores.emojis.error} This account is already unlocked.***`); if (account.username === 'matthew' || account.root) return edit.edit(`***${this.client.stores.emojis.error} Permission denied.***`); await this.client.util.exec(`unlock ${account.username}`);