Skip to content

Commit

Permalink
[update] move deploy-commands into the module directory for better co…
Browse files Browse the repository at this point in the history
…de structure
  • Loading branch information
stho32 committed Oct 2, 2021
1 parent 33a7719 commit fef1ec4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion events/ready.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { registerSlashCommands } = require("../deploy-commands");
const { registerSlashCommands } = require("../modules/deploy-commands");

module.exports = {
name: "ready",
Expand Down
8 changes: 4 additions & 4 deletions deploy-commands.js → modules/deploy-commands.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const fs = require("fs");
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");
const { token } = require("./config.json");
const { token } = require("../config.json");
const rest = new REST({ version: "9" }).setToken(token);

const commands = [];
const commandFolders = fs.readdirSync("./commands");
const commandFolders = fs.readdirSync("../commands");

for (const folder of commandFolders) {
const commandFiles = fs
.readdirSync(`./commands/${folder}`)
.readdirSync(`../commands/${folder}`)
.filter((file) => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(`./commands/${folder}/${file}`);
const command = require(`../commands/${folder}/${file}`);
commands.push(command.data.toJSON());
}
}
Expand Down

0 comments on commit fef1ec4

Please sign in to comment.