zumito-framework 1.11.1 → 1.12.0

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.
@@ -0,0 +1,7 @@
1
+ import { ZumitoFramework } from "../../ZumitoFramework";
2
+ import type { FrameworkSettings } from "../settings/FrameworkSettings";
3
+ export type LauncherConfig = {
4
+ callbacks?: {
5
+ load?: (bot: ZumitoFramework) => any;
6
+ };
7
+ } & FrameworkSettings;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+ // eslint-disable-next-line check-file/filename-naming-convention
3
+ import { ZumitoFramework } from './index';
4
+ import path from 'path';
5
+ import fs from 'fs';
6
+ import dotenv from 'dotenv';
7
+ import { RecursiveObjectMerger } from './services/utilities/RecursiveObjectMerger';
8
+ dotenv.config();
9
+ if (!process.env.DISCORD_TOKEN) {
10
+ throw new Error("Discord Token not found (DISCORD_TOKEN)");
11
+ }
12
+ else if (!process.env.DISCORD_CLIENT_ID) {
13
+ throw new Error("Discord Client ID not found (DISCORD_CLIENT_ID)");
14
+ }
15
+ else if (!process.env.MONGO_QUERY_STRING) {
16
+ throw new Error("No MongoDB connection string specified in .env file (MONGO_QUERY_STRING)");
17
+ }
18
+ const defaultConfig = {
19
+ discordClientOptions: {
20
+ intents: 3276799,
21
+ token: process.env.DISCORD_TOKEN,
22
+ clientId: process.env.DISCORD_CLIENT_ID,
23
+ },
24
+ defaultPrefix: process.env.BOT_PREFIX || "z-",
25
+ mongoQueryString: process.env.MONGO_QUERY_STRING,
26
+ logLevel: parseInt(process.env.LOGLEVEL || "3"),
27
+ };
28
+ const configFilePath = path.join(process.cwd(), 'zumito.config.ts');
29
+ if (!fs.existsSync(configFilePath)) {
30
+ console.error(`Config file not found at ${configFilePath}. Please ensure the file exists.`);
31
+ process.exit(1);
32
+ }
33
+ import(configFilePath)
34
+ .then(({ config: userConfig }) => {
35
+ const config = RecursiveObjectMerger.merge(defaultConfig, userConfig);
36
+ new ZumitoFramework(config, (bot) => {
37
+ // Log number of commands loaded
38
+ console.log(`Loaded ${bot.commands.size} commands`);
39
+ // Log number of events loaded
40
+ console.log(`Loaded ${bot.events.size} events`);
41
+ // Log number of modules loaded
42
+ console.log(`Loaded ${bot.modules.size} modules`);
43
+ // Log number of translations loaded
44
+ console.log(`Loaded ${bot.translations.getAll().size} translations`);
45
+ // Log number of routes registered
46
+ console.log(`Loaded ${bot.routes.length} routes`);
47
+ });
48
+ })
49
+ .catch((error) => {
50
+ console.error(`Failed to load config file at ${configFilePath}:`, error.message || error);
51
+ process.exit(1);
52
+ });
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "zumito-framework",
3
- "version": "1.11.1",
3
+ "version": "1.12.0",
4
4
  "description": "Discord.js bot framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "zumito-framework": "dist/launcher.js"
9
+ },
7
10
  "files": [
8
11
  "/dist",
9
12
  "/baseModule"
@@ -29,6 +32,7 @@
29
32
  "cookie-parser": "^1.4.6",
30
33
  "cors": "^2.8.5",
31
34
  "discord.js": "^14.21.0",
35
+ "dotenv": "^16.4.7",
32
36
  "error-stack-parser": "^2.1.4",
33
37
  "express": "^4.18.1",
34
38
  "leven": "^4.0.0",