General structure works

This commit is contained in:
2025-06-22 21:10:15 -04:00
parent de638f3e98
commit b307630642
7 changed files with 105 additions and 5 deletions

View File

@@ -0,0 +1,32 @@
import { REST, Routes } from "discord.js"
import { config } from "../../config"
import { commands } from "../../commands"
const commandsData = Object.values(commands)
.filter((command) => command.enabled)
.map((command) => command.data)
const rest : REST = new REST({ version: "10" }).setToken(config.DISCORD_TOKEN)
export async function deployCommands(guildId: string) {
try {
// TODO Winston should handle this
console.log(`Refreshing slash commands for ${guildId}`)
await rest.put(
Routes.applicationGuildCommands(
config.DISCORD_CLIENT_ID,
guildId
),
{
body: commandsData
}
)
// TODO Winston should handle this
console.log(`Successfully reloaded slash commands for ${guildId}`)
} catch (error) {
// TODO Winston should handle this
console.error(error)
}
}