# Server messages

Source: https://righteousbot.dev/docs/features/server-messages/

Welcome, goodbye, boost, unboost, join-DM and punishment messages, and how auto-delete differs on each.

Righteous can post your own embed code when someone joins, leaves, boosts, stops boosting or gets
punished, and DM one the moment they join. They all use the [embed-code language](/docs/features/embed-codes/);
this page is where you save each one. Try a code first with
[`,customembed`](/commands/server-tools/customembed/#customembed-create), so a typo costs you one
message instead of the next real join.

[`,config welcome`](/commands/server-tools/config/#config-welcome) is a different thing: it sends a
plain log embed to a log channel. The two run independently.

## Set a welcome, goodbye, boost or unboost message [#set-a-welcome-goodbye-boost-or-unboost-message]

Each needs **Manage Server**. A server can set one message per channel per trigger, in as many
channels as you like.

| Trigger               | Command                                                                                   |
| --------------------- | ----------------------------------------------------------------------------------------- |
| Member joins          | [`,welcomemessage`](/commands/server-tools/welcomemessage/#welcomemessage-add) (`,wmsg`)  |
| Member leaves         | [`,goodbyemessage`](/commands/server-tools/goodbyemessage/#goodbyemessage-add) (`,gbmsg`) |
| Member boosts         | [`,boostmessage`](/commands/server-tools/boostmessage/#boostmessage-add) (`,bmsg`)        |
| Member stops boosting | [`,unboostmessage`](/commands/server-tools/unboostmessage/#unboostmessage-add) (`,ubmsg`) |

<CommandBlock syntax=",welcomemessage add <channel> <code> [++delete <seconds>]" example=",welcomemessage add #general {color: #fb4868}$p{title: Welcome to {guild.name}}$p{description: {user.mention} is member number {guild.membercount}.}$p{thumbnail: {user.avatar}}$p{button: link && Read the rules && https://discord.com}" />

<EmbedPreview code="{color: #fb4868}$p{title: Welcome to {guild.name}}$p{description: {user.mention} is member number {guild.membercount}.}$p{thumbnail: {user.avatar}}$p{button: link && Read the rules && https://discord.com}" caption="What posts when someone joins, with the sample member begging standing in for the new arrival." />

The other three take the same shape. Each also has `check`, `list`, `remove` and `reset`:

<CommandBlock syntax=",welcomemessage check <channel>" />

<CommandBlock syntax=",welcomemessage remove <channel>" />

<CommandBlock syntax=",welcomemessage reset" />

* **`{user.mention}` pings, `{user}` is plain text.**
* **`{guild.membercount}` and `{guild.boostcount}` are read at send time.**
* **A colored button can carry a [private reply](/docs/features/embed-codes/#answer-a-button-with-a-private-reply).** It works on all four, and on a join DM, and it is filled in for whoever presses it.

<CommandBlock syntax=",welcomemessage add <channel> <code>" example=",welcomemessage add #general {title: Welcome, {user.name}}$p{button: blue && Rules && reply: {description: Be kind and keep chat on topic.}}" />

<EmbedPreview surface="message" code="{title: Welcome, {user.name}}$p{button: blue && Rules && reply: {description: Be kind and keep chat on topic.}}" caption="A welcome with a Rules button. Press it and only the person who pressed sees the reply." />

## Auto-delete a message [#auto-delete-a-message]

Trail `++delete <seconds>` on `add` to remove the message after a delay. Each surface treats it
differently:

| Surface                                                                     | `++delete`                |
| --------------------------------------------------------------------------- | ------------------------- |
| Welcome, goodbye, boost, unboost                                            | 1 to 60 seconds           |
| [`,joindm`](/commands/server-tools/joindm/#joindm-add)                      | stripped, never scheduled |
| [`,custommessage`](/commands/server-tools/custommessage/#custommessage-ban) | stripped, never scheduled |

<CommandBlock syntax=",welcomemessage add <channel> <code> ++delete <seconds>" example=",welcomemessage add #general {description: {user} joined}$p{button: link && Rules && https://discord.com}$p ++delete 5" />

<EmbedPreview code="{description: {user} joined}$p{button: link && Rules && https://discord.com}$p ++delete 5" caption="The message as it posts. The drawing leaves out ++delete 5, which removes it five seconds later." />

<Callout type="warn" title="Digits only, flag last">
  These four read `++delete` only at the very end and refuse a value they can't read, so
  `++delete 1m` is an error rather than a guess. Write whole seconds, 1 to 60.
</Callout>

## Send a join DM [#send-a-join-dm]

[`,joindm`](/commands/server-tools/joindm/#joindm-add) (**Manage Server**) DMs a code to a new member
the moment they join. No channel and no auto-delete: a DM the member may not have opened shouldn't
vanish.

<CommandBlock syntax=",joindm add <code>" example=",joindm add {color: #fb4868}$p{author: {guild.name} && {guild.icon}}$p{title: Welcome, {user.name}}$p{description: You're member number {guild.membercount}. Read the rules first, then say hello.}$p{thumbnail: {guild.icon}}$p{button: link && Read the rules && https://discord.com}" />

<EmbedPreview code="{color: #fb4868}$p{author: {guild.name} && {guild.icon}}$p{title: Welcome, {user.name}}$p{description: You're member number {guild.membercount}. Read the rules first, then say hello.}$p{thumbnail: {guild.icon}}$p{button: link && Read the rules && https://discord.com}" caption="What lands in the new member's DMs. The sample member begging stands in for them." />

<CommandBlock syntax=",joindm check" />

<CommandBlock syntax=",joindm remove" />

<Callout type="warn" title="No channel tokens in a DM">
  A DM has no channel, so a `{channel.name}` or `{channel.id}` anywhere in the code leaves **every**
  token as raw text, `{guild.name}` included. Name the server with `{guild.name}` and `{guild.icon}`,
  since the DM has nothing else to say who sent it.
</Callout>

A member with DMs closed never receives one, and the bot can't tell you.

## Customize a punishment message [#customize-a-punishment-message]

[`,custommessage`](/commands/server-tools/custommessage/#custommessage-ban) (`,cm`) replaces the
confirmation for a ban, jail, kick, mute, warn, timeout or any reversal with your own code. **Manage
Server and Server Premium**: without it the whole command is refused and the defaults keep posting.

<CommandBlock syntax=",cm <punishment> <code>" example=",cm ban {color: #fb4868}$p{author: {user} && {user.avatar}}$p{description: **{user}** was banned from {guild.name}.}$p{footer: User ID {user.id}}$p{timestamp:}" />

<EmbedPreview code="{color: #fb4868}$p{author: {user} && {user.avatar}}$p{description: **{user}** was banned from {guild.name}.}$p{footer: User ID {user.id}}$p{timestamp:}" caption="What posts in place of the default ban confirmation. The drawing leaves out the footer's timestamp." />

`<punishment>` is `ban`, `jail`, `kick`, `mute`, `unban`, `unjail`, `unmute`, `warn`, `timeout` or
`untimeout`.

<CommandBlock syntax=",cm <punishment> check" />

<CommandBlock syntax=",cm <punishment> reset" />

<CommandBlock syntax=",cm reset" />

[`,cm reset`](/commands/server-tools/custommessage/#custommessage-reset) alone clears **every**
punishment message.

* **Every `{user.*}` is the punished member, not the moderator.**
* **There is no token for the reason, duration or moderator.** `{reason}` posts the word `reason`.
* **Use `{user}`, not `{user.mention}`.** The member is gone by then, so a mention is a dead grey pill.

## Use the slash commands [#use-the-slash-commands]

Welcome, goodbye, boost, unboost and punishment messages are one command,
[`/messages`](/commands/server-tools/welcomemessage/#welcomemessage-welcome-add), with a group per
surface (`/messages welcome add`). &#x2A;*Join DMs are separate:**
[`/joindm`](/commands/server-tools/joindm/#joindm-add). On slash, `add` opens a pop-up for the code,
`++delete` included.

## Common issues [#common-issues]

**A message never posts.** The target must be a text channel the bot can see and send to. A code that
renders to nothing (every tag misspelled) also posts nothing.

**`++delete` does nothing on a join DM.** By design. It works on welcome, goodbye, boost and unboost.

**Only the welcome message is missing.** Check Send Messages and Embed Links in that channel. A
failure there no longer stops join DMs, autorole or role restoration.

**`,cm` answers "Server Premium Only".** That's the gate. Every other command here is free.
