Added bun bundle

This commit is contained in:
2025-08-10 20:57:27 +02:00
parent 30e18257d0
commit b4f0a2c8dc
16 changed files with 88 additions and 98 deletions

View File

@@ -8,9 +8,9 @@ import logToChannel from "~/utils/Functions/logtochannel"
import tryCatch from "../Functions/trycatch"
import { log } from "../Logger"
export default async function loadAutocompleteEvents(client: Client) {
const autocompletePath = path.join(import.meta.dirname, "..", "..", "components", "autocomplete")
const autocompleteFiles = fs.readdirSync(autocompletePath).filter(file => file.endsWith(".ts"))
export default async function loadAutocompleteEvents(client: Client, ft: "ts" | "js", folder: "src" | "dist") {
const autocompletePath = path.join(process.cwd(), folder, "components", "autocomplete")
const autocompleteFiles = fs.readdirSync(autocompletePath).filter(file => file.endsWith(`.${ft}`))
for (const file of autocompleteFiles) {
const filePath = path.join(autocompletePath, file)

View File

@@ -8,9 +8,9 @@ import logToChannel from "~/utils/Functions/logtochannel"
import tryCatch from "../Functions/trycatch"
import { log } from "../Logger"
export default async function loadButtonEvents(client: Client) {
const btnPath = path.join(import.meta.dirname, "..", "..", "components", "buttons")
const btnFiles = fs.readdirSync(btnPath).filter(file => file.endsWith(".ts"))
export default async function loadButtonEvents(client: Client, ft: "ts" | "js", folder: "src" | "dist") {
const btnPath = path.join(process.cwd(), folder, "components", "buttons")
const btnFiles = fs.readdirSync(btnPath).filter(file => file.endsWith(`.${ft}`))
for (const file of btnFiles) {
const filePath = path.join(btnPath, file)

View File

@@ -8,9 +8,9 @@ import logToChannel from "~/utils/Functions/logtochannel"
import tryCatch from "../Functions/trycatch"
import { log } from "../Logger"
export default async function loadSlashCommandsEvents(client: Client) {
const cmdPath = path.join(import.meta.dirname, "..", "..", "commands")
const cmdFiles = fs.readdirSync(cmdPath).filter(file => file.endsWith(".ts"))
export default async function loadSlashCommandsEvents(client: Client, ft: "ts" | "js", folder: "src" | "dist") {
const cmdPath = path.join(process.cwd(), folder, "commands")
const cmdFiles = fs.readdirSync(cmdPath).filter(file => file.endsWith(`.${ft}`))
for (const file of cmdFiles) {
const filePath = path.join(cmdPath, file)

View File

@@ -8,9 +8,9 @@ import logToChannel from "~/utils/Functions/logtochannel"
import tryCatch from "../Functions/trycatch"
import { log } from "../Logger"
export default async function loadContextMenuEvents(client: Client) {
const contextMenuPath = path.join(import.meta.dirname, "..", "..", "commands-contextmenu")
const contextMenuFiles = fs.readdirSync(contextMenuPath).filter(file => file.endsWith(".ts"))
export default async function loadContextMenuEvents(client: Client, ft: "ts" | "js", folder: "src" | "dist") {
const contextMenuPath = path.join(process.cwd(), folder, "commands-contextmenu")
const contextMenuFiles = fs.readdirSync(contextMenuPath).filter(file => file.endsWith(`.${ft}`))
for (const file of contextMenuFiles) {
const filePath = path.join(contextMenuPath, file)

View File

@@ -3,9 +3,9 @@ import fs from "fs"
import path from "path"
import { ICron } from "~/typings"
export default async function loadCronEvents() {
const cronPath = path.join(import.meta.dirname, "..", "..", "events", "cron")
const cronFiles = fs.readdirSync(cronPath).filter(file => file.endsWith(".ts"))
export default async function loadCronEvents(ft: "ts" | "js", folder: "src" | "dist") {
const cronPath = path.join(process.cwd(), folder, "events", "cron")
const cronFiles = fs.readdirSync(cronPath).filter(file => file.endsWith(`.${ft}`))
for (const file of cronFiles) {
const filePath = path.join(cronPath, file)

View File

@@ -2,11 +2,11 @@ import fs from "fs"
import path from "path"
import { ExtendedClient as Client } from "~/utils/Client"
export default async function loadEvents(client: Client) {
const serverDir = path.join(import.meta.dirname, "..", "..", "events", "server")
export default async function loadEvents(client: Client, ft: "ts" | "js", folder: "src" | "dist") {
const serverDir = path.join(process.cwd(), folder, "events", "server")
const eventDirs = fs.readdirSync(serverDir)
for (const eventDir of eventDirs) {
const eventFiles = fs.readdirSync(path.join(serverDir, eventDir)).filter(file => file.endsWith(".ts"))
const eventFiles = fs.readdirSync(path.join(serverDir, eventDir)).filter(file => file.endsWith(`.${ft}`))
const eventName = eventDir
for (const eventFile of eventFiles) {
const eventPath = path.join(serverDir, eventDir, eventFile)

View File

@@ -8,12 +8,12 @@ import loadCronEvents from "./cron"
import loadEvents from "./events"
import loadModalEvents from "./modal"
export default async function loadAllEvents(client: ExtendedClient) {
await loadEvents(client).then(() => log.info("Events loaded"))
await loadButtonEvents(client).then(() => log.info("Button events loaded"))
await loadSlashCommandsEvents(client).then(() => log.info("Slash commands loaded"))
await loadContextMenuEvents(client).then(() => log.info("Context menu events loaded"))
await loadModalEvents(client).then(() => log.info("Modal events loaded"))
await loadAutocompleteEvents(client).then(() => log.info("Autocomplete events loaded"))
await loadCronEvents().then(() => log.info("Cron events loaded"))
export default async function loadAllEvents(client: ExtendedClient, ft: "js" | "ts", folder: "dist" | "src") {
await loadEvents(client, ft, folder).then(() => log.info("Events loaded"))
await loadButtonEvents(client, ft, folder).then(() => log.info("Button events loaded"))
await loadSlashCommandsEvents(client, ft, folder).then(() => log.info("Slash commands loaded"))
await loadContextMenuEvents(client, ft, folder).then(() => log.info("Context menu events loaded"))
await loadModalEvents(client, ft, folder).then(() => log.info("Modal events loaded"))
await loadAutocompleteEvents(client, ft, folder).then(() => log.info("Autocomplete events loaded"))
await loadCronEvents(ft, folder).then(() => log.info("Cron events loaded"))
}

View File

@@ -8,9 +8,9 @@ import logToChannel from "~/utils/Functions/logtochannel"
import tryCatch from "../Functions/trycatch"
import { log } from "../Logger"
export default async function loadModalEvents(client: Client) {
const modalPath = path.join(import.meta.dirname, "..", "..", "components", "modals")
const modalFiles = fs.readdirSync(modalPath).filter(file => file.endsWith(".ts"))
export default async function loadModalEvents(client: Client, ft: "ts" | "js", folder: "src" | "dist") {
const modalPath = path.join(process.cwd(), folder, "components", "modals")
const modalFiles = fs.readdirSync(modalPath).filter(file => file.endsWith(`.${ft}`))
for (const file of modalFiles) {
const filePath = path.join(modalPath, file)

View File

@@ -7,9 +7,12 @@ import { log } from "./Logger"
const client = new Client()
const redis = new RedisClient(env.prod.REDISURI)
const ft = process.env.BUILD !== "true" ? "ts" : "js"
const folder = process.env.BUILD !== "true" ? "src" : "dist"
class Illegitimate {
async start() {
await loadAllEvents(client)
await loadAllEvents(client, ft, folder)
await client.start()
await this.databases()
this.loadMethods()