> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-discord-monitor/cas-discord-monitor.md).

# CAS Discord Monitor

`cas-supchannel` is an in-game Discord channel monitor for **RedM** and **FiveM**. Admins can see who is in a Discord channel in real time, from inside the game, through a themed UI with sound notifications, multi-language support and extensive customization.

## Highlights

* Real-time Discord channel monitoring, in-game
* Wild West themed, movable UI with light/dark themes
* Join/leave sound notifications
* Multi-language (English and German out of the box)
* Admin-gated by Steam or Discord ID
* Configurable update interval and max users shown

## At a glance

|               |                                                                 |
| ------------- | --------------------------------------------------------------- |
| Platform      | RedM & FiveM                                                    |
| Discord       | Bot token + Presence / Server Members / Message Content intents |
| Resource name | `cas-supchannel`                                                |
| Config        | `config/server-config.json`, `config/client-config.json`        |
| Commands      | `/dc`, `/dcsettings`, `/dchide`                                 |

## Requirements

* A RedM or FiveM server with admin access
* A Discord server and an account with management permissions
* A Discord bot application (token)
* Tebex purchase + Keymaster access

## Installation

### 1. Download & install

Download `cas-supchannel` from your [Keymaster dashboard](https://keymaster.fivem.net/) and copy the folder into `resources/`.

### 2. Create the Discord bot

[Discord Developer Portal](https://discord.com/developers/applications) → New Application → Bot → Add Bot → copy the **token**. Enable these Privileged Gateway Intents: **Presence**, **Server Members**, **Message Content**.

### 3. Invite the bot

OAuth2 → URL Generator → scope `bot`, permissions: **View Channels**, **Read Message History**, **Connect**, **Use Voice Activity**. Open the generated URL and authorize it on your server.

### 4. Configure the server

`config/server-config.json`:

```json
{
  "discord": {
    "botToken": "YOUR_BOT_TOKEN_HERE",
    "guildId": "YOUR_GUILD_ID_HERE",
    "channelId": "YOUR_CHANNEL_ID_HERE",
    "updateInterval": 5000
  },
  "admins": [ "steam:YOUR_STEAM_HEX_ID", "discord:YOUR_DISCORD_ID" ]
}
```

Enable Discord **Developer Mode** to copy the guild, channel and user IDs.

### 5. Configure the client

`config/client-config.json` controls the UI position, theme (`light`/`dark`), sounds, `maxUsers`, keybinds (default `F4` toggle, `F6` settings), command names and `language` (`en`/`de`).

### 6. Add to server.cfg

```
ensure cas-supchannel
```

Verify the console shows:

```
[Discord Monitor] Discord Channel Monitor started successfully!
```

## Commands

| Command       | Action                    |
| ------------- | ------------------------- |
| `/dc`         | Toggle the monitor window |
| `/dcsettings` | Open the settings panel   |
| `/dchide`     | Minimize the window       |

Only identifiers in the `admins` list can use these.

## Customization

* **Languages** — add a file in `locales/` (copy `en.json`) and translate.
* **Theme** — edit the CSS variables in `web/styles.css`.
* **Sounds** — replace `sounds/user_join.ogg` and `sounds/user_leave.ogg`.
* **Performance** — tune `updateInterval` (3000 / 5000 / 10000 ms) and `maxUsers` (25 / 50 / 100).

## Troubleshooting

* **Bot not connected** — check the token, that the bot is in your server, and its permissions.
* **Channel not found** — verify the channel ID and that the bot can View Channels.
* **Not authorized** — your Steam/Discord ID must be in `admins`, correctly formatted; restart after edits.
* **UI not showing** — confirm you are an admin, try `/dc`, check the browser console (F12).
* **No sounds** — ensure the sound files exist and sounds are enabled.
* **Debug** — run `set discord_debug true` in the console.

## Support

Join the [CAS Discord](https://discord.gg/X8bTK9Stwk) or contact us through Tebex.
