-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
register.js
76 lines (71 loc) · 2.07 KB
/
register.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { REST } from "@discordjs/rest";
import { Routes } from "discord-api-types/v9";
import { createRequire } from "module";
const require = createRequire(import.meta.url);
var config = require('./config.json')
const commands = [{
name: 'add',
description: 'Will add the role to the user in both servers.',
options: [{
"name": "role",
"description": "The role to add in both servers",
"type": 8,
"required": true
},
{
"name": "user",
"description": "The user to add the role to in both servers",
"type": 6,
"required": true
}]
}, {
name: 'remove',
description: 'Will remove the role from the user in both servers.',
options: [{
"name": "role",
"description": "The role to remove in both servers",
"type": 8,
"required": true
},
{
"name": "user",
"description": "The user to remove the role to in both servers",
"type": 6,
"required": true
}]
}, {
"name": "role-checker",
"type": 1,
"description": "A role checker to compare roles between the main server and synced servers.",
"options": [
{
"name": "option",
"description": "Analyze sends a DM with the differences, force-sync will apply the changes shown in the analysis",
"type": 3,
"required": true,
"choices": [
{
"name": "analyze",
"value": "analyze"
},
{
"name": "force-sync",
"value": "force"
}
]
}
]
}];
const rest = new REST({ version: '9' }).setToken(config.token);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationGuildCommands(config.applicationId, config.mainServer),
{ body: commands },
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();