> For the complete documentation index, see [llms.txt](https://docs.ragnasync.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ragnasync.com/event-logs/staff/at-command-log.md).

# @Commands

Logs @commands executed by staff members to Discord

The `AtCommandScript` handles logging of @commands (GM commands) executed in-game to Discord for audit purposes.

## Action

`at_command`

## When It's Used

This script is triggered when:

* A player executes any @command (e.g., `@warp`, `@item`, `@ban`)
* The player's group ID meets or exceeds the configured minimum
* @command logging is enabled in the server configuration

## Why Use It

* **Audit GM activity** to ensure staff members are following guidelines
* **Track abuse** by logging all privileged commands
* **Maintain accountability** with permanent Discord logs
* **Monitor server administration** in real-time

## Server Configuration

In `conf/channels.conf`:

```
// @Command logging to Discord
ragnasync_at_command_log_enabled: true
ragnasync_at_command_log_channel_id: "YOUR_CHANNEL_ID"
ragnasync_at_command_log_group_min: 1
ragnasync_at_command_log_group_max: 99
```

| Setting      | Description                         | Default |
| ------------ | ----------------------------------- | ------- |
| `enabled`    | Enable/disable @command logging     | `false` |
| `channel_id` | Discord channel ID for command logs | -       |
| `group_min`  | Minimum GM group level to log       | `1`     |
| `group_max`  | Maximum GM group level to log       | `99`    |

**Tip:** Set `group_min: 99` to only log admin commands, or `group_min: 1` to log all staff activity.

## Message Format

The script sends formatted messages to Discord:

```
🔸 Command Log:   | 2000001 | 150001  | AdminName        | @warp prontera  | 14:30:25 |
```

Format: `Account ID | Char ID | Character Name | Command | Time`

## Data Fields

| Field        | Type   | Description                                 |
| ------------ | ------ | ------------------------------------------- |
| `name`       | string | Name of the character executing the command |
| `command`    | string | The full @command with arguments            |
| `account_id` | int    | Player's account ID                         |
| `char_id`    | int    | Player's character ID                       |
| `pos`        | string | Player's location: \`map                    |
| `channel`    | string | Discord channel ID                          |

## Example Use Cases

### Log All Staff Commands

Set a low group threshold to log all staff activity:

```
ragnasync_at_command_log_group_min: 1  // Log all staff groups
```

### Admin-Only Logging

Only log commands from administrators:

```
ragnasync_at_command_log_group_min: 99  // Admin group only
```

### Private Audit Channel

Send logs to a restricted channel only visible to senior staff:

```
ragnasync_at_command_log_channel_id: "1234567890123456789"  // #admin-audit
```

## Custom Messages

Want to customize how these messages look? Head to the **Message Routes** page on your dashboard, set the format to **Custom Message**, and compose your own template using `{{placeholder}}` syntax.

**Example template:**

```
:warning: {{player_name}} used {{command}}
```

**Available placeholders for this event:**

| Placeholder        | Example                                                 |
| ------------------ | ------------------------------------------------------- |
| `{{player_name}}`  | Marky                                                   |
| `{{command}}`      | @storage                                                |
| `{{src_template}}` | :small\_orange\_diamond: Command Log: Marky \| @storage |

{% hint style="info" %}
`{{src_template}}` contains the pre-formatted message from your game server's `[template: ...]` field. If your server doesn't send one, it resolves to empty. See [Message Templates](/ragnascript/message-templates.md) for details.
{% endhint %}

See [Message Routing](/ragnascript/message-routing.md) for more about formats, conditions, and multi-channel routing.

## Notes

* Commands are logged with full arguments for complete audit trails
* Logs include timestamps for tracking when commands were executed
* Use with @request logging for comprehensive staff monitoring
