zumito-framework 1.1.37 → 1.1.39
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.js +10 -3
- package/dist/types/Module.js +2 -2
- package/package.json +3 -3
package/dist/ZumitoFramework.js
CHANGED
|
@@ -78,8 +78,8 @@ export class ZumitoFramework {
|
|
|
78
78
|
process.exit(1);
|
|
79
79
|
}
|
|
80
80
|
finally {
|
|
81
|
-
console.log('[🗄️🟢] Database connection successful');
|
|
82
81
|
this.database = mongoose.connection;
|
|
82
|
+
console.log('[🗄️🟢] Database connection successful');
|
|
83
83
|
}
|
|
84
84
|
this.initializeDiscordClient();
|
|
85
85
|
this.startApiServer();
|
|
@@ -134,6 +134,7 @@ export class ZumitoFramework {
|
|
|
134
134
|
await this.registerModule(modulesFolder, file);
|
|
135
135
|
}
|
|
136
136
|
this.models.forEach((modelDefiniton, modelName) => {
|
|
137
|
+
console.log('modelDefiniton', modelDefiniton);
|
|
137
138
|
const schema = new mongoose.Schema(modelDefiniton);
|
|
138
139
|
this.models.set(modelName, mongoose.model(modelName, schema));
|
|
139
140
|
});
|
|
@@ -228,9 +229,13 @@ export class ZumitoFramework {
|
|
|
228
229
|
return memberPermission.has(permission);
|
|
229
230
|
}
|
|
230
231
|
async getGuildSettings(guildId) {
|
|
231
|
-
|
|
232
|
+
const Guild = this.models.get('Guild');
|
|
233
|
+
let guild = await Guild.findOne({ guild_id: guildId }).exec();
|
|
232
234
|
if (guild == null) {
|
|
233
|
-
guild =
|
|
235
|
+
guild = new Guild({
|
|
236
|
+
guild_id: guildId,
|
|
237
|
+
});
|
|
238
|
+
await guild.save();
|
|
234
239
|
}
|
|
235
240
|
return guild;
|
|
236
241
|
}
|
|
@@ -259,6 +264,8 @@ export class ZumitoFramework {
|
|
|
259
264
|
case 'role':
|
|
260
265
|
method = 'addRoleOption';
|
|
261
266
|
break;
|
|
267
|
+
default:
|
|
268
|
+
throw new Error('Invalid argument type ' + arg.type);
|
|
262
269
|
}
|
|
263
270
|
slashCommand[method]((option) => {
|
|
264
271
|
option.setName(arg.name);
|
package/dist/types/Module.js
CHANGED
|
@@ -179,9 +179,9 @@ export class Module {
|
|
|
179
179
|
},
|
|
180
180
|
}).catch(e => {
|
|
181
181
|
console.error(`[🔄🔴 ] Error loading model ${modelName} on module ${this.constructor.name}`);
|
|
182
|
-
console.
|
|
182
|
+
console.error(e, e.name, e.stack);
|
|
183
183
|
});
|
|
184
|
-
this.models.set(modelName, modelDefiniton);
|
|
184
|
+
this.models.set(modelName, modelDefiniton.default);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zumito-framework",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.39",
|
|
4
4
|
"description": "Discord.js bot framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
18
18
|
"build": "tsc",
|
|
19
|
-
"publish": "npm publish",
|
|
19
|
+
"publish-npm": "npm publish",
|
|
20
20
|
"docs": "typedoc --out docs src"
|
|
21
21
|
},
|
|
22
22
|
"author": "fernandomema",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"error-stack-parser": "^2.1.4",
|
|
35
35
|
"express": "^4.18.1",
|
|
36
36
|
"leven": "^4.0.0",
|
|
37
|
-
"mongoose": "^6.5
|
|
37
|
+
"mongoose": "^6.6.5",
|
|
38
38
|
"plop": "^3.1.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|