merge-requests/1/merge
Bsian 2019-12-16 22:42:39 +00:00
commit 609ee3689e
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
2 changed files with 13 additions and 11 deletions

View File

@ -40,7 +40,7 @@ export default class CreateAccount extends Command {
const tempPass = this.client.util.randomPassword(); const tempPass = this.client.util.randomPassword();
let passHash = await this.client.util.createHash(tempPass); passHash = passHash.replace(/[$]/g, '\\$').replace('\n', ''); let passHash = await this.client.util.createHash(tempPass); passHash = passHash.replace(/[$]/g, '\\$').replace('\n', '');
const acctName = message.author.username.replace(/[!@#$%^&*(),.?":{}|<>]/g, '-').replace(/\s/g, '-'); const acctName = this.client.users.get(args[0]).username.replace(/[!@#$%^&*(),.?":{}|<>]/g, '-').replace(/\s/g, '-');
const etcPasswd = `${acctName},${args[0]},,`; const etcPasswd = `${acctName},${args[0]},,`;
await this.client.util.createAccount(passHash, etcPasswd, args[2], args[0], args[1], message.author.id); await this.client.util.createAccount(passHash, etcPasswd, args[2], args[0], args[1], message.author.id);

View File

@ -6,6 +6,7 @@ export default async function storage(client: Client) {
const main = async () => { const main = async () => {
const accounts = await client.db.Account.find(); const accounts = await client.db.Account.find();
for (const account of accounts) { for (const account of accounts) {
setTimeout(async () => {
const res = await client.util.exec(`du -bs /home/${account.username}`); const res = await client.util.exec(`du -bs /home/${account.username}`);
let bytes = Number(res.split('/')[0].replace('\t', '')); let bytes = Number(res.split('/')[0].replace('\t', ''));
try { try {
@ -16,6 +17,7 @@ export default async function storage(client: Client) {
bytes += 0; bytes += 0;
} }
await client.redis.set(`storage-${account.username}`, bytes); await client.redis.set(`storage-${account.username}`, bytes);
}, 600000);
} }
}; };
await main(); await main();