> For the complete documentation index, see [llms.txt](https://docs.rainmad.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rainmad.com/resources/watch-admin-menu/web-panel-and-discord/discord-bot.md).

# Discord bot

Run your server from Discord with slash commands, through the hosted **fivemad Watch** bot. You do not create a bot of your own: one bot serves every rm\_watch server, and every command goes through the same checks as the web panel.

## Setup

You need the [web panel](https://docs.rainmad.com/resources/watch-admin-menu/web-panel-and-discord/the-web-panel) working first (`rm_watch_key` in `server.cfg`).

1. Open your server on [fivemad.com/watch](https://fivemad.com/watch) and go to **Settings, Discord**.
2. Click **Invite the bot** and add it to your Discord server.
3. Click **Make a code**. In any channel of your Discord server, type `/watch link code:XXXXXXXX` with that code.
4. On the same page, pick a channel for each kind of notification, and map Discord roles to groups.

{% hint style="info" %}

* Only the licence owner can link. The account typing `/watch link` needs **Manage Server** in that Discord server, and a code works once, for 15 minutes.
* Nothing goes in `cfg.lua` or `server.cfg` for the bot. If you run your own bot with `rm_watch_discord_token`, role sync keeps using yours.
  {% endhint %}

## Who can do what

Nobody gets more from Discord than they have on the web panel. For each command fivemad checks the group the person holds on your server:

* the licence owner,
* a member added on **Staff and roles**,
* or the group one of their Discord roles is mapped to (the highest one when they hold several).

Role mappings are the same ones described on [Discord roles](https://docs.rainmad.com/resources/watch-admin-menu/permissions/discord-roles). Every command shows in the panel's audit log and the game's staff log with the Discord account that sent it. Answers are only shown to the person who ran the command.

## Commands

| Command                                                                | What it does                                                                                                                                                                                                 |
| ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `/watch link`, `/watch unlink`                                         | Link or unlink this Discord server (licence owner only).                                                                                                                                                     |
| `/watch me`, `/watch help`                                             | Your group and what it allows; what the bot can do.                                                                                                                                                          |
| `/player`                                                              | A player's card: status, ping, character, job, money, playtime, vehicles, warnings, with buttons to kick, warn, jail, ban, heal, revive, freeze, kill, give an item or money, set a job and spawn a vehicle. |
| `/players`, `/staff`, `/server`                                        | Who is online, staff in game, server status and performance.                                                                                                                                                 |
| `/kick`, `/warn`, `/jail`, `/unjail`, `/ban`, `/unban`, `/mute`        | Punishments. Reasons suggest your `cfg.admin.punish` presets; ban lengths like `3d`, `2w`, `perm`.                                                                                                           |
| `/bans`, `/appeals`                                                    | The ban list; list, view, accept, deny or question appeals.                                                                                                                                                  |
| `/tickets`                                                             | List, view, reply, claim and close tickets.                                                                                                                                                                  |
| `/money`, `/job`, `/item`, `/vehicle`                                  | Economy, items and vehicles.                                                                                                                                                                                 |
| `/announce`, `/dm`, `/weather`, `/time`, `/revive`, `/heal`, `/freeze` | Server tools. `/revive all` and `/heal all` act on everyone.                                                                                                                                                 |
| `/whitelist add`, `/whitelist remove`                                  | By Discord account or identifier.                                                                                                                                                                            |
| `/poll`                                                                | Create, list and close polls.                                                                                                                                                                                |
| `/restart`                                                             | Schedule or cancel a restart countdown (owner by default).                                                                                                                                                   |

Player options suggest who is online as you type.

## Notifications

New tickets, new ban appeals, bans, restarts, and the server going down or coming back up. Each kind goes to the channel you pick, or nowhere. The send button beside a channel posts a test message.

## Unlinking

The licence owner unlinks from the **Discord** page or with `/watch unlink`. Members who got their group from a Discord role lose it with the link.

{% hint style="info" %}
**RedM:** the bot works the same for `rm_watch_redm`. Plate commands answer that RDR2 has no plates, and vehicle commands act on horses and wagons.
{% endhint %}
