Moved to zod

This commit is contained in:
2024-12-24 22:40:03 +01:00
parent 3797fa1c47
commit 5d81665cf8
6 changed files with 188 additions and 70 deletions

View File

@@ -3,7 +3,6 @@ import { YoutubeiExtractor } from "discord-player-youtubei"
import { Redis } from "ioredis"
import { ExtendedClient as Client } from "~/utils/Client.js"
import env from "~/utils/Env.js"
import { MissingEnvVarsError } from "./Classes.js"
import loadAllEvents from "./Events/loadevents.js"
import { log } from "./Logger.js"
@@ -20,7 +19,6 @@ if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT === "true") {
class Illegitimate {
async start() {
await this.init()
await loadAllEvents(client, ft)
// await player.extractors.loadDefault()
await player.extractors.loadDefault(ext => ext != "YouTubeExtractor")
@@ -36,24 +34,6 @@ class Illegitimate {
})
}
private async init() {
const prodValues = env.prod
const devValues = env.dev
if (process.env.NODE_ENV === "dev") {
for (const [key, value] of Object.entries(devValues)) {
if (!value) throw new MissingEnvVarsError(`No ${key} specified`)
}
for (const [key, value] of Object.entries(prodValues)) {
if (!value) throw new MissingEnvVarsError(`No ${key} specified`)
}
} else {
for (const [key, value] of Object.entries(prodValues)) {
if (!value) throw new MissingEnvVarsError(`No ${key} specified`)
}
}
}
private loadMethods() {
String.prototype.removeIndents = function(this: string) {
return this.replace(/^ */gm, "")