Add uptime command
This commit is contained in:
parent
b59e8800ac
commit
bc7600cf8e
|
@ -15,6 +15,7 @@ MODERATOR:
|
||||||
- cosmic.commandGroup.economy
|
- cosmic.commandGroup.economy
|
||||||
- cosmic.command.msg
|
- cosmic.command.msg
|
||||||
- cosmic.command.memory
|
- cosmic.command.memory
|
||||||
|
- cosmic.command.uptime
|
||||||
ADMINISTRATOR:
|
ADMINISTRATOR:
|
||||||
displayName: Administrator
|
displayName: Administrator
|
||||||
inherits: MODERATOR
|
inherits: MODERATOR
|
||||||
|
|
|
@ -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}`;
|
||||||
|
}
|
||||||
|
);
|
|
@ -12,6 +12,7 @@ import { inventory } from "./commands/economy/inventory";
|
||||||
import { color } from "./commands/utility/color";
|
import { color } from "./commands/utility/color";
|
||||||
import { role } from "./commands/utility/role";
|
import { role } from "./commands/utility/role";
|
||||||
import { ic } from "./commands/utility/ic";
|
import { ic } from "./commands/utility/ic";
|
||||||
|
import { uptime } from "./commands/utility/uptime";
|
||||||
|
|
||||||
export function loadCommands() {
|
export function loadCommands() {
|
||||||
// cringe
|
// cringe
|
||||||
|
@ -28,6 +29,16 @@ export function loadCommands() {
|
||||||
CommandHandler.addCommandGroup(fun);
|
CommandHandler.addCommandGroup(fun);
|
||||||
|
|
||||||
const utility = new CommandGroup("utility", "🔨 Utility");
|
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);
|
CommandHandler.addCommandGroup(utility);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ export const defaultConfig = {
|
||||||
permissions: [
|
permissions: [
|
||||||
"cosmic.commandGroup.economy",
|
"cosmic.commandGroup.economy",
|
||||||
"cosmic.command.msg",
|
"cosmic.command.msg",
|
||||||
"cosmic.command.memory"
|
"cosmic.command.memory",
|
||||||
|
"cosmic.command.uptime"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
ADMINISTRATOR: {
|
ADMINISTRATOR: {
|
||||||
|
|
Loading…
Reference in New Issue