Skip to content

discordInteraction

Javier Colombera edited this page Aug 14, 2023 · 7 revisions

Introduction

The discordInteraction node listens for interactions inside discord. The current features are:

  • Listen only a specific type of interaction (button, select menu, slash command, message context menu, autocomplete) or all.
  • Listen for a specific command_name or custom_id on a interaction, or a set of them.
  • Obtain slash commands selected options.
  • Obtain select menu selected options.
  • Choose between two behaviors when you are listening components interactions: update or reply.

Configuration

Interactions flow

For commands, the node defers the reply. In case of buttons and select menu, the node defers the update. After that, the node sends interaction data to the flow, in order to edit it in a later moment in a flow. In order to complete the data flow, you need to complement this node with discordInteractionManager .

Interactions: common ways to respond

Type Discord action Node to use Steps
Command Interaction Reply discordMessageManager With action="edit" and msg.payload.message.id edits message of reply
Command Interaction Reply discordInteractionManager With action="edit" and msg.payload.id (interactionId output from discordInteraction node) edits message of reply. You can edit ephemeral replies.
Autocomplete Interaction Respond Autocomplete discordInteractionManager With action="respondAutocomplete" and msg.payload.id (interactionId output from discordInteraction node) respond with choices
Component Interaction Update discordMessageManager With action="edit" and msg.payload.message.id edits original message
Component Interaction Reply discordInteractionManager * With action="edit" and msg.payload.id (interactionId output from discordInteraction node) edits message of reply
* With action="edit" and msg.payload.message.interaction.id edits original message, if the message comes from a reply (message where the component is).

Important Notes: Command interactions (Slash commands, Message context menu) only can reply. For Component interactions you can choose to update or to reply. This impacts on the nodes you need to use after capturing the interaction.

Outputs

These are the ouputs for each created interaction that this node captures

Output Type Options Description
msg.payload Object General information of the interaction
msg.payload.user Object Information of discord interaction user
msg.payload.member Object Information of the guild member, user related
msg.payload.message String Information of the original message where the interaction occurs
msg.payload.options Array Array with selected options in the command
msg.interactionObject Object (Optional) Original Interaction Object

For more information about interactions and event interactionCreate, please see original documentation Receiving and Responding to an Interaction.