mirror of
https://github.com/sern-handler/handler
synced 2026-06-24 08:42:17 +00:00
dir name fix, lowercase lint
This commit is contained in:
@@ -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<T, possibleOutput`
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import dayjs from "dayjs";
|
||||
import timezone from "dayjs/plugin/timezone";
|
||||
import utc from "dayjs/plugin/timezone";
|
||||
|
||||
enum sEvent {
|
||||
GLOBAL_SLASH,
|
||||
@@ -8,9 +11,22 @@ enum sEvent {
|
||||
|
||||
}
|
||||
|
||||
class Logger {
|
||||
export default class Logger {
|
||||
|
||||
public log<T extends sEvent>(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)), {})
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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<Message>,
|
||||
interaction: Option<CommandInteraction>
|
||||
}
|
||||
<<<<<<< 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<CommandInteractionOptionResolver, 'getMessage' | 'getFocused'>;
|
||||
|
||||
Reference in New Issue
Block a user