-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-commands.js
More file actions
55 lines (49 loc) · 1.59 KB
/
deploy-commands.js
File metadata and controls
55 lines (49 loc) · 1.59 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require('dotenv').config(); // Load environment variables
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
// Access environment variables
const clientId = process.env.CLIENT_ID;
const guildId = process.env.GUILD_ID;
const token = process.env.DISCORD_TOKEN;
// Define the slash commands for Go Fish
const commands = [
{
name: 'startgofish',
description: 'Start a new game of Go Fish!',
},
{
name: 'join',
description: 'Join an ongoing game of Go Fish!',
},
{
name: 'play',
description: 'Ask another player for a card rank!',
options: [
{
type: 6, // USER type for Discord options
name: 'target',
description: 'The player you want to ask',
required: true,
},
{
type: 3, // STRING type for Discord options
name: 'rank',
description: 'The rank of the card you are asking for (e.g., A, K, Q)',
required: true,
},
],
},
];
const rest = new REST({ version: '9' }).setToken(token);
(async () => {
try {
console.log('Started refreshing application (/) commands for Go Fish.');
await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
);
console.log('Successfully reloaded application (/) commands for Go Fish.');
} catch (error) {
console.error(error);
}
})();