Updated log function
This commit is contained in:
@@ -6,13 +6,13 @@ import { log } from "../src/utils/Logger"
|
||||
const rest = new REST({ version: "10" }).setToken(env.dev.DEVTOKEN)
|
||||
|
||||
const [error] = await tryCatch(deleteCommands())
|
||||
if (error) log(error, "error")
|
||||
if (error) log.error(error)
|
||||
|
||||
async function deleteCommands() {
|
||||
log("Started deleting application (/) commands.", "info")
|
||||
log.info("Started deleting application (/) commands.")
|
||||
await rest.put(
|
||||
Routes.applicationGuildCommands(env.dev.DEVID, env.dev.GUILDID),
|
||||
{ body: [] }
|
||||
)
|
||||
log("Successfully deleted application (/) commands.", "info")
|
||||
log.info("Successfully deleted application (/) commands.")
|
||||
}
|
||||
|
||||
@@ -20,19 +20,19 @@ for (const file of contentMenuCommands) {
|
||||
}
|
||||
|
||||
const [error] = await tryCatch(updateCommands())
|
||||
if (error) log(error, "error")
|
||||
if (error) log.error(error)
|
||||
|
||||
async function updateCommands() {
|
||||
log(`Started refreshing ${commands.length} application (/) commands.`, "info", { type: "preset", color: "green" })
|
||||
log.custom(`Started refreshing ${commands.length} application (/) commands.`, "info", { type: "preset", color: "green" })
|
||||
|
||||
const commandsString = commands.map(command => " " + command.name)
|
||||
log(commandsString.join("\n"), "info", { type: "preset", color: "lavender" })
|
||||
log.custom(commandsString.join("\n"), "info", { type: "preset", color: "lavender" })
|
||||
|
||||
await rest.put(
|
||||
Routes.applicationCommands(env.dev.CLIENTID),
|
||||
{ body: commands }
|
||||
).then(() => {
|
||||
log(`Successfully reloaded ${commands.length} application (/) commands.`, "info", { type: "preset", color: "green" })
|
||||
log.custom(`Successfully reloaded ${commands.length} application (/) commands.`, "info", { type: "preset", color: "green" })
|
||||
process.exit(0)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -24,16 +24,16 @@ for (const file of contentMenuCommands) {
|
||||
}
|
||||
|
||||
const [error] = await tryCatch(updateCommands())
|
||||
if (error) log(error, "error")
|
||||
if (error) log.error(error)
|
||||
|
||||
async function updateCommands() {
|
||||
log(`Started refreshing ${commands.length} application (/) commands.`, "info")
|
||||
log.info(`Started refreshing ${commands.length} application (/) commands.`)
|
||||
|
||||
await rest.put(
|
||||
Routes.applicationGuildCommands(env.dev.DEVID, env.dev.GUILDID),
|
||||
{ body: commands }
|
||||
).then(() => {
|
||||
log(`Successfully reloaded ${commands.length} application (/) commands.`, "info")
|
||||
log.info(`Successfully reloaded ${commands.length} application (/) commands.`)
|
||||
process.exit(0)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user