Untitled

 avatar
unknown
plain_text
a year ago
1.7 kB
6
Indexable
require('dotenv').config();
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');

const commands = [
    {
        name: 'gstats',
        description: 'Shows the guild stats.',
        options: [
            {
                name: 'interval',
                description: 'The interval for stats (weekly, monthly, yearly, total)',
                type: 3,
                required: false,
                choices: [
                    { name: 'Weekly', value: 'weekly' },
                    { name: 'Monthly', value: 'monthly' },
                    { name: 'Yearly', value: 'yearly' },
                    { name: 'Total', value: 'total' }
                ]
            },
            {
                name: 'mode',
                description: 'The mode for stats (solo, doubles, triples, quads, all_modes)',
                type: 3,
                required: false,
                choices: [
                    { name: 'Solo', value: 'SOLO' },
                    { name: 'Doubles', value: 'DOUBLES' },
                    { name: 'Triples', value: 'TRIPLES' },
                    { name: 'Quads', value: 'QUADS' },
                    { name: 'All Modes', value: 'ALL_MODES' }
                ]
            }
        ]
    }
];

const rest = new REST({ version: '10' }).setToken(process.env.TOKEN);

(async () => {
    try {
        console.log('Registering slash commands...');

        await rest.put(
            Routes.applicationGuildCommands(process.env.CLIENT_ID, process.env.GUILD_ID),
            { body: commands }
        )

        console.log('Slash commands were registered successfully!');
    } catch (error) {
        console.log(There was an error: ${error});
    }
})();
Editor is loading...
Leave a Comment