Memory command

This commit is contained in:
Hri7566 2024-02-22 22:25:33 -05:00
parent ae1f032cad
commit f7490c1190
2 changed files with 20 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import { inventory } from "./inventory/inventory";
import { eat } from "./inventory/eat"; import { eat } from "./inventory/eat";
import { sack } from "./inventory/sack"; import { sack } from "./inventory/sack";
import { reel } from "./fishing/reel"; import { reel } from "./fishing/reel";
import { memory } from "./util/mem";
interface ICommandGroup { interface ICommandGroup {
id: string; id: string;
@ -48,7 +49,7 @@ commandGroups.push(inventoryGroup);
const utilGroup: ICommandGroup = { const utilGroup: ICommandGroup = {
id: "util", id: "util",
displayName: "Utility", displayName: "Utility",
commands: [data, setcolor] commands: [data, setcolor, memory]
}; };
commandGroups.push(utilGroup); commandGroups.push(utilGroup);

View File

@ -0,0 +1,18 @@
import Command from "@server/commands/Command";
export const memory = new Command(
"memory",
["memory", "mem"],
"View memory usage",
"memory",
"command.util.memory",
async () => {
const mem = process.memoryUsage();
return `Memory: ${(mem.heapUsed / 1024 / 1024).toFixed(2)}m / ${(
mem.heapTotal /
1024 /
1024
).toFixed(2)}m / ${(mem.rss / 1024 / 1024).toFixed(2)}m`;
},
false
);