zumito-framework 1.2.18 → 1.2.19
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/definitions/commands/CommandBinds.d.ts +2 -0
- package/dist/definitions/parameters/ModalSubmitParameters.d.ts +10 -0
- package/dist/definitions/parameters/ModalSubmitParameters.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/services/InteractionHandler.js +13 -7
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ModalSubmitParameters } from '@definitions/parameters/ModalSubmitParameters.js';
|
|
1
2
|
import { SelectMenuParameters } from '../parameters/SelectMenuParameters.js';
|
|
2
3
|
export declare type CommandBinds = {
|
|
3
4
|
selectMenu?: (params: SelectMenuParameters) => Promise<void>;
|
|
5
|
+
modalSubmit?: (params: ModalSubmitParameters) => Promise<void>;
|
|
4
6
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -30,4 +30,6 @@ import { Route, RouteMethod } from './definitions/Route.js';
|
|
|
30
30
|
import { InteractionHandler } from './services/InteractionHandler.js';
|
|
31
31
|
import { CommandManager } from './services/CommandManager.js';
|
|
32
32
|
import { ErrorType } from './definitions/ErrorType.js';
|
|
33
|
+
export { ModalSubmitParameters } from './definitions/parameters/ModalSubmitParameters.js';
|
|
34
|
+
export { CommandBinds } from './definitions/commands/CommandBinds.js';
|
|
33
35
|
export { ZumitoFramework, FrameworkSettings, Command, Module, CommandParameters, CommandArguments, FrameworkEvent, Translation, TranslationManager, ApiResponse, SelectMenuParameters, CommandType, CommandArgDefinition, CommandChoiceDefinition, ButtonPressed, ButtonPressedParams, TextFormatter, EmojiFallback, DatabaseConfigLoader, DatabaseModel, PresenceDataRule, RuledPresenceData, StatusManagerOptions, discord, EventParameters, ServiceContainer, GuildDataGetter, SlashCommandRefresher, CommandParser, ErrorHandler, ErrorType, Route, RouteMethod, InteractionHandler, CommandManager };
|
|
@@ -184,7 +184,15 @@ export class InteractionHandler {
|
|
|
184
184
|
throw new Error(`Command ${path[0]} not found or modal id bad formatted`);
|
|
185
185
|
}
|
|
186
186
|
const framework = ServiceContainer.getService(ZumitoFramework);
|
|
187
|
-
if (commandInstance.modalSubmit) {
|
|
187
|
+
if (commandInstance.binds?.modalSubmit) {
|
|
188
|
+
const trans = this.translationManager.getShortHandMethod('command.' + commandInstance.name, guildSettings?.lang);
|
|
189
|
+
commandInstance.binds.modalSubmit({
|
|
190
|
+
interaction,
|
|
191
|
+
path,
|
|
192
|
+
trans,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
else if (commandInstance.modalSubmit) {
|
|
188
196
|
if (!guildSettings && interaction.guildId) {
|
|
189
197
|
guildSettings = await ServiceContainer.getService(GuildDataGetter).getGuildSettings(interaction.guildId);
|
|
190
198
|
}
|
|
@@ -196,11 +204,9 @@ export class InteractionHandler {
|
|
|
196
204
|
guildSettings,
|
|
197
205
|
});
|
|
198
206
|
}
|
|
199
|
-
|
|
200
|
-
this.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
});
|
|
204
|
-
}
|
|
207
|
+
this.eventManager.emitEvent('modalSubmit', 'framework', {
|
|
208
|
+
client: this.client,
|
|
209
|
+
path, interaction, framework, guildSettings,
|
|
210
|
+
});
|
|
205
211
|
}
|
|
206
212
|
}
|