From 552ade4d0b6dc1ebc5214b25e57078958e1d9a86 Mon Sep 17 00:00:00 2001 From: SrIzan10 <66965250+SrIzan10@users.noreply.github.com> Date: Sat, 3 Sep 2022 22:47:56 +0200 Subject: [PATCH] fix: uptime command breaking the ENTIRE BOT --- commands/misc/uptime.ts | 7 ++++--- package-lock.json | 38 +++++++++++++++++++++++++++++++++++++- package.json | 3 ++- tsconfig.json | 10 +++++++--- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/commands/misc/uptime.ts b/commands/misc/uptime.ts index eaa2e14..59ab4a1 100644 --- a/commands/misc/uptime.ts +++ b/commands/misc/uptime.ts @@ -1,6 +1,6 @@ -import { commandModule, CommandType } from '@sern/handler' +const { commandModule, CommandType } = require('@sern/handler'); import { publish } from "../../src/plugins/publish"; -import prettyMilliseconds from 'pretty-ms'; +const prettyMilliseconds = require('pretty-ms'); export default commandModule({ name: 'uptime', @@ -10,6 +10,7 @@ export default commandModule({ //alias : [], options: [], execute: async (ctx, options) => { - await ctx.reply(`El bot lleva encendido ${prettyMilliseconds(ctx.client.uptime!)}`); + const uptime = prettyMilliseconds(ctx.client.uptime!) + await ctx.reply(`El bot lleva encendido ${uptime}`); }, }); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 19b5e75..161aa80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,8 @@ "ffmpeg-static": "^5.0.2", "got": "^11.8.5", "libsodium-wrappers": "^0.7.10", - "mongoose": "^6.5.1" + "mongoose": "^6.5.1", + "pretty-ms": "^7.0.1" }, "devDependencies": { "ts-node": "10.9.1", @@ -1925,6 +1926,14 @@ "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==" }, + "node_modules/parse-ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz", + "integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==", + "engines": { + "node": ">=6" + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -1983,6 +1992,20 @@ "node": ">=10" } }, + "node_modules/pretty-ms": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz", + "integrity": "sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==", + "dependencies": { + "parse-ms": "^2.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/prism-media": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.4.tgz", @@ -4257,6 +4280,11 @@ "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==" }, + "parse-ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz", + "integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==" + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -4296,6 +4324,14 @@ "tunnel-agent": "^0.6.0" } }, + "pretty-ms": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz", + "integrity": "sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==", + "requires": { + "parse-ms": "^2.1.0" + } + }, "prism-media": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.4.tgz", diff --git a/package.json b/package.json index 84b5c14..4243575 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "ffmpeg-static": "^5.0.2", "got": "^11.8.5", "libsodium-wrappers": "^0.7.10", - "mongoose": "^6.5.1" + "mongoose": "^6.5.1", + "pretty-ms": "^7.0.1" }, "devDependencies": { "ts-node": "10.9.1", diff --git a/tsconfig.json b/tsconfig.json index 37fe2e4..644c57b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,8 +11,8 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + "target": "ES2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "lib": ["ES2022"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ @@ -71,7 +71,7 @@ /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - // "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ @@ -99,5 +99,9 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "ts-node": { + "esm": true, + "experimentalSpecifierResolution": "node", } } \ No newline at end of file