-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-commands.js
More file actions
38 lines (35 loc) · 1.47 KB
/
Copy pathdeploy-commands.js
File metadata and controls
38 lines (35 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const { REST, Routes, ApplicationCommandOptionType } = require('discord.js');
async function deployCommands(client) {
const commands = [
{
name: 'tasklist',
description: '📋 Post the live task board in this channel',
},
{
name: 'addtask',
description: '➕ Quickly add a new task',
options: [
{ name: 'title', description: 'Task title', type: ApplicationCommandOptionType.String, required: true },
{ name: 'description', description: 'Task description', type: ApplicationCommandOptionType.String, required: false },
{ name: 'assignees', description: 'Mention users (e.g. @User1 @User2)', type: ApplicationCommandOptionType.String, required: false },
{ name: 'deadline', description: 'Deadline (YYYY-MM-DD or YYYY-MM-DD HH:MM)', type: ApplicationCommandOptionType.String, required: false },
{ name: 'reminder', description: 'Daily reminder until deadline?', type: ApplicationCommandOptionType.Boolean, required: false },
]
},
{
name: 'settings',
description: '⚙️ Configure timezone, working hours & reminders',
}
];
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN);
try {
await rest.put(
Routes.applicationCommands(client.user.id),
{ body: commands }
);
console.log('✅ Slash commands deployed globally');
} catch (error) {
console.error('Failed to deploy commands:', error);
}
}
module.exports = { deployCommands };