Horse Info Command

This commit is contained in:
Dragon Fire
2020-10-27 00:03:48 -04:00
parent 9cd4ebef38
commit b752ebe07e
6 changed files with 180 additions and 73 deletions
+7
View File
@@ -79,6 +79,13 @@ module.exports = class Util {
return number > 999 ? `${(number / 1000).toLocaleString(undefined, { maximumFractionDigits: 1 })}K` : number;
}
static formatTime(time) {
const min = Math.floor(time / 60);
const sec = Math.floor(time - (min * 60));
const ms = time - sec - (min * 60);
return `${min}:${sec.toString().padStart(2, '0')}.${ms.toFixed(4).slice(2)}`;
}
static base64(text, mode = 'encode') {
if (mode === 'encode') return Buffer.from(text).toString('base64');
if (mode === 'decode') return Buffer.from(text, 'base64').toString('utf8') || null;