$onInteraction[]

Triggered upon an interaction being emitted (e.g. a button being clicked).

Syntax

$onIneraction[Interaction ID]

Parameters

  • Interaction ID (Type: String || Flag: Required): The custom/menu/button/interaction ID used during the creation of buttons, menus, text fields, and other components.

Supports

Example

  1. Create two commands and set the trigger $onInteraction[example] for one command and !example for the other.

    • Code with trigger !example:

      $nomention
      Click!
      $addButton[no;example;Click!;primary]
      
    • Code with trigger $onInteraction[example]:

      $nomention
      $sendMessage[Hello $displayName!]
      
  2. Execute commands

    !example Click! Click Me! Hello Nicky!

How $addButton[] works?