zumito-framework 1.23.0 → 1.23.2

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.
@@ -326,7 +326,7 @@ export class ZumitoFramework {
326
326
  }
327
327
  }
328
328
  moduleEntries.push({
329
- rootPath: path.join(__dirname, 'modules', 'core'),
329
+ rootPath: path.join(__dirname, 'modules', 'core', 'baseModule'),
330
330
  name: 'baseModule',
331
331
  });
332
332
  if (fs.existsSync(`${process.cwd()}/node_modules/.zumitoBundles`)) {
@@ -62,6 +62,8 @@ export class Module {
62
62
  for (const file of files) {
63
63
  if (file.endsWith('.d.ts'))
64
64
  continue;
65
+ if (file.endsWith('.ts') && files.includes(file.replace(/\.ts$/, '.js')))
66
+ continue;
65
67
  if (file.endsWith('.js') || file.endsWith('.ts')) {
66
68
  let event = await import('file://' + path.join(folderPath, file)).catch((e) => {
67
69
  console.error(`[🔄🔴 ] Error loading ${file.slice(0, -3)} event on module ${this.constructor.name}`);
@@ -90,7 +92,9 @@ export class Module {
90
92
  client: this.framework.client,
91
93
  };
92
94
  args.forEach((arg) => {
93
- finalArgs[arg.constructor.name.toLowerCase()] = arg;
95
+ if (arg && arg.constructor) {
96
+ finalArgs[arg.constructor.name.toLowerCase()] = arg;
97
+ }
94
98
  });
95
99
  const interaction = args.find((arg) => arg instanceof StringSelectMenuInteraction ||
96
100
  arg instanceof CommandInteraction ||
@@ -120,6 +124,8 @@ export class Module {
120
124
  for (const file of files) {
121
125
  if (file.endsWith('.d.ts'))
122
126
  continue;
127
+ if (file.endsWith('.ts') && files.includes(file.replace(/\.ts$/, '.js')))
128
+ continue;
123
129
  if (file.endsWith('.js') || file.endsWith('.ts')) {
124
130
  const mod = await import('file://' + path.join(modelsFolder, file)).catch((e) => {
125
131
  this.errorHandler.handleError(e, {
@@ -152,6 +158,8 @@ export class Module {
152
158
  for (const file of files) {
153
159
  if (file.endsWith('.d.ts'))
154
160
  continue;
161
+ if (file.endsWith('.ts') && files.includes(file.replace(/\.ts$/, '.js')))
162
+ continue;
155
163
  if (file.endsWith('.js') || file.endsWith('.ts')) {
156
164
  let route = await import('file://' + path.join(folderPath, file)).catch((e) => {
157
165
  this.errorHandler.handleError(e, {
@@ -0,0 +1,4 @@
1
+ import { Module } from '../../../definitions/Module.js';
2
+ export declare class BaseModule extends Module {
3
+ initialize(): Promise<void>;
4
+ }
@@ -0,0 +1,6 @@
1
+ import { Module } from '../../../definitions/Module.js';
2
+ export class BaseModule extends Module {
3
+ async initialize() {
4
+ await super.initialize();
5
+ }
6
+ }
@@ -80,6 +80,8 @@ export class CommandManager {
80
80
  for (const file of files) {
81
81
  if (file.endsWith('.d.ts'))
82
82
  continue;
83
+ if (file.endsWith('.ts') && files.includes(file.replace(/\.ts$/, '.js')))
84
+ continue;
83
85
  if (file.endsWith('.js') || file.endsWith('.ts')) {
84
86
  const command = await this.loadCommandFile(path.join(folderPath, file), true);
85
87
  if (command) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zumito-framework",
3
- "version": "1.23.0",
3
+ "version": "1.23.2",
4
4
  "description": "Discord.js bot framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",