For the complete documentation index, see llms.txt. This page is also available as Markdown.

Slash command responder

Run Slash Command is a special action: it runs a slash command for you, exactly as if you'd typed it into Discord yourself.

Anything you'd normally do by typing / and picking a command, a feature can do automatically.

It works a little differently from other actions, so it's worth understanding before you build with it.

Why it needs a channel

Slash commands don't exist everywhere. Discord decides which commands are available in which channel, based on which bots are there and what permissions they have.

For example, the /advice command from a bot in one server simply doesn't exist in a different server that doesn't have that bot.

So the action always asks you which channel to run in - and to show you a list of commands to pick from, Nighty has to go and ask Discord "what's available here?"

That's the whole reason for the setup below.

Follow these four steps in order and everything else falls into place.

1

Add a custom channel parameter

Before anything else, add a custom parameter of type Channel, pointing at a real channel where you know the command works.

Go to that channel in Discord, copy its ID, and use that.

This is the key move. Without a specific, real channel, Nighty has nothing to ask Discord about, and the command picker will be empty. You'll have to input the command and options by hand and make no mistakes.

2

Point the builder at it

Add the Run Slash Command action, and in the slash command builder set "Refers to" to the channel parameter you just made.

3

Pick the command and fill in the options

Now the slash command selector works. Nighty scans that channel and shows you every command actually available in it.

Choose your command from the list and fill in its options.

4

Switch the channel, if you need to

Once the command is chosen and configured, you can switch the reference to a different channel - including a dynamic one like channel from the event.

The command you picked stays selected. Only the destination changes.

Which setup do you need?

Always the same channel - you're done at step 3. Leave the reference pointing at your custom parameter. This is the simplest and most reliable setup, and it's what you want for scheduled commands on a Repeat Action event.

Specific servers, but the channel varies - do all four steps. Build the command against your known channel, then switch the reference to the event's channel.

But now the command could run anywhere the event fires, which isn't what you want. So restrict it with filters:

  • Server ID Whitelist - only the servers where that command exists

  • Channel ID Whitelist - only the exact channels you want

Options can be dynamic

The options you fill in aren't limited to fixed text. They accept expressions, the same as any other action field.

So a command's option can be built from the event:

  • A /ban command with the reason set to Triggered by userdisplayName

  • A /search command with the query taken from messagecontent

  • A /give command with an amount from a My Value

That's what turns this from "run one fixed command" into something that reacts to what actually happened.

Last updated