mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
some date parsing
This commit is contained in:
11
package-lock.json
generated
11
package-lock.json
generated
@@ -11,6 +11,7 @@
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
||||
"@typescript-eslint/parser": "^5.10.2",
|
||||
"dayjs": "^1.10.7",
|
||||
"discord.js": "^13.6.0",
|
||||
"eslint": "^8.8.0",
|
||||
"prettier": "^2.5.1",
|
||||
@@ -525,6 +526,11 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/dayjs": {
|
||||
"version": "1.10.7",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz",
|
||||
"integrity": "sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig=="
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
||||
@@ -1953,6 +1959,11 @@
|
||||
"which": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"dayjs": {
|
||||
"version": "1.10.7",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz",
|
||||
"integrity": "sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
||||
"@typescript-eslint/parser": "^5.10.2",
|
||||
"dayjs": "^1.10.7",
|
||||
"discord.js": "^13.6.0",
|
||||
"eslint": "^8.8.0",
|
||||
"prettier": "^2.5.1",
|
||||
@@ -23,4 +24,4 @@
|
||||
"devDependencies": {
|
||||
"typescript": "^4.5.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import dayjs from "dayjs"
|
||||
import utc from "dayjs/plugin/utc"
|
||||
import timezone from "dayjs/plugin/timezone"
|
||||
export class DefaultLogger implements Logger<DefaultEvent> {
|
||||
|
||||
clear () {
|
||||
@@ -5,7 +8,11 @@ export class DefaultLogger implements Logger<DefaultEvent> {
|
||||
}
|
||||
|
||||
log(message: string, e: DefaultEvent) {
|
||||
console.log(`[${DefaultEvent[e]}] ${message}`)
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
dayjs.tz.guess()
|
||||
const tz = dayjs().format()
|
||||
console.log(`[${tz}][${DefaultEvent[e]}] ${message}`)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { possibleOutput } from "../types/handler"
|
||||
import { Ok, Result, None, Some } from "ts-results";
|
||||
import type * as Utils from "./utils/preprocessors/args";
|
||||
import { CtxHandler } from "./utils/ctxHandler";
|
||||
import { DefaultLogger, Logger } from "./logger";
|
||||
import { DefaultEvent, DefaultLogger, Logger } from "./logger";
|
||||
|
||||
|
||||
/**
|
||||
@@ -26,9 +26,10 @@ export class Handler {
|
||||
logger === undefined
|
||||
? this.logger = new DefaultLogger()
|
||||
: this.logger = logger;
|
||||
|
||||
this.logger.clear();
|
||||
|
||||
this.logger.clear();
|
||||
this.logger.log("joe", DefaultEvent.MESSAGE);
|
||||
|
||||
|
||||
this.wrapper.client
|
||||
.on("ready", async () => {
|
||||
|
||||
Reference in New Issue
Block a user