-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.js
39 lines (35 loc) · 1012 Bytes
/
deploy.js
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
import { REST } from "@discordjs/rest";
import { Routes } from "discord-api-types/v9";
import dotenv from "dotenv";
dotenv.config({ path: ".env" });
const { DISCORD_CLIENT_ID, DISCORD_TOKEN } = process.env;
const commands = [
{
name: "cf",
description: "Post all threads for a Codeforces contest",
options: [
{
name: "contest",
type: 4, // integer
description: "The ID of the Codeforces contest",
required: true,
},
{
name: "forum",
type: 3, // string
description: "The name of the forum channel to post in",
required: true,
},
],
},
];
const rest = new REST({ version: "9" }).setToken(DISCORD_TOKEN);
(async () => {
try {
console.log("Started refreshing application (/) commands.");
await rest.put(Routes.applicationCommands(DISCORD_CLIENT_ID), { body: commands });
console.log("Successfully reloaded application (/) commands.");
} catch (error) {
console.error(error);
}
})();