Files
desasterDiscordBot/registerCommands.js
T
2025-05-13 20:04:04 +02:00

48 lines
1.1 KiB
JavaScript

require('dotenv').config();
const { REST, Routes } = require('discord.js');
const commands = [
{
name: 'addbirthday',
description: 'Add your birthday',
options: [
{
name: 'month',
type: 4, // Integer
description: 'The month of your birthday (1-12)',
required: true,
},
{
name: 'day',
type: 4, // Integer
description: 'The day of your birthday (1-31)',
required: true,
},
],
},
{
name: 'viewbirthdays',
description: 'View all saved birthdays',
},
{
name: 'todaybirthdays',
description: 'Check who has a birthday today',
},
];
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationGuildCommands(process.env.CLIENT_ID, process.env.GUILD_ID),
{ body: commands }
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();