Skip to main content

Function: isAnyInteraction()

isAnyInteraction(messageOrInteraction: APIMessage | BaseInteraction<CacheType> | Message<boolean>): messageOrInteraction is BaseInteraction<CacheType>

Checks whether the input messageOrInteraction is one of Message or any class that extends BaseInteraction. This generally boils down to being one of:

  • Interaction
  • AutocompleteInteraction
  • ButtonInteraction
  • ChannelSelectMenuInteraction
  • ChatInputCommandInteraction
  • CommandInteraction
  • ContextMenuInteraction
  • MentionableSelectMenuInteraction
  • MessageComponentInteraction
  • MessageContextMenuCommandInteraction
  • ModalSubmitInteraction
  • RoleSelectMenuInteraction
  • SelectMenuInteraction
  • StringSelectMenuInteraction
  • UserContextMenuCommandInteraction
  • UserSelectMenuInteraction

Parameters

ParameterTypeDescription
messageOrInteractionAPIMessage | BaseInteraction<CacheType> | Message<boolean>The message or interaction that should be checked.

Returns

messageOrInteraction is BaseInteraction<CacheType>

true if the messageOrInteraction is an instanceof BaseInteraction, false if it is not.

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:254