Files
illegitimate-bot/src/utils/Illegitimate.ts
2025-08-09 23:46:57 +02:00

40 lines
1.1 KiB
TypeScript

import { RedisClient } from "bun"
import { ExtendedClient as Client } from "~/utils/Client"
import env from "./Env"
import loadAllEvents from "./Events/loadevents"
import { log } from "./Logger"
const client = new Client()
const redis = new RedisClient(env.prod.REDISURI)
class Illegitimate {
async start() {
await loadAllEvents(client)
await client.start()
await this.databases()
this.loadMethods()
}
private async databases() {
redis.connect().then(() => {
log.custom("Connected to Redis", "info", { type: "preset", color: "green" })
}).catch(() => {
log.error("Failed to connect to Redis")
}).finally(() => {
redis.close()
})
}
private loadMethods() {
String.prototype.removeIndents = function(this: string) {
return this.replace(/^ */gm, "")
}
String.prototype.capitalizeFirstLetter = function(this: string) {
return this[0].toUpperCase() + this.slice(1).toLowerCase()
}
}
}
export { client, Illegitimate, redis }