various additions

merge-requests/4/head
Matthew 2020-05-17 06:58:45 -04:00
parent 789c97f3ff
commit 8c7bf288c4
No known key found for this signature in database
GPG Key ID: D499B75C1390E321
1 changed files with 3 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import net from 'net';
import crypto from 'crypto'; import crypto from 'crypto';
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
import Client from '../Client'; import Client from '../Client';
import { dataConversion } from '../functions';
export default class CSCLI { export default class CSCLI {
public client: Client; public client: Client;
@ -42,13 +43,12 @@ export default class CSCLI {
await this.client.util.accounts.lock(parsed.Username, this.client.user.id, { reason: 'Failed to accept Terms of Service.' }); await this.client.util.accounts.lock(parsed.Username, this.client.user.id, { reason: 'Failed to accept Terms of Service.' });
break; break;
case 'ram': case 'ram':
const mem = Number(await this.client.util.exec(`memory ${parsed.Username}`)) * 1000; const memoryConversion = dataConversion(Number(await this.client.util.exec(`memory ${parsed.Username}`)) * 1000);
const memoryConversion = mem / 1024 / 1024;
socket.write(`${memoryConversion}\n`); socket.write(`${memoryConversion}\n`);
socket.destroy(); socket.destroy();
break; break;
case 'storage': case 'storage':
const res = await this.client.redis.get(`storage-${parsed.Username}`) ? Number(await this.client.redis.get(`storage-${parsed.Username}`)) : '0'; const res = await this.client.redis.get(`storage-${parsed.Username}`) ? dataConversion(Number(await this.client.redis.get(`storage-${parsed.Username}`))) : 'N/A';
socket.write(`${res}\n`); socket.write(`${res}\n`);
socket.destroy(); socket.destroy();
break; break;