feat: stats setup

This commit is contained in:
TresAbhi committed 2023-04-22 01:58:42 +00:00
1 parent 5f3d42c690
commit bf7993fa38
8 files changed
+74 -13

No files matched your search

+8 -3
View File
@@ -9,8 +9,10 @@ import {
} from 'discord.js';
import { readdirSync } from 'fs';
import discord from '../../discord.json' assert { type: 'json' };
import getClientId from '../utilities/getClientId.js';
export interface CommandRegistry {
disabled?: boolean;
data: SlashCommandBuilder;
execute: (interaction: Interaction) => void;
}
@@ -22,15 +24,18 @@ const rest = new REST().setToken(process.env.DISCORD_TOKEN!);
for (const file of commandFolders) {
const command = (await import(`../commands/${file}`)) as CommandRegistry;
commands.push(command.data.toJSON());
commandCollection.set(command.data.name, command);
if (!command.disabled) {
commands.push(command.data.toJSON());
commandCollection.set(command.data.name, command);
}
}
try {
console.log(`Started refreshing ${commands.length} command(s).`);
const data = (await rest.put(
Routes.applicationGuildCommands(discord.client_id, discord.guild_id),
Routes.applicationGuildCommands(getClientId(), discord.guild_id),
{ body: commands },
)) as { length: number };