Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ActionParameters<MW>

Object passed to the action functions on every trigger

Type parameters

  • MW: GenericObject | undefined = undefined

Hierarchy

  • ActionParameters

Index

Properties

__asyncJobs: { doAfter: (params: Omit<ActionParameters<undefined>, "msg"> & { msg: Message<boolean> }) => void | Promise<void> }[]

Internal, used for asyncEffect

args?: string

Arguments from the command executed, undefined for slash commands unless no parameter definition was provided

author: User

The user who triggered the action

channel?: TextBasedChannel

The channel this command will be sent in

createEmbed: (options: EmbedOptions | EmbedOptions[]) => MessageOptions

Type declaration

    • (options: EmbedOptions | EmbedOptions[]): MessageOptions
    • Creates an embed object using the embed.create method of the embed object passed into the Bot

      Parameters

      • options: EmbedOptions | EmbedOptions[]

      Returns MessageOptions

error?: any

[Only used for onError actions] Contains the full error obtained from the catch

guild?: Guild

The server

middleware?: MW
msg: Message<boolean> | Interaction<CacheType>

Message that triggered this action

parameters: Record<string, undefined | string | number | boolean | User | GuildMember | Role | APIRole>

Parameters from the slash command Will contain a property "arguments" for legacy commands and slash commands without parameter definition

trigger: string

Keyword used to trigger the command

Methods

  • asyncEffect(doAfter: (params: Omit<ActionParameters<undefined>, "msg"> & { msg: Message<boolean> }) => void | Promise<void>): void
  • Creates a minijob that will be run once a response is created

    This does nothing if an action has no response

    Parameters

    • doAfter: (params: Omit<ActionParameters<undefined>, "msg"> & { msg: Message<boolean> }) => void | Promise<void>
        • (params: Omit<ActionParameters<undefined>, "msg"> & { msg: Message<boolean> }): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    Returns void

  • Sends a DM to the author of the message, resolves to undefined if an error occurs

    Parameters

    Returns Promise<undefined | Message<boolean>>

  • expectReply(msg: SendableMessage, remove?: boolean): Promise<undefined | Message<boolean>>
  • Used for multiple step commands, the first argument is a SendableMessage that will be sent to the channel the second optional argument defines if the message should be deleted after receiving a reply/failing resolves to undefined if an error occurs

    Parameters

    Returns Promise<undefined | Message<boolean>>

  • subscribe(componentOptions: NonNullableObject<Omit<MessageButtonOptions, "customId">>[] | Partial<MessageButtonOptions> | Partial<MessageSelectMenuOptions>, action: (params: ActionParameters<undefined>, interaction: ButtonInteraction<CacheType> | SelectMenuInteraction<CacheType>, value: string | number) => undefined | SendableMessage, idle?: number, expectFromUserIds?: string[]): MessageActionRow
  • Parameters

    • componentOptions: NonNullableObject<Omit<MessageButtonOptions, "customId">>[] | Partial<MessageButtonOptions> | Partial<MessageSelectMenuOptions>
    • action: (params: ActionParameters<undefined>, interaction: ButtonInteraction<CacheType> | SelectMenuInteraction<CacheType>, value: string | number) => undefined | SendableMessage
        • (params: ActionParameters<undefined>, interaction: ButtonInteraction<CacheType> | SelectMenuInteraction<CacheType>, value: string | number): undefined | SendableMessage
        • Parameters

          • params: ActionParameters<undefined>
          • interaction: ButtonInteraction<CacheType> | SelectMenuInteraction<CacheType>
          • value: string | number

          Returns undefined | SendableMessage

    • Optional idle: number
    • Optional expectFromUserIds: string[]

    Returns MessageActionRow

Generated using TypeDoc