Skip to content

Commit eba5d98

Browse files
committed
fix: deploy function logs to default
1 parent 5ca72ac commit eba5d98

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const Routes = {
2222
* Otherwise the check for a guild ID is omitted, and you could make pointless requests which can also result in an error
2323
*/
2424
export async function deployCommands(folderPath, opts) {
25-
var _a;
25+
var _a, _b;
26+
opts.logs = (_a = opts.logs) !== null && _a !== void 0 ? _a : true;
2627
if (!opts.appToken || !opts.appId) {
2728
throw new Error("Missing 'appToken' or 'appId' in 'opts'!");
2829
}
@@ -34,13 +35,13 @@ export async function deployCommands(folderPath, opts) {
3435
try {
3536
const rest = new REST().setToken(opts.appToken);
3637
for (const file of commandFiles) {
37-
const filePath = path.join(folderPath, file);
38+
const filePath = "file://" + path.join(folderPath, file);
3839
const command = (await import(filePath)).default;
3940
if (!("data" in command)) {
4041
console.error(`- Command '${command.name}' is missing the 'data' property!`);
4142
continue;
4243
}
43-
else if ("data" in command && Boolean((_a = command.ignore) !== null && _a !== void 0 ? _a : false)) {
44+
else if ("data" in command && Boolean((_b = command.ignore) !== null && _b !== void 0 ? _b : false)) {
4445
if (opts.logs)
4546
console.log(`- Command '${command.data.name}' is ignored!`);
4647
continue;

index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ export async function deployCommands(
3232
folderPath: string,
3333
opts: DeployOptions
3434
): Promise<boolean> {
35+
opts.logs = opts.logs ?? true;
3536
if (!opts.appToken || !opts.appId) {
3637
throw new Error("Missing 'appToken' or 'appId' in 'opts'!");
3738
}
39+
3840
let commands = [];
3941
let privateCommands = [];
4042

@@ -49,7 +51,7 @@ export async function deployCommands(
4951
const rest = new REST().setToken(opts.appToken);
5052

5153
for (const file of commandFiles) {
52-
const filePath = path.join(folderPath, file);
54+
const filePath = "file://" + path.join(folderPath, file);
5355
const command = (await import(filePath)).default;
5456
if (!("data" in command)) {
5557
console.error(

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-helper",
3-
"version": "4.0.1",
3+
"version": "4.0.2",
44
"description": "A simple, easy to use module that houses functions to can refresh global and guild specific commands for your Discord App.",
55
"main": "./index.js",
66
"types": "./types.d.ts",

0 commit comments

Comments
 (0)