From 443c20a559486b32602c3d3e709c981f6becc409 Mon Sep 17 00:00:00 2001 From: Taken Date: Sat, 30 Dec 2023 17:34:59 +0100 Subject: [PATCH] Updated scripts to new format --- scripts/delete-commands.ts | 6 +++--- scripts/deploy-commands.ts | 6 +++--- scripts/dev-deploy.ts | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/delete-commands.ts b/scripts/delete-commands.ts index 32ba53b..d6851c7 100644 --- a/scripts/delete-commands.ts +++ b/scripts/delete-commands.ts @@ -1,13 +1,13 @@ import { REST, Routes } from "discord.js" -import config from "../src/utils/Config" +import env from "../src/utils/Env" -const rest = new REST({ version: "10" }).setToken(config.dev.devtoken) +const rest = new REST({ version: "10" }).setToken(env.dev.devtoken!) async function deleteCommands() { try { console.log("Started deleting application (/) commands.") await rest.put( - Routes.applicationGuildCommands(config.dev.devid, config.dev.guildid), + Routes.applicationGuildCommands(env.dev.devid!, env.dev.guildid!), { body: [] }, ) console.log("Successfully deleted application (/) commands.") diff --git a/scripts/deploy-commands.ts b/scripts/deploy-commands.ts index 78e43b6..91e579d 100644 --- a/scripts/deploy-commands.ts +++ b/scripts/deploy-commands.ts @@ -1,8 +1,8 @@ import { REST, RESTGetAPIApplicationGuildCommandResult, RESTPutAPIApplicationCommandsJSONBody, Routes } from "discord.js" import fs from "node:fs" import { Command } from "../src/interfaces" -import config from "../src/utils/Config" -const rest = new REST({ version: "10" }).setToken(config.prod.token) +import env from "../src/utils/Env" +const rest = new REST({ version: "10" }).setToken(env.prod.token!) const commands: RESTPutAPIApplicationCommandsJSONBody = [] const commandFiles = fs.readdirSync("./dist/src/commands").filter(file => file.endsWith(".js")) @@ -22,7 +22,7 @@ for (const file of contentMenuCommands) { console.log(`Started refreshing ${commands.length} application (/) commands.`) const data = await rest.put( - Routes.applicationCommands(config.dev.clientid), + Routes.applicationCommands(env.dev.clientid!), { body: commands }, ) as RESTGetAPIApplicationGuildCommandResult[] diff --git a/scripts/dev-deploy.ts b/scripts/dev-deploy.ts index 598309e..1ea6f24 100644 --- a/scripts/dev-deploy.ts +++ b/scripts/dev-deploy.ts @@ -1,8 +1,8 @@ import { REST, RESTGetAPIApplicationGuildCommandResult, RESTPutAPIApplicationCommandsJSONBody, Routes } from "discord.js" import fs from "fs" -import config from "../src/utils/Config" +import env from "../src/utils/Env" import { Command } from "../src/interfaces" -const rest = new REST({ version: "10" }).setToken(config.dev.devtoken) +const rest = new REST({ version: "10" }).setToken(env.dev.devtoken!) const commands: RESTPutAPIApplicationCommandsJSONBody = [] const commandFiles = fs.readdirSync("./dist/src/commands/").filter(file => file.endsWith(".js")) @@ -26,7 +26,7 @@ for (const file of contentMenuCommands) { console.log(`Started refreshing ${commands.length} application (/) commands.`) const data = await rest.put( - Routes.applicationGuildCommands(config.dev.devid, config.dev.guildid), + Routes.applicationGuildCommands(env.dev.devid!, env.dev.guildid!), { body: commands }, ) as RESTGetAPIApplicationGuildCommandResult[]