zumito-framework 1.1.19 → 1.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ZumitoFramework.d.ts +2 -1
- package/dist/ZumitoFramework.js +19 -7
- package/package.json +1 -1
|
@@ -37,7 +37,8 @@ export declare class ZumitoFramework {
|
|
|
37
37
|
* });
|
|
38
38
|
* @public
|
|
39
39
|
*/
|
|
40
|
-
constructor(settings: FrameworkSettings);
|
|
40
|
+
constructor(settings: FrameworkSettings, callback?: Function);
|
|
41
|
+
initialize(): Promise<void>;
|
|
41
42
|
startApiServer(): void;
|
|
42
43
|
private registerModules;
|
|
43
44
|
private registerModule;
|
package/dist/ZumitoFramework.js
CHANGED
|
@@ -49,22 +49,34 @@ class ZumitoFramework {
|
|
|
49
49
|
* });
|
|
50
50
|
* @public
|
|
51
51
|
*/
|
|
52
|
-
constructor(settings) {
|
|
52
|
+
constructor(settings, callback) {
|
|
53
53
|
this.settings = settings;
|
|
54
54
|
this.modules = new Map();
|
|
55
55
|
this.commands = new Map();
|
|
56
56
|
this.events = new Map();
|
|
57
57
|
this.translations = new Map();
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
this.initialize().then(() => {
|
|
59
|
+
if (callback)
|
|
60
|
+
callback();
|
|
60
61
|
}).catch(err => {
|
|
61
|
-
console.error(
|
|
62
|
-
process.exit(1);
|
|
62
|
+
console.error(err);
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
}
|
|
65
|
+
async initialize() {
|
|
66
|
+
try {
|
|
67
|
+
await mongoose.connect(this.settings.mongoQueryString, { useNewUrlParser: true, useUnifiedTopology: true });
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
console.error("[❎] Database connection error:", err.message);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
console.log('[✅] Database connection successful');
|
|
75
|
+
this.database = mongoose.connection;
|
|
76
|
+
}
|
|
77
|
+
this.initializeDiscordClient();
|
|
65
78
|
this.startApiServer();
|
|
66
79
|
this.registerModules();
|
|
67
|
-
this.initializeDiscordClient();
|
|
68
80
|
}
|
|
69
81
|
startApiServer() {
|
|
70
82
|
this.app = express();
|