mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
uptime command
This commit is contained in:
parent
62376669c8
commit
e9b55c020e
1 changed files with 35 additions and 0 deletions
35
commands/message/dev/uptime.js
Normal file
35
commands/message/dev/uptime.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
const { editOrReply } = require('../../../labscore/utils/message')
|
||||||
|
const { highlight } = require('../../../labscore/utils/markdown')
|
||||||
|
|
||||||
|
function format(seconds){
|
||||||
|
function pad(s){
|
||||||
|
return (s < 10 ? '0' : '') + s;
|
||||||
|
}
|
||||||
|
var hours = Math.floor(seconds / (60*60));
|
||||||
|
var minutes = Math.floor(seconds % (60*60) / 60);
|
||||||
|
var seconds = Math.floor(seconds % 60);
|
||||||
|
|
||||||
|
return pad(hours) + ' Hours, ' + pad(minutes) + ' Minutes, ' + pad(seconds) + ' Seconds'
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "uptime",
|
||||||
|
metadata: {
|
||||||
|
description: 'bot uptime',
|
||||||
|
examples: ['uptime'],
|
||||||
|
category: 'dev',
|
||||||
|
usage: 'uptime'
|
||||||
|
},
|
||||||
|
onBefore: context => context.user.isClientOwner,
|
||||||
|
onCancel: context =>
|
||||||
|
context.reply(
|
||||||
|
`${context.user.mention}, you are lacking the permission \`BOT_OWNER\`.`
|
||||||
|
),
|
||||||
|
run: async (context, args) => {
|
||||||
|
await context.triggerTyping();
|
||||||
|
|
||||||
|
return await editOrReply(context, {
|
||||||
|
"content": `up for ${highlight(format(process.uptime()))}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue