mirror of
https://github.com/sern-handler/handler
synced 2026-06-22 15:52:16 +00:00
feat: Adding TextInput map & starting event plugins for message components
This commit is contained in:
@@ -15,9 +15,9 @@ import Context from '../structures/context';
|
||||
import type { Result } from 'ts-results';
|
||||
import type { PluggedModule } from '../structures/modules/module';
|
||||
import { CommandType, controller } from '../sern';
|
||||
import type { EventPlugin } from '../plugins/plugin';
|
||||
import { resolveParameters } from '../utilities/resolveParameters';
|
||||
import type { Args } from '../../types/handler';
|
||||
import type { MessageComponentInteraction } from 'discord.js';
|
||||
|
||||
function applicationCommandHandler<
|
||||
T extends CommandType.Both | CommandType.MenuUser | CommandType.MenuMsg | CommandType.Slash,
|
||||
@@ -59,6 +59,13 @@ function applicationCommandHandler<
|
||||
.run();
|
||||
}
|
||||
|
||||
function messageComponentInteractionHandler(
|
||||
modul: PluggedModule | undefined,
|
||||
interaction: MessageComponentInteraction,
|
||||
) {
|
||||
return of(modul);
|
||||
}
|
||||
|
||||
export const onInteractionCreate = (wrapper: Wrapper) => {
|
||||
const { client } = wrapper;
|
||||
|
||||
@@ -73,6 +80,12 @@ export const onInteractionCreate = (wrapper: Wrapper) => {
|
||||
Files.BothCommand.get(interaction.commandName);
|
||||
return applicationCommandHandler(modul, interaction);
|
||||
}
|
||||
if (interaction.isMessageComponent()) {
|
||||
const modul = Files
|
||||
.MessageCompCommandStore[interaction.componentType]
|
||||
.get(interaction.customId);
|
||||
return messageComponentInteractionHandler(modul, interaction);
|
||||
}
|
||||
return of({});
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -14,6 +14,7 @@ export const ApplicationCommandStore = {
|
||||
export const MessageCompCommandStore = {
|
||||
[ComponentType.Button]: new Map<string, PluggedModule>(),
|
||||
[ComponentType.SelectMenu]: new Map<string, PluggedModule>(),
|
||||
[ComponentType.TextInput] : new Map<string, PluggedModule>()
|
||||
};
|
||||
export const TextCommandStore = {
|
||||
text: new Map<string, PluggedModule>(),
|
||||
|
||||
Reference in New Issue
Block a user