-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-commands.js
More file actions
96 lines (86 loc) · 2.48 KB
/
Copy pathdeploy-commands.js
File metadata and controls
96 lines (86 loc) · 2.48 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
require('dotenv').config()
const fs = require('node:fs')
const { Routes } = require('discord.js')
const { REST } = require('@discordjs/rest')
function AddCommands(folder, array) {
console.log(`Adding ${folder} commands!`)
const commandFiles = fs
.readdirSync(`./commands/${folder}`)
.filter((file) => file.endsWith('.js'))
for (const file of commandFiles) {
const command = require(`./commands/${folder}/${file}`)
array.push(command.data.toJSON())
if (process.argv[2] === 'dev') EasyModoCommands.push(command.data.toJSON())
}
}
const CODSCommands = []
const EasyModoCommands = []
const MASKSCommands = []
console.log(`Adding general commands!`)
const CommonCommandFiles = fs
.readdirSync('./commands')
.filter((file) => file.endsWith('.js'))
for (const file of CommonCommandFiles) {
const command = require(`./commands/${file}`)
CODSCommands.push(command.data.toJSON())
EasyModoCommands.push(command.data.toJSON())
}
console.log(`Adding Easy Modo commands!`)
const EasyModoCommandFiles = fs
.readdirSync('./commands/EasyModo')
.filter((file) => file.endsWith('.js'))
for (const file of EasyModoCommandFiles) {
const command = require(`./commands/EasyModo/${file}`)
EasyModoCommands.push(command.data.toJSON())
}
AddCommands('CODS', CODSCommands)
AddCommands('MASKS', MASKSCommands)
//console.log('CODS: ', CODSCommands)
//console.log();
//console.log('EasyModo: ', EasyModoCommands);
//console.log();
//console.log('MASKS: ', MASKSCommands)
const rest = new REST({ version: '10' }).setToken(process.env.discordToken)
if (process.argv[2] !== 'dev') {
rest
.put(
Routes.applicationGuildCommands(process.env.clientID, process.env.CODSID),
{ body: CODSCommands },
)
.then(() =>
console.log('Successfully registered application commands to CODS.'),
)
.catch((error) => {
console.error(error)
})
rest
.put(
Routes.applicationGuildCommands(
process.env.clientID,
process.env.MASKSID,
),
{ body: MASKSCommands },
)
.then(() =>
console.log(
'Successfully registered application commands to Starboard Stars.',
),
)
.catch((error) => {
console.error(error)
})
}
rest
.put(
Routes.applicationGuildCommands(
process.env.clientID,
process.env.EasyModoID,
),
{ body: EasyModoCommands },
)
.then(() =>
console.log('Successfully registered application commands to EasyModo.'),
)
.catch((error) => {
console.error(error)
})