-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.js
More file actions
44 lines (22 loc) · 754 Bytes
/
Copy pathdeploy.js
File metadata and controls
44 lines (22 loc) · 754 Bytes
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
module.exports = async function deploy (client, guild = null) {
const commands = require("./commands");
if (!client.application?.owner) {
await client.application?.fetch();
}
const data = [];
for (const name in commands) {
if (Object.hasOwnProperty.call(commands, name)) {
const command = commands[name];
if (command.commandData) {
data.push(command.commandData);
}
}
}
let setCommands = null;
if (guild) {
setCommands = client.guilds.cache.get(guild)?.commands.set(data);
} else {
setCommands = client.application?.commands.set(data);
}
setCommands.then(console.log);
};