From ad86658e11a26d01e86d1a83e0bbcecef57d3001 Mon Sep 17 00:00:00 2001 From: jacoobes Date: Sun, 13 Feb 2022 13:12:14 -0600 Subject: [PATCH] dir name fix, lowercase lint --- src/handler/Utilities/Preprocessors/args.ts | 2 +- src/handler/logger.ts | 20 ++++++++++++++++++-- src/handler/sern.ts | 10 ++++++---- src/index.ts | 6 +++--- src/types/handler.ts | 7 +------ 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/handler/Utilities/Preprocessors/args.ts b/src/handler/Utilities/Preprocessors/args.ts index de9d6c1..2cd02ab 100644 --- a/src/handler/Utilities/Preprocessors/args.ts +++ b/src/handler/Utilities/Preprocessors/args.ts @@ -1,5 +1,5 @@ import { Err, Ok, Result } from 'ts-results'; -import type { possibleOutput } from '../../../Types/Handler'; +import type { possibleOutput } from '../../../types/handler'; /** * Wrapper type taking `Ok(T)` or `Err(possibleOutput)` e.g `Result(e : T, message: string) { - console.log(`[${"ISOSTRING (todo) "}][${sEvent[e]}] :: ${message}`) + dayjs.extend(utc) + dayjs.extend(timezone) + dayjs.tz.guess() + const tz = dayjs().format(); + console.log(`[${`${tz}`}][${sEvent[e]}] :: ${message}`) + } + + public tableRam() { + throw Error("unimpl") + console.table( + Object.values(process.memoryUsage()) + .map(([k,v]) => { return {[k] : `${(Math.round(v) / 1024 / 1024 * 100) / 100}`} }) + .reduce(((r, c) => Object.assign(r, c)), {}) + ) } } \ No newline at end of file diff --git a/src/handler/sern.ts b/src/handler/sern.ts index 706d97e..1100886 100644 --- a/src/handler/sern.ts +++ b/src/handler/sern.ts @@ -1,12 +1,12 @@ -import * as Files from './Utilities/readFile'; -import type * as Utils from './Utilities/Preprocessors/args'; +import * as Files from './utilities/readFile'; +import type * as Utils from './utilities/preprocessors/args'; import type { Arg, Context, Visibility, possibleOutput -} from '../Types/Handler'; +} from '../types/handler'; import type { ApplicationCommandOptionData, @@ -17,7 +17,8 @@ import type { } from 'discord.js'; import { Ok, Result, None, Some } from 'ts-results'; -import { isBot, hasPrefix, fmt } from './Utilities/messageHelpers'; +import { isBot, hasPrefix, fmt } from './utilities/messageHelpers'; +import Logger from './logger'; /** @@ -47,6 +48,7 @@ export class Handler { Files.buildData(this) .then(data => this.registerModules(data)) if (wrapper.init !== undefined) wrapper.init(this); + new Logger().tableRam(); }) .on('messageCreate', async (message: any) => { diff --git a/src/index.ts b/src/index.ts index d7fa6c4..8de4cb0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ -import * as Sern from './Handler/sern'; -import * as Utils from './Handler/Utilities/Preprocessors/args'; -import * as Types from './Types/Handler'; +import * as Sern from './handler/sern'; +import * as Utils from './handler/utilities/preprocessors/args'; +import * as Types from './types/handler'; module.exports = { Sern, Utils, Types }; export { Sern, Utils, Types }; diff --git a/src/types/handler.ts b/src/types/handler.ts index b4e9e38..35e70b8 100644 --- a/src/types/handler.ts +++ b/src/types/handler.ts @@ -8,7 +8,7 @@ import type { MessageOptions } from 'discord.js'; -import type * as Sern from '../Handler/sern'; +import type * as Sern from '../handler/sern'; export type Visibility = 'private' | 'public'; @@ -28,13 +28,8 @@ export type Context = { message: Option, interaction: Option } -<<<<<<< HEAD export type Arg = ParseType<{ text: string, slash: SlashOptions }>; -======= -// `string` | `SlashOptions`, narrow down your type by checking `text` | `slash` -export type Arg = ParseType<{text : string, slash : SlashOptions}> ->>>>>>> 6ce7649311f1d077f6437528cbad10da16e58435 // TypeAlias for interaction.options export type SlashOptions = Omit;