forked from engineering/cloudservices
various additions
parent
789c97f3ff
commit
8c7bf288c4
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue