diff --git a/.eslintrc b/.eslintrc index c142c1f..63fb4f7 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,6 +5,7 @@ "rules": { "@typescript-eslint/no-non-null-assertion": "off", "quotes": [2, "single", { "avoidEscape": true, "allowTemplateLiterals" : true }], - "semi": ["error", "always"] + "semi": ["error", "always"], + "@typescript-eslint/no-empty-interface": 0 } - } \ No newline at end of file + } diff --git a/src/handler/logger.ts b/src/handler/logger.ts index 36a1f60..f9a38b8 100644 --- a/src/handler/logger.ts +++ b/src/handler/logger.ts @@ -22,7 +22,7 @@ export default class Logger { dayJS.tz.guess(); // add colored logging? const tz = dayJS().format(); - console.log(`[${tz}][${sEvent[e]}] @ ${guildId} :: ${message}`); + console.log(`[${tz}] [${sEvent[e]}] @ ${guildId} :: ${message}`); } /** diff --git a/src/handler/sern.ts b/src/handler/sern.ts index a7e5601..da9924a 100644 --- a/src/handler/sern.ts +++ b/src/handler/sern.ts @@ -15,6 +15,7 @@ import type { CommandInteraction, Message } from 'discord.js'; + import { Ok, None, Some } from 'ts-results'; import { isNotFromBot, hasPrefix, fmt } from './utilities/messageHelpers'; import Logger, { sEvent } from './logger'; @@ -43,12 +44,11 @@ export class Handler { **/ .on('ready', async () => { + this.defaultLogger.clear(); Files.buildData(this) .then(data => this.registerModules(data)); - wrapper.init?.(this); - this.defaultLogger.tableRam(); }) - + .on('messageCreate', async (message: Message) => { const isExecutable = AllTrue(isNotFromBot, hasPrefix); if (!isExecutable(message, this.prefix)) return; @@ -217,8 +217,7 @@ export class Handler { private findModuleFrom(ctx: T): Files.CommandVal | undefined { const name = ctx.applicationId === null ? fmt(ctx as Message, this.prefix).shift()! : (ctx as CommandInteraction).commandName; - const posCommand = Files.Commands.get(name) ?? Files.Alias.get(name); - return posCommand; + return Files.Commands.get(name) ?? Files.Alias.get(name); } /** diff --git a/src/handler/utilities/markup.ts b/src/handler/utilities/markup.ts index 15c9813..742fc47 100644 --- a/src/handler/utilities/markup.ts +++ b/src/handler/utilities/markup.ts @@ -1,4 +1,3 @@ -export module Markup { export enum TimestampStyles { BOTH_LONG = 'F', BOTH_SHORT = 'f', @@ -139,7 +138,7 @@ export module Markup { timestamp: Timestamp ) { let ret = FrozenTimestampStyles[using]; - for (let [key, value] of Object.entries(timestamp)) { + for (const [key, value] of Object.entries(timestamp)) { ret = ret.split(`{${key}}`).join(value); } return ret; @@ -148,7 +147,7 @@ export module Markup { const date = new Date(unix); const timestamp = formatDate(date); let ret = FrozenTimestampStyles[style]; - for (let [key, value] of Object.entries(timestamp)) { + for (const [key, value] of Object.entries(timestamp)) { ret = ret.split(`{${key}}`).join(value); } return ret; @@ -248,7 +247,7 @@ export module Markup { static timestamp( unix: number | Date | string, format: TimestampStyles = TimestampStyles.BOTH_SHORT, - isSeconds: boolean = false + isSeconds = false ) { if (typeof unix === 'string') unix = Number(unix); if (unix instanceof Date) unix = unix.getTime(); @@ -262,7 +261,7 @@ export module Markup { static date( unix: number | Date | string, format: TimestampStyles = TimestampStyles.BOTH_SHORT, - isSeconds: boolean = false + isSeconds = false ) { if (typeof unix === 'string') unix = Number(unix); if (unix instanceof Date) unix = unix.getTime(); @@ -423,7 +422,7 @@ export module Markup { match( type: DiscordRegexNames, - onlyFirst: boolean = false + onlyFirst = false ): DiscordRegexPayload { const regex = DiscordRegex[type]; if (regex === undefined) { @@ -529,7 +528,7 @@ export module Markup { static match( raw: string, what: DiscordRegexNames, - onlyFirst: boolean = false + onlyFirst = false ) { return new this(raw).match(what, onlyFirst); } @@ -558,4 +557,3 @@ export module Markup { return new this(raw).url(); } } -}