@hyperneutrino/djs-lite 1.1.0 → 1.2.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.
- package/index.ts +16 -16
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -57,7 +57,7 @@ export class SlashCommand extends Command<ChatInputApplicationCommandData & { ty
|
|
|
57
57
|
export class UserCommand extends Command<UserApplicationCommandData, UserContextMenuCommandInteraction> {}
|
|
58
58
|
export class MessageCommand extends Command<MessageApplicationCommandData, MessageContextMenuCommandInteraction> {}
|
|
59
59
|
|
|
60
|
-
abstract class
|
|
60
|
+
abstract class ComponentHandler<T extends ModalSubmitInteraction | MessageComponentInteraction> {
|
|
61
61
|
handler: Handler<T>;
|
|
62
62
|
|
|
63
63
|
constructor(handler: Handler<T>) {
|
|
@@ -65,13 +65,13 @@ abstract class ComponentResponder<T extends ModalSubmitInteraction | MessageComp
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export class
|
|
69
|
-
export class
|
|
70
|
-
export class
|
|
71
|
-
export class
|
|
72
|
-
export class
|
|
73
|
-
export class
|
|
74
|
-
export class
|
|
68
|
+
export class ModalHandler extends ComponentHandler<ModalSubmitInteraction> {}
|
|
69
|
+
export class ButtonHandler extends ComponentHandler<ButtonInteraction> {}
|
|
70
|
+
export class StringSelectHandler extends ComponentHandler<StringSelectMenuInteraction> {}
|
|
71
|
+
export class UserSelectHandler extends ComponentHandler<UserSelectMenuInteraction> {}
|
|
72
|
+
export class RoleSelectHandler extends ComponentHandler<RoleSelectMenuInteraction> {}
|
|
73
|
+
export class MentionSelectHandler extends ComponentHandler<MentionableSelectMenuInteraction> {}
|
|
74
|
+
export class ChannelSelectHandler extends ComponentHandler<ChannelSelectMenuInteraction> {}
|
|
75
75
|
|
|
76
76
|
export class EventHandler<T extends keyof ClientEvents> {
|
|
77
77
|
event: T;
|
|
@@ -155,14 +155,14 @@ export async function loadInteractions(client: Client<true>, directory: string,
|
|
|
155
155
|
|
|
156
156
|
const { default: item } = await import(absolutePath).catch(() => null);
|
|
157
157
|
|
|
158
|
-
if (item instanceof
|
|
159
|
-
else if (item instanceof
|
|
160
|
-
else if (item instanceof
|
|
161
|
-
else if (item instanceof
|
|
162
|
-
else if (item instanceof
|
|
163
|
-
else if (item instanceof
|
|
164
|
-
else if (item instanceof
|
|
165
|
-
else throw new Error(`Loading interactions failed: export from ${relativePath} was not an instance of <InteractionType>
|
|
158
|
+
if (item instanceof ModalHandler) modalHandlers.set(handlerKey, item.handler);
|
|
159
|
+
else if (item instanceof ButtonHandler) buttonHandlers.set(handlerKey, item.handler);
|
|
160
|
+
else if (item instanceof StringSelectHandler) stringHandlers.set(handlerKey, item.handler);
|
|
161
|
+
else if (item instanceof UserSelectHandler) userHandlers.set(handlerKey, item.handler);
|
|
162
|
+
else if (item instanceof RoleSelectHandler) roleHandlers.set(handlerKey, item.handler);
|
|
163
|
+
else if (item instanceof MentionSelectHandler) mentionHandlers.set(handlerKey, item.handler);
|
|
164
|
+
else if (item instanceof ChannelSelectHandler) channelHandlers.set(handlerKey, item.handler);
|
|
165
|
+
else throw new Error(`Loading interactions failed: export from ${relativePath} was not an instance of <InteractionType>Handler.`);
|
|
166
166
|
}),
|
|
167
167
|
);
|
|
168
168
|
|