1
0
Fork 0

final finishes on checkLock func

refactor/models
Matthew 2019-10-26 13:07:05 -04:00
parent 2c8dc89a42
commit 706fb20aa9
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import Client from '../Client';
import uuid from 'uuid/v4';
import { Client } from '..';
import { RichEmbed } from '../class';
export default function checkLock(client: Client) {
@ -12,8 +13,19 @@ export default function checkLock(client: Client) {
const account = await client.db.Account.findOne({ username: moderation.username });
if (!account) return;
await client.util.exec(`unlock ${account.username}`);
await moderation.update({ 'expiration.processed': true });
const mod = new client.db.Moderation({
username: account.username,
userID: account.userID,
logID: uuid(),
moderatorID: client.user.id,
reason: 'Auto',
type: 3,
date: new Date(),
});
await mod.save();
const embed = new RichEmbed();
embed.setTitle('Cloud Infraction | Unlock');
embed.setTitle('Account Infraction | Unlock');
embed.setColor(3066993);
embed.addField('User', `${account.username} | <@${account.userID}>`, true);
embed.addField('Supervisor', 'SYSTEM', true);