zumito-framework 1.4.1 → 1.5.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.
@@ -61,7 +61,7 @@ export class Module {
61
61
  throw new Error(`Folder ${folder} doesn't exist`);
62
62
  const files = fs.readdirSync(folderPath);
63
63
  for (const file of files) {
64
- if (file.endsWith('d.ts'))
64
+ if (file.endsWith('.d.ts'))
65
65
  continue;
66
66
  if (file.endsWith('.js') || file.endsWith('.ts')) {
67
67
  let event = await import('file://' + path.join(folderPath, file)).catch((e) => {
@@ -115,7 +115,7 @@ export class Module {
115
115
  return;
116
116
  const files = fs.readdirSync(path.join(this.path, 'models'));
117
117
  for (const file of files) {
118
- if (file.endsWith('d.ts'))
118
+ if (file.endsWith('.d.ts'))
119
119
  continue;
120
120
  if (file.endsWith('.ts') || file.endsWith('.js')) {
121
121
  let model = await import('file://' + `${this.path}/models/${file}`).catch((e) => {
@@ -143,7 +143,7 @@ export class Module {
143
143
  throw new Error(`Folder ${folder} doesn't exist`);
144
144
  const files = fs.readdirSync(folderPath);
145
145
  for (const file of files) {
146
- if (file.endsWith('d.ts'))
146
+ if (file.endsWith('.d.ts'))
147
147
  continue;
148
148
  if (file.endsWith('.js') || file.endsWith('.ts')) {
149
149
  let route = await import('file://' + path.join(folderPath, file)).catch((e) => {
@@ -197,13 +197,27 @@ export class InteractionHandler {
197
197
  if (!guildSettings && interaction.guildId) {
198
198
  guildSettings = await ServiceContainer.getService(GuildDataGetter).getGuildSettings(interaction.guildId);
199
199
  }
200
- commandInstance.modalSubmit({
201
- client: this.client,
202
- path,
203
- interaction,
204
- framework,
205
- guildSettings,
206
- });
200
+ const trans = this.translationManager.getShortHandMethod('command.' + commandInstance.name, guildSettings?.lang);
201
+ if (commandInstance.binds?.modalSubmit) {
202
+ commandInstance.binds?.modalSubmit({
203
+ path,
204
+ interaction,
205
+ client: this.client,
206
+ framework,
207
+ guildSettings,
208
+ trans,
209
+ });
210
+ }
211
+ else if ( // Deprecated
212
+ commandInstance.constructor.prototype.hasOwnProperty('modalSubmit')) {
213
+ commandInstance.modalSubmit({
214
+ client: this.client,
215
+ path,
216
+ interaction,
217
+ framework,
218
+ guildSettings,
219
+ });
220
+ }
207
221
  }
208
222
  this.eventManager.emitEvent('modalSubmit', 'framework', {
209
223
  client: this.client,
@@ -79,7 +79,7 @@ export class CommandManager {
79
79
  async loadCommandsFolder(folderPath, options) {
80
80
  const files = fs.readdirSync(folderPath);
81
81
  for (const file of files) {
82
- if (file.endsWith('d.ts'))
82
+ if (file.endsWith('.d.ts'))
83
83
  continue;
84
84
  if (file.endsWith('.js') || file.endsWith('.ts')) {
85
85
  const command = await this.loadCommandFile(path.join(folderPath, file));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zumito-framework",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Discord.js bot framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",