Discord Trigger icon

Discord Trigger

Trigger based on Discord events

Overview

This node triggers workflows based on various Discord events. It listens to specific Discord server activities such as new messages, message updates, thread creation or updates, commands, user interactions with buttons/selects, and user-related events like joining, leaving, presence updates, nickname changes, and role modifications.

Common scenarios include:

  • Automating responses or actions when a new message is posted in certain channels.
  • Reacting to user commands issued in Discord.
  • Tracking user presence or role changes for moderation or analytics.
  • Handling button or select menu interactions within Discord messages.

For example, you could use this node to trigger a workflow that welcomes new users when they join the server, or to start a process when a specific command is sent in a channel.

Properties

Name Meaning
Listen to Select one or more text channels to listen to for triggering the workflow. If none are selected, all channels will be listened to. Requires valid credentials and a running bot.
From roles Optionally filter events by user roles. If no roles are selected, it listens to everyone (@everyone). Only applicable for certain event types (e.g., message, thread, command, user leaves, presence update, etc.).
Trigger type The type of Discord event to listen for. Options include: New Message, Message Update, New Thread, Thread Update, Command, Interaction, User joins, User leaves, User presence update, User nick updated, User role added, User role removed.
Which roles For "User role added" or "User role removed" events, specify which roles to listen for. Defaults to listening to everyone if none selected.
Presence For "User presence update" events, specify the presence status change to listen for: Any change, Online, Offline, Do not disturb, Idle.
Pattern For message or thread events, define how to match the message content: Equals, Starts with, Contains, Ends with, Regex. The message is tested after removing mentions and trimming whitespace.
Value The string value to test against messages or threads according to the selected pattern. Required for message and thread trigger types.
Name For command triggers, the name of the command to listen for (alphanumeric only). Required for command trigger type.
Description Description of the command for command triggers. Required for command trigger type.
Input field type For command triggers, the type of input field expected: None, Text, Number, Integer, Boolean. Required for command trigger type.
Input field description Description of the input field for command triggers. Required if an input field type other than None is selected.
Input field required Whether the input field for the command is required. Optional, defaults to false.
Case Sensitive For message or thread triggers, whether matching should be case sensitive. Defaults to false.
Bot Mention For message or thread triggers, if true, the message must mention the bot to trigger the workflow (in addition to other criteria). Defaults to false.
Message ID For interaction triggers, the ID of the message containing the button or select menu to listen to. Required for interaction trigger type.
Placeholder A placeholder message shown in the channel when the workflow is triggered. Can be replaced by a response message from a Discord Send node.

Output

The node outputs JSON data representing the Discord event that triggered the workflow. The output includes fields such as:

  • content: The message content (if applicable).
  • channelId: The ID of the channel where the event occurred.
  • userId, userName, userTag: Information about the user involved.
  • messageId: The ID of the message (if applicable).
  • presence: User presence status (if applicable).
  • nick: User nickname (if applicable).
  • addedRoles, removedRoles: Roles added or removed from the user (if applicable).
  • interactionMessageId: The message ID related to an interaction event.
  • interactionValues: Values from user interactions (buttons/selects).
  • userRoles: Current roles of the user.
  • attachments: Any attachments included in the message.

If binary data were supported, it would typically represent files or media attached to messages, but this node primarily outputs JSON event data.

Dependencies

  • Requires a valid Discord API credential with a bot token.
  • The bot must be running and connected to the Discord server.
  • The node uses an internal IPC mechanism to communicate with the bot process.
  • Requires at least one accessible text channel in the Discord server.
  • The node depends on helper functions for fetching channels, roles, and managing connections.

Troubleshooting

  • No channels listed: Ensure your credentials are set correctly, the bot is running, and you have at least one text channel available. After fixing, close and reopen the modal to reload channels.
  • Commands not showing up in Discord: Verify the trigger is active and restart your Discord client.
  • Authentication errors: Check that the provided API key credential is valid and has the necessary permissions.
  • Workflow not triggering: Confirm the event type matches the actual Discord event, and filters like channels or roles are correctly configured.
  • Regex pattern issues: Make sure your regex is valid ECMAScript syntax and matches the intended message content after mentions are removed.
  • Error messages: Errors during execution throw descriptive messages wrapped in node operation errors. Use the error details to adjust configuration or credentials.

Links and References

Discussion