Skip to content

Commit 570d652

Browse files
committed
fixed issue with relative folder-path
1 parent a62e590 commit 570d652

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ module.exports = {
5959
const { Events, GatewayIntentBits } = require("discord.js");
6060
// Name it whatever you want
6161
const Client = require("djs-command-deployer");
62+
const { join: pathJoin } = require("node:path");
6263

6364
const { token } = require("./config.json");
6465

@@ -74,7 +75,10 @@ client.once(Events.ClientReady, (readyClient) => {
7475
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
7576

7677
// Call the CommandDeployer to refresh your commands
77-
client.deployCommands("commands/utility"); // Optional: logOptions object
78+
readyClient.deployCommands(
79+
pathJoin(__dirname, "commands", "utility")
80+
// Optional: logOptions object
81+
);
7882
});
7983

8084
// Log in to Discord with your client's token

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ module.exports = class cDClient extends Client {
2222
* To update guild-specific commands correctly, make sure the bot is logged in.\
2323
* Otherwise the check for a guild ID is omitted, and you could make pointless requests which can also result in an error
2424
*
25-
* @param {string} folderPath The relative path to your commands folder (the command files have to be directly in it!)
25+
* @param {string} folderPath The absolute path to your commands folder (the command files have to be directly in it!)
2626
* @param {string} token The bot's token (if the client isn't logged in yet)
2727
* @param {DEFAULT_OPTS} logOptions Whether to log what command was ignored, created, updated or deleted
2828
*/
2929
async deployCommands(
30-
folderPath = "./commands/utility",
30+
folderPath,
3131
token = null,
3232
logOptions = DEFAULT_OPTS
3333
) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "djs-command-deployer",
3-
"version": "0.5.3",
3+
"version": "0.5.4",
44
"description": "",
55
"main": "./index.js",
66
"scripts": {},

0 commit comments

Comments
 (0)