Add uptime command

This commit is contained in:
Hri7566 2023-12-02 16:25:14 -05:00
parent b59e8800ac
commit bc7600cf8e
4 changed files with 39 additions and 2 deletions

View File

@ -15,6 +15,7 @@ MODERATOR:
- cosmic.commandGroup.economy
- cosmic.command.msg
- cosmic.command.memory
- cosmic.command.uptime
ADMINISTRATOR:
displayName: Administrator
inherits: MODERATOR

View File

@ -0,0 +1,24 @@
import { MicroHandler } from "../../../services/console/MicroHandler";
import { padNum } from "../../../util/Logger";
import { Command } from "../../Command";
export const uptime = new Command(
"uptime",
["uptime", "up"],
"get bot uptime bozo",
"uptime",
async (msg, agent) => {
const ms = Math.floor(process.uptime() * 1000);
const s = ms / 1000;
const m = s / 60;
const h = m / 60;
const ss = padNum(Math.floor(s) % 60, 2, "0");
const mm = padNum(Math.floor(m) % 60, 2, "0");
const hh = padNum(Math.floor(h) % 24, 2, "0");
const ll = padNum(ms % 1000, 3, "0");
return `Uptime: ${hh}:${mm}:${ss}.${ll}`;
}
);

View File

@ -12,6 +12,7 @@ import { inventory } from "./commands/economy/inventory";
import { color } from "./commands/utility/color";
import { role } from "./commands/utility/role";
import { ic } from "./commands/utility/ic";
import { uptime } from "./commands/utility/uptime";
export function loadCommands() {
// cringe
@ -28,6 +29,16 @@ export function loadCommands() {
CommandHandler.addCommandGroup(fun);
const utility = new CommandGroup("utility", "🔨 Utility");
utility.addCommands([math, memory, id, msg, cursor, color, role, ic]);
utility.addCommands([
math,
memory,
id,
msg,
cursor,
color,
role,
ic,
uptime
]);
CommandHandler.addCommandGroup(utility);
}

View File

@ -23,7 +23,8 @@ export const defaultConfig = {
permissions: [
"cosmic.commandGroup.economy",
"cosmic.command.msg",
"cosmic.command.memory"
"cosmic.command.memory",
"cosmic.command.uptime"
]
},
ADMINISTRATOR: {