Class InteractionUtils

Constructors

Properties

addSlashConfirmationOption: ((i) => SlashCommandBooleanOption) = addSlashConfirmationOption

Type declaration

    • (i): SlashCommandBooleanOption
    • Parameters

      • i: SlashCommandBooleanOption

      Returns SlashCommandBooleanOption

channelTypeToString: ((type) => string) = channelTypeToString

Type declaration

    • (type): string
    • Parameters

      • type: ChannelType

      Returns string

confirmationButtonRow: ((client) => ActionRowBuilder<ButtonBuilder>) = confirmationButtonRow

Type declaration

    • (client): ActionRowBuilder<ButtonBuilder>
    • Parameters

      Returns ActionRowBuilder<ButtonBuilder>

disableComponents: ((components) => (APIActionRowComponent<APIMessageActionRowComponent> | AnyComponentBuilder | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<(JSONEncodable<APIActionRowComponentTypes> | ActionRowComponentData)>)[]) = disableComponents

Type declaration

    • (components): (APIActionRowComponent<APIMessageActionRowComponent> | AnyComponentBuilder | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<(JSONEncodable<APIActionRowComponentTypes> | ActionRowComponentData)>)[]
    • Parameters

      • components: (APIActionRowComponent<APIMessageActionRowComponent> | AnyComponentBuilder | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<(JSONEncodable<APIActionRowComponentTypes> | ActionRowComponentData)>)[]

      Returns (APIActionRowComponent<APIMessageActionRowComponent> | AnyComponentBuilder | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<(JSONEncodable<APIActionRowComponentTypes> | ActionRowComponentData)>)[]

paginator: ((id, client, pages, interaction, duration?, options?) => Promise<void>) = paginator

Type declaration

    • (id, client, pages, interaction, duration?, options?): Promise<void>
    • Parameters

      • id: string
      • client: Client<boolean>
      • pages: BaseMessageOptions[]
      • interaction: RepliableInteraction
      • duration: number = UnitConstants.MS_IN_ONE_HOUR
      • Optional options: InteractionReplyDynamicOptions

      Returns Promise<void>

promptConfirmation: ((__namedParameters) => Promise<false | RepliableInteraction | "expired">) = promptConfirmation

Type declaration

    • (__namedParameters): Promise<false | RepliableInteraction | "expired">
    • Parameters

      Returns Promise<false | RepliableInteraction | "expired">

replyDynamic: (<I>(client, interaction, content, options?) => Promise<null | Message<boolean>>) = replyDynamic

Type declaration

    • <I>(client, interaction, content, options?): Promise<null | Message<boolean>>
    • Reply to an interaction - dynamically resolves the reply function, and calls it with the given content, util to avoid having to directly invoke the replyFn method, as explained in it's declaration

      Note: It definitely needs the client, as it needs to be able to log critical errors if they are encountered while replying to interactions - it's worth all the client not null checks

      Type Parameters

      • I extends BaseInteraction<CacheType>

      Parameters

      Returns Promise<null | Message<boolean>>

      Reply method return value - use fetchReply if appropriate

replyFn: (<I>(client, interaction, options?) => ((content) => Promise<null>) | ((options) => Promise<Message<boolean>>) | ((options) => Promise<Message<boolean>>)) = replyFn

Type declaration

    • <I>(client, interaction, options?): ((content) => Promise<null>) | ((options) => Promise<Message<boolean>>) | ((options) => Promise<Message<boolean>>)
    • Resolves the applicable reply function for the given interaction

      Note: This is function should never be assigned to a variable, as it's purpose is dynamically resolving the reply function for the given interaction. If you assign this to a variable, it will always resolve to the same function.

      Example:

      InteractionUtils.replyFn(interaction)(content);
      

      Type Parameters

      • I extends BaseInteraction<CacheType>

      Parameters

      Returns ((content) => Promise<null>) | ((options) => Promise<Message<boolean>>) | ((options) => Promise<Message<boolean>>)

      The applicable reply function for the given interaction and options

requireAvailableGuild: (<I>(client, interaction) => interaction is AvailableGuildInteraction<I>) = requireAvailableGuild

Type declaration

requireGuild: (<I>(client, interaction) => interaction is AvailableGuildInteraction<I>) = requireGuild

Type declaration

resolveRowsFromComponents: ((components) => (null | ButtonBuilder | ChannelSelectMenuBuilder | MentionableSelectMenuBuilder | RoleSelectMenuBuilder | StringSelectMenuBuilder | UserSelectMenuBuilder | TextInputBuilder)[][]) = resolveRowsFromComponents

Type declaration

    • (components): (null | ButtonBuilder | ChannelSelectMenuBuilder | MentionableSelectMenuBuilder | RoleSelectMenuBuilder | StringSelectMenuBuilder | UserSelectMenuBuilder | TextInputBuilder)[][]
    • Parameters

      • components: (null | AnyComponentBuilder)[]

      Returns (null | ButtonBuilder | ChannelSelectMenuBuilder | MentionableSelectMenuBuilder | RoleSelectMenuBuilder | StringSelectMenuBuilder | UserSelectMenuBuilder | TextInputBuilder)[][]

slashConfirmationOptionHandler: ((client, interaction) => boolean) = slashConfirmationOptionHandler

Type declaration

    • (client, interaction): boolean
    • Parameters

      • client: Client<boolean>
      • interaction: ChatInputCommandInteraction<CacheType>

      Returns boolean