Skip to content

Commit 395d491

Browse files
committed
manager/ready: Fix slash commands REST upload
1 parent 1a4fe99 commit 395d491

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ declare module "discord.js" {
1515
export type Config = {
1616
TOKEN: string;
1717
DEVTOKEN: string;
18+
CLIENT_ID: string;
19+
CLIENT_ID_DEV: string;
1820
MAX_PLAYLIST_SIZE: number;
1921
SOUNDCLOUD_CLIENT_ID: string;
2022
SPOTIFY_SECRET_ID: string;

src/components/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { Config } from "@common";
33
export const config: Config = {
44
TOKEN: process.env.TOKEN || "",
55
DEVTOKEN: process.env.DEVTOKEN || "",
6+
CLIENT_ID: process.env.CLIENT_ID || "",
7+
CLIENT_ID_DEV: process.env.CLIENT_ID_DEV || "",
68
SOUNDCLOUD_CLIENT_ID: process.env.SOUNDCLOUD_CLIENT_ID || "",
79
MAX_PLAYLIST_SIZE: Number(process.env.MAX_PLAYLIST_SIZE) || Number(20),
810
SPOTIFY_CLIENT_ID: process.env.SPOTIFY_CLIENT_ID || "",

src/manager/modules/ready.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { commands as infoCmds } from "commands/info/index.js";
55
import { commands as utilCmds } from "commands/utility/index.js";
66
import type { Bot } from "@components/Bot";
77
import chalk from "chalk";
8+
import { config } from "@components/config";
89

910
export async function ready(client: Bot): Promise<void> {
1011
await new Promise<void>(async (resolve) => {
@@ -25,7 +26,7 @@ export async function ready(client: Bot): Promise<void> {
2526
if (client.debug) Logger.info({ type: "DEVELOPMENT READY/CMDS", msg: `${commands[i].data.name} has been loaded.` });
2627
};
2728

28-
await client.rest.put(Routes.applicationCommands(client.user!.id), {
29+
await client.rest.put(Routes.applicationCommands(client.debug ? config.CLIENT_ID_DEV : config.CLIENT_ID), {
2930
body: commands.map(cmd => cmd.data.toJSON())
3031
});
3132
Logger.log({ type: "READY/CMDS", msg: `Registered ${chalk.blueBright(commands.length)} commands on Discord.` });

0 commit comments

Comments
 (0)