Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
74 Legacy V3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
insert
74 Legacy V3
Commits
dead5522
Commit
dead5522
authored
Jul 07, 2018
by
insert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a warning when module loading fails.
parent
2cdd25fd
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
353 additions
and
21 deletions
+353
-21
core/index.js
core/index.js
+24
-20
package-lock.json
package-lock.json
+327
-0
package.json
package.json
+2
-1
No files found.
core/index.js
View file @
dead5522
...
...
@@ -52,26 +52,30 @@ core.reload = () => {
let
mods
=
fs
.
readdirSync
(
'
./core
'
);
mods
.
forEach
(
mod
=>
{
if
(
mod
==
'
index.js
'
)
return
;
let
path
=
`
./core/
${
mod
}
/
`
;
let
cmds
=
fs
.
readdirSync
(
path
);
let
i
=
index
(
path
);
modules
[
mod
]
=
i
;
cmds
.
forEach
(
cmd
=>
{
if
(
cmd
==
'
index.js
'
||
cmd
==
'
lib
'
)
return
;
if
(
cmd
in
i
.
disabled
)
return
;
let
a
=
(
path
+
cmd
).
replace
(
/core
\/
/g
,
''
);
nrc
(
a
);
let
m
=
require
(
a
);
let
n
=
cmd
.
split
(
'
.
'
).
shift
();
if
(
commands
[
n
])
console
.
log
(
'
[WARN] A conflict has been detected, command
'
+
n
+
'
already exists! And
'
+
mod
+
'
is now overwriting it!
'
);
let
util
=
require
(
'
util
'
);
if
(
!
i
.
commands
[
n
])
i
.
commands
[
n
]
=
{};
commands
[
n
]
=
Object
.
assign
({
func
:
m
,
desc
:
'
No description!
'
,
req
:
0
},
i
.
commands
[
n
]);
});
try
{
let
path
=
`
./core/
${
mod
}
/
`
;
let
cmds
=
fs
.
readdirSync
(
path
);
let
i
=
index
(
path
);
modules
[
mod
]
=
i
;
cmds
.
forEach
(
cmd
=>
{
if
(
cmd
==
'
index.js
'
||
cmd
==
'
lib
'
)
return
;
if
(
cmd
in
i
.
disabled
)
return
;
let
a
=
(
path
+
cmd
).
replace
(
/core
\/
/g
,
''
);
nrc
(
a
);
let
m
=
require
(
a
);
let
n
=
cmd
.
split
(
'
.
'
).
shift
();
if
(
commands
[
n
])
console
.
log
(
'
[WARN] A conflict has been detected, command
'
+
n
+
'
already exists! And
'
+
mod
+
'
is now overwriting it!
'
);
let
util
=
require
(
'
util
'
);
if
(
!
i
.
commands
[
n
])
i
.
commands
[
n
]
=
{};
commands
[
n
]
=
Object
.
assign
({
func
:
m
,
desc
:
'
No description!
'
,
req
:
0
},
i
.
commands
[
n
]);
});
}
catch
(
e
)
{
console
.
error
(
'
[WARN] Failed to load module,
'
+
mod
+
'
!
'
);
}
});
};
...
...
package-lock.json
View file @
dead5522
This diff is collapsed.
Click to expand it.
package.json
View file @
dead5522
...
...
@@ -19,6 +19,7 @@
],
"dependencies"
:
{
"
discord.js
"
:
"
^11.3.2
"
,
"
node-opus
"
:
"
^0.3.0
"
"
node-opus
"
:
"
^0.3.0
"
,
"
request
"
:
"
^2.87.0
"
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment