# Command aliases

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

Give a command a second, server-specific name with arguments baked in.

An alias is a second name your server gives to a command it already has: `,yeet @someone` can run
`,timeout @someone 1d`. It's **Server Premium**, and every subcommand needs **Manage Server** (granted by
Discord or through [fake permissions](/docs/protection/fake-permissions/)). To rename a whole command for
everyone, see
[prefix and slash commands](/docs/getting-started/prefix-and-slash-commands/#give-a-command-your-own-name).

<Callout type="warn" title="A lapsed subscription silently stops aliases">
  Server Premium is checked on every use. If it lapses, your aliases are **kept** but the words fall
  through as ordinary text, with no error. They work again the moment the server is premium again.
</Callout>

## Create an alias [#create-an-alias]

[`,alias add`](/commands/server-tools/alias/#alias-add) takes the new name, the command it runs, then any
arguments to bake in.

<CommandBlock syntax=",alias add <name> <command> [args...]" example=",alias add yeet timeout {0} 1d" />

| Part        | Accepts                                                            |
| ----------- | ------------------------------------------------------------------ |
| `<name>`    | 1 to 32 letters, numbers, `-` or `_`, no spaces; stored lowercase  |
| `<command>` | Any top-level command, optionally with a subcommand (`clear bots`) |
| `[args...]` | Up to 200 characters of preset arguments and placeholders          |

A server holds at most **50** aliases. Aliases can't point at a developer-only or disabled command, or at
`alias` itself.

## Let the caller fill in the blanks [#let-the-caller-fill-in-the-blanks]

`{0}` is the first word the caller types, `{1}` the second, up to `{9}`. Anything typed beyond them is
appended, so `,shh @someone being rude` runs `,timeout @someone 10m being rude`.

<CommandBlock syntax=",alias add <name> <command> {0} [more args...]" example=",alias add shh timeout {0} 10m" />

Numbers must run from `{0}` with no gaps (`{0} {2}` is refused). The highest number plus one is how many
arguments the caller must give, and a run with too few is refused rather than run with a blank. `{{` and
`}}` print a literal `{` and `}`.

## Change, remove or wipe [#change-remove-or-wipe]

| Command                                                                              | Does                                                                                   |
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
| [`,alias edit <name> <command> [args...]`](/commands/server-tools/alias/#alias-edit) | Repoints an alias. It can't rename; remove and add instead. Works even at the 50 limit |
| [`,alias remove <name>`](/commands/server-tools/alias/#alias-remove)                 | Deletes one                                                                            |
| [`,alias clear confirm`](/commands/server-tools/alias/#alias-clear)                  | Deletes **every** alias                                                                |

<Callout type="warn" title="clear has no undo, and y counts as a confirmation">
  `confirm`, `yes` and a bare `y` all wipe everything. Without one, it just tells you how many aliases are
  at stake.
</Callout>

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

| Command                                                               | Shows                                                                       |
| --------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [`,alias list`](/commands/server-tools/alias/#alias-list)             | Every alias, grouped by the command it runs, with a count against the limit |
| [`,alias view <name>`](/commands/server-tools/alias/#alias-view)      | One alias in full: target, arguments needed, a worked example, who made it  |
| [`,alias search <query>`](/commands/server-tools/alias/#alias-search) | Matches the name and the command it runs                                    |

## Names that are refused [#names-that-are-refused]

A name that is already a real command or a built-in alias, one the server already uses, or a subcommand
of `alias` itself is refused. Such an alias would save and never run, so you're told at write time. For
example, `purge` is already `clear`'s own alias.

If a later release adds a command with the same name as one of your aliases, the real command wins and
your alias is marked `shadowed` in `,alias list` (and explained in `,alias view`), not deleted. Rename it.
`missing target` and `unavailable` markers work the same way.

## An alias is never a second door [#an-alias-is-never-a-second-door]

Every gate keys on the real command, never on the word typed. An alias inherits the command's permissions
(fake ones included), cooldown, [role restrictions](/commands/server-tools/restrict/#restrict-list),
[channel disables](/docs/getting-started/permissions-model/#turn-a-command-off-in-a-channel) and the
blacklist. So [`,command disable`](/commands/server-tools/command/#command-disable) and `,restrict` on a
command already cover all its aliases.

## Common issues [#common-issues]

**Nothing happens when I type my alias.** Check Server Premium is still active, then `,alias list`. An
alias whose target no longer exists also fails silently, and `list` marks it.

**"This alias needs 1 more argument".** The alias has a `{0}` you didn't fill. The message shows the shape
it wants, like `,shh <arg1>`.

**`,alias add` says the name is already a command.** Pick another word; the message names what it
collided with.

**An alias stopped working after an update.** A release took the name. Run `,alias view`, then rename it.

**Members can run an alias but not the command.** They can't. The permission is coming from elsewhere:
check [fake permissions](/docs/protection/fake-permissions/) and whether they hold Administrator.
