updates to concierge bot to support adding services and routes
This commit is contained in:
@@ -7,6 +7,8 @@ import type {
|
||||
ComponentInteraction,
|
||||
ModalSubmitInteraction,
|
||||
PingInteraction,
|
||||
SelectMenuInteraction,
|
||||
ButtonInteraction,
|
||||
} from '../types';
|
||||
|
||||
export function isApplicationCommand(interaction: Interaction): interaction is CommandInteraction {
|
||||
@@ -39,6 +41,7 @@ export function commandHasIdPrefix(interaction: Interaction, prefix: string): bo
|
||||
|
||||
export function getCommandName(interaction: ExecutableInteraction): string | undefined {
|
||||
if (isApplicationCommand(interaction) || isAutocomplete(interaction)) {
|
||||
console.log(`command name: ${interaction.data.name}`);
|
||||
return interaction.data.name;
|
||||
}
|
||||
return undefined;
|
||||
@@ -54,6 +57,12 @@ export function augmentInteraction(interaction: Interaction): Interaction {
|
||||
interaction.isMessageComponent = function (): this is ComponentInteraction {
|
||||
return interaction.type === Constants.InteractionTypes.MESSAGE_COMPONENT;
|
||||
};
|
||||
interaction.isSelectMenu = function (): this is SelectMenuInteraction {
|
||||
return interaction.isMessageComponent() && interaction.data.component_type in [3, 5, 6, 7, 8];
|
||||
};
|
||||
interaction.isButton = function (): this is ButtonInteraction {
|
||||
return interaction.isMessageComponent() && interaction.data.component_type === Constants.ComponentTypes.BUTTON;
|
||||
};
|
||||
interaction.isAutocomplete = function (): this is AutocompleteInteraction {
|
||||
return interaction.type === Constants.InteractionTypes.APPLICATION_COMMAND_AUTOCOMPLETE;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user