# Autoresponder

Source: https://righteousbot.dev/docs/features/autoresponder/

Reply automatically when a message contains a phrase you choose.

An autoresponder replies on its own whenever a message **contains** your trigger phrase. It's free, and
every subcommand needs **Manage Server**. A [tag](/docs/features/tags/) is the opposite: a member asks
for it by name.

<Callout type="warn" title="A trigger matches anywhere in a message">
  Matching is a plain substring test, and it ignores case. A trigger of `hi` fires on `this`, `chip`
  and `whichever`. Use phrases long enough that they can't turn up inside ordinary words.
</Callout>

## Add an autoresponder [#add-an-autoresponder]

[`,autoresponder add`](/commands/server-tools/autoresponder/#autoresponder-add) takes the trigger, then
`||` with a space on each side, then the reply. The bot answers as a reply to the message. A trigger that
already exists is refused.

<CommandBlock syntax=",autoresponder add <phrase> || <response>" example=",autoresponder add cashapp? || my tag is $jasonquack" />

On slash, [`/autoresponder add`](/commands/server-tools/autoresponder/#autoresponder-add) takes the phrase
and the response as two options, so there's no `||` to type.

The reply is **plain text**. Variables like `{user.mention}` and `{guild.name}` fill in with whoever
triggered it (see [`,customembed variables`](/commands/server-tools/customembed/#customembed-variables)),
but [embed codes](/docs/features/embed-codes/) are not parsed: `{title: Hi}` posts as literal text.

## Delete the reply after a few seconds [#delete-the-reply-after-a-few-seconds]

End the response with `++delete <seconds>` (a whole number, 1 to 60). It's the only flag.

<CommandBlock syntax=",autoresponder add <phrase> || <response> ++delete <seconds>" example=",autoresponder add cashapp? || my tag is $jasonquack ++delete 10" />

Everything after `++delete` is cut from the reply, so put it last.

## Change or remove one [#change-or-remove-one]

| Command                                                                               | Does                                                                                                |
| ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| [`,autoresponder edit`](/commands/server-tools/autoresponder/#autoresponder-edit)     | Replaces the response. **Rewrites the `++delete` timer too**, so an edit without the flag clears it |
| [`,autoresponder rename`](/commands/server-tools/autoresponder/#autoresponder-rename) | Replaces the trigger; refused if another one already uses it                                        |
| [`,autoresponder remove`](/commands/server-tools/autoresponder/#autoresponder-remove) | Deletes one                                                                                         |

<CommandBlock syntax=",autoresponder edit <phrase> || <response>" example=",autoresponder edit cashapp? || ask a mod instead" />

<CommandBlock syntax=",autoresponder rename <phrase> || <newname>" example=",autoresponder rename cashapp? || paypal?" />

<CommandBlock syntax=",autoresponder remove <phrase>" example=",autoresponder remove cashapp?" />

## See what the server has [#see-what-the-server-has]

| Command                                                                               | Shows                                     |
| ------------------------------------------------------------------------------------- | ----------------------------------------- |
| [`,autoresponder list`](/commands/server-tools/autoresponder/#autoresponder-list)     | Every trigger, numbered (not the replies) |
| [`,autoresponder info`](/commands/server-tools/autoresponder/#autoresponder-info)     | One trigger and its full response         |
| [`,autoresponder author`](/commands/server-tools/autoresponder/#autoresponder-author) | Who made it                               |

## Delete them all [#delete-them-all]

<Callout type="warn" title="No confirmation, no undo">
  [`,autoresponder reset`](/commands/server-tools/autoresponder/#autoresponder-reset) deletes every
  autoresponder in the server at once.
</Callout>

## What it won't do [#what-it-wont-do]

* **One reply per message.** If two triggers match, only one answers, and you can't choose which. A short
  trigger inside a longer one (`cash` and `cashapp?`) can make the longer one unreachable.
* **No per-channel switch.** [`,command disable`](/commands/server-tools/command/#command-disable) and the
  [message filters](/docs/protection/message-filters/) don't stop it. Take away the bot's Send Messages in
  that channel instead.
* **It skips** other bots, [trap channels](/docs/protection/trap-channel/) and messages caught by
  [flood protection](/docs/protection/flood-protection/).

## Common issues [#common-issues]

**It fires on words I never meant.** That's substring matching. Lengthen the trigger: `cashapp?` is far
safer than `cash`.

**The wrong trigger keeps answering.** Only one fires per message. Rename one so they can't both match.

**`info` says the phrase is invalid.** Triggers are stored lowercase and `info` looks up exactly what you
type. Copy the phrase from `,autoresponder list`.

**My `++delete` timer vanished or never worked.** An `edit` without the flag clears it, and the timer must be 1
to 60 and the last thing in the response.
