> For the complete documentation index, see [llms.txt](https://docs.nighty.one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nighty.one/custom-features-tab/slash-command-responder.md).

# 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.

## The recommended setup

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

{% stepper %}
{% step %}

### 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.

<figure><img src="/files/vEvSmMKrP295z6bIN42z" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
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.
{% endhint %}
{% endstep %}

{% step %}

### 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.

<figure><img src="/files/Kq9JnN2TY6kCy22kww79" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### 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.

<figure><img src="/files/lYCMrZIyFWPZwZK6tUep" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/yCSElgDfwzEYGEb7n6pv" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
**This is why the setup is worth it.** Pick from a list instead of typing command names and option names by hand - no guessing, no typos, and the options come with the right names and types already.
{% endhint %}
{% endstep %}

{% step %}

### 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.

<figure><img src="/files/JFlSDX5cbg0NcLGJVtrR" alt=""><figcaption></figcaption></figure>

The command you picked stays selected. Only the destination changes.
{% endstep %}
{% endstepper %}

## 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**](/custom-features-tab/filters.md):

* Server **ID Whitelist** - only the servers where that command exists
* Channel **ID Whitelist** - only the exact channels you want

{% hint style="warning" %}
**Don't skip the filters on this setup.** Without them, the feature will try to run the command in every channel the event reaches - including ones where it doesn't exist. Those attempts fail and clutter your log.
{% endhint %}

## Options can be dynamic

The options you fill in aren't limited to fixed text. They accept [**expressions**](/custom-features-tab/expressions.md), 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 user`→`displayName`
* A `/search` command with the query taken from `message`→`content`
* 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.
