first commit

This commit is contained in:
khuongnguyen committed 2026-11-28 20:37:00 +07:00
commit 41d9e9e8eb
21 files changed
+3538

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import { REST, Routes } from "discord.js";
import { vpsCommandData } from "./commands/vps.command.js";
import { getEnv } from "./config/env.js";
async function deployCommands() {
try {
const env = getEnv();
console.log("🚀 Starting deployment of Discord Slash Commands...");
const commands = [vpsCommandData.toJSON()];
const rest = new REST({ version: "10" }).setToken(env.DISCORD_TOKEN);
console.log(`📦 Registering ${commands.length} application command(s) to Guild ID: ${env.DISCORD_GUILD_ID}`);
const data = (await rest.put(
Routes.applicationGuildCommands(env.DISCORD_CLIENT_ID, env.DISCORD_GUILD_ID),
{ body: commands }
)) as unknown[];
console.log(`✅ Successfully deployed ${data.length} slash command(s) to guild ${env.DISCORD_GUILD_ID}.`);
} catch (error) {
console.error("❌ Failed to deploy slash commands:", (error as Error).message);
process.exit(1);
}
}
deployCommands();