- Add ability to handle dropdown menus with the bot - Add a dropdown to the inventoryhelper - Add handler for the dropdown to navigate to that page #344 Reviewed-on: #365 Reviewed-by: VylpesTester <tester@vylpes.com> Co-authored-by: Ethan Lane <ethan@vylpes.com> Co-committed-by: Ethan Lane <ethan@vylpes.com>
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { Interaction } from "discord.js";
|
|
import ChatInputCommand from "./interactionCreate/ChatInputCommand";
|
|
import Button from "./interactionCreate/Button";
|
|
import AppLogger from "./appLogger";
|
|
import NewUserDiscovery from "./interactionCreate/middleware/NewUserDiscovery";
|
|
import StringDropdown from "./interactionCreate/StringDropdown";
|
|
|
|
export class Events {
|
|
public async onInteractionCreate(interaction: Interaction) {
|
|
if (!interaction.guildId) return;
|
|
|
|
await NewUserDiscovery(interaction);
|
|
|
|
if (interaction.isChatInputCommand()) {
|
|
AppLogger.LogVerbose("Client", `ChatInputCommand: ${interaction.commandName}`);
|
|
ChatInputCommand.onChatInput(interaction);
|
|
}
|
|
|
|
if (interaction.isButton()) {
|
|
AppLogger.LogVerbose("Client", `Button: ${interaction.customId}`);
|
|
Button.onButtonClicked(interaction);
|
|
}
|
|
|
|
if (interaction.isStringSelectMenu()) {
|
|
AppLogger.LogVerbose("Client", `StringDropdown: ${interaction.customId}`);
|
|
StringDropdown.onStringDropdownSelected(interaction);
|
|
}
|
|
}
|
|
|
|
// Emit when bot is logged in and ready to use
|
|
public onReady() {
|
|
AppLogger.LogInfo("Client", "Ready");
|
|
}
|
|
}
|