Refactor
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { RedisClient } from "bun"
|
||||
import { LoadEventsOptions } from "~/typings"
|
||||
import { ExtendedClient as Client } from "~/utils/Client"
|
||||
import env from "./Env"
|
||||
import loadAllEvents from "./Events/loadevents"
|
||||
@@ -7,12 +8,9 @@ import { log } from "./Logger"
|
||||
const client = new Client()
|
||||
const redis = new RedisClient(env.prod.REDISURI)
|
||||
|
||||
const ft = bun__build !== true ? "ts" : "js"
|
||||
const dir = bun__docker !== true ? bun__build !== true ? "src" : "dist" : ""
|
||||
|
||||
class Illegitimate {
|
||||
async start() {
|
||||
await loadAllEvents(client, { ft, dir })
|
||||
await loadAllEvents(client, this.getOpts())
|
||||
await client.start()
|
||||
await this.databases()
|
||||
this.loadMethods()
|
||||
@@ -28,6 +26,20 @@ class Illegitimate {
|
||||
})
|
||||
}
|
||||
|
||||
private getOpts(): LoadEventsOptions {
|
||||
if (process.env.BUN__DOCKER === "true") {
|
||||
return {
|
||||
ft: "js",
|
||||
dir: ""
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
ft: "ts",
|
||||
dir: "src"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private loadMethods() {
|
||||
String.prototype.removeIndents = function(this: string) {
|
||||
return this.replace(/^ */gm, "")
|
||||
|
||||
Reference in New Issue
Block a user