Added new tryCatch wrapper
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user