feat(handler) Add button and select menu support!

This commit is contained in:
Jacob Nguyen
2022-04-03 12:01:50 -05:00
parent 930c2ca229
commit 4ef0b87de7
8 changed files with 53 additions and 18 deletions

View File

@@ -40,8 +40,24 @@ export const onInteractionCreate = ( wrapper : Wrapper ) => {
}),
)
}
if (interaction.isModalSubmit()) {
return of();
if (interaction.isButton()) {
return of(Files.Buttons.get(interaction.customId))
.pipe(
filterTap(CommandType.BUTTON, mod => {
const ctx = Context.wrap(interaction);
mod.execute(ctx);
})
)
}
if (interaction.isSelectMenu()) {
return of(Files.SelectMenus.get(interaction.customId))
.pipe(
filterTap(CommandType.MENU_SELECT, mod => {
const ctx = Context.wrap(interaction);
mod.execute(ctx);
})
)
}
else { return of() }
})