Added new tryCatch wrapper

This commit is contained in:
2025-03-20 23:41:18 +01:00
parent e555417e13
commit 95f9bb723f
16 changed files with 255 additions and 269 deletions

View File

@@ -2,6 +2,7 @@ import { REST, RESTPutAPIApplicationCommandsJSONBody, Routes } from "discord.js"
import fs from "node:fs"
import { ICommand } from "../src/typings"
import env from "../src/utils/Env"
import tryCatch from "../src/utils/Functions/trycatch"
import { log } from "../src/utils/Logger"
const rest = new REST({ version: "10" }).setToken(env.prod.TOKEN)
@@ -18,7 +19,10 @@ for (const file of contentMenuCommands) {
commands.push(command.data.toJSON())
}
try {
const [error] = await tryCatch(updateCommands())
if (error) log(error, "error")
async function updateCommands() {
log(`Started refreshing ${commands.length} application (/) commands.`, "info", { type: "preset", color: "green" })
const commandsString = commands.map(command => " " + command.name)
@@ -31,6 +35,4 @@ try {
log(`Successfully reloaded ${commands.length} application (/) commands.`, "info", { type: "preset", color: "green" })
process.exit(0)
})
} catch (error) {
console.error(error)
}