mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
feat: stats setup
This commit is contained in:
1 parent
5f3d42c690
commit
bf7993fa38
8 files changed
+74
-13
No files matched your search
@@ -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 };
|
||||
|
||||
|
||||
Reference in new issue
Block a user