import { DefaultExtractors } from "@discord-player/extractor" import { Player } from "discord-player" import { Redis } from "ioredis" import { ExtendedClient as Client } from "~/utils/Client.js" import env from "~/utils/Env.js" import loadAllEvents from "./Events/loadevents.js" import { log } from "./Logger.js" const client = new Client() const redis = new Redis(env.prod.redisURI) const player = new Player(client) let ft: "js" | "ts" if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT === "true") { ft = "ts" } else { ft = "js" } class Illegitimate { async start() { await loadAllEvents(client, ft) await player.extractors.loadMulti(DefaultExtractors) await client.start() await this.databases() this.loadMethods() } private async databases() { redis.on("ready", () => { log("Connected to Redis", "info", { type: "preset", color: "green" }) }) } 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 }