File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ const Routes = {
22
22
* Otherwise the check for a guild ID is omitted, and you could make pointless requests which can also result in an error
23
23
*/
24
24
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 ;
26
27
if ( ! opts . appToken || ! opts . appId ) {
27
28
throw new Error ( "Missing 'appToken' or 'appId' in 'opts'!" ) ;
28
29
}
@@ -34,13 +35,13 @@ export async function deployCommands(folderPath, opts) {
34
35
try {
35
36
const rest = new REST ( ) . setToken ( opts . appToken ) ;
36
37
for ( const file of commandFiles ) {
37
- const filePath = path . join ( folderPath , file ) ;
38
+ const filePath = "file://" + path . join ( folderPath , file ) ;
38
39
const command = ( await import ( filePath ) ) . default ;
39
40
if ( ! ( "data" in command ) ) {
40
41
console . error ( `- Command '${ command . name } ' is missing the 'data' property!` ) ;
41
42
continue ;
42
43
}
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 ) ) {
44
45
if ( opts . logs )
45
46
console . log ( `- Command '${ command . data . name } ' is ignored!` ) ;
46
47
continue ;
Original file line number Diff line number Diff line change @@ -32,9 +32,11 @@ export async function deployCommands(
32
32
folderPath : string ,
33
33
opts : DeployOptions
34
34
) : Promise < boolean > {
35
+ opts . logs = opts . logs ?? true ;
35
36
if ( ! opts . appToken || ! opts . appId ) {
36
37
throw new Error ( "Missing 'appToken' or 'appId' in 'opts'!" ) ;
37
38
}
39
+
38
40
let commands = [ ] ;
39
41
let privateCommands = [ ] ;
40
42
@@ -49,7 +51,7 @@ export async function deployCommands(
49
51
const rest = new REST ( ) . setToken ( opts . appToken ) ;
50
52
51
53
for ( const file of commandFiles ) {
52
- const filePath = path . join ( folderPath , file ) ;
54
+ const filePath = "file://" + path . join ( folderPath , file ) ;
53
55
const command = ( await import ( filePath ) ) . default ;
54
56
if ( ! ( "data" in command ) ) {
55
57
console . error (
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " djs-command-helper" ,
3
- "version" : " 4.0.1 " ,
3
+ "version" : " 4.0.2 " ,
4
4
"description" : " A simple, easy to use module that houses functions to can refresh global and guild specific commands for your Discord App." ,
5
5
"main" : " ./index.js" ,
6
6
"types" : " ./types.d.ts" ,
You can’t perform that action at this time.
0 commit comments