# Events

AdminBot raises events to inform your script about errors, group chat messages, and other occurrences.  
To handle these events, use the LSL `link_message` event.

## Parsing Events

The `link_message` event has the following syntax:

```csharp
link_message(integer sender_num, integer num, string str, key id) {
  if(num == SB_SETUP_SUCCESS) {
    // handle successful setup
  }
}
```

* `num` — contains the **event code**
* `str` and `id` — values depend on the specific event

Refer to the table below for details.

## Events List

| Command | Description |
|---------|-------------|
| **Command execution status** |
| [`SB_COMMAND_FAILED`](/doc/sb_command_failed-c1bjVeADs7) | Raised when a command execution error occurs. |
| [`SB_COMMAND_COMPLETED`](/doc/sb_command_completed-w7PzBw47Hw) | Raised when a command completes without errors. |
| **Setup status** |
| [`SB_SETUP_SUCCESS`](/doc/sb_setup_success-maE4hOMbrT) | Raised when the group is successfully set (exists and not expired). |
| [`SB_SETUP_FAILED`](/doc/sb_setup_failed-LLqcCiwisK) | Raised when there is an error setting the group (not found, expired, etc). |
| [`SB_SETUP_BOTNAME`](/doc/sb_setup_botname-bhJIrtJLnw) | Raised after AdminBot initializes. Delivers bot name and UUID. |
| **Group status request** |
| [`SB_STATUS_REPLY`](/doc/sb_status_reply-SUOQ7UwhYz) | Reply from [`SB_STATUS_QUERY`](/doc/sb_status_query-i2HUb8WGFw) command. |
| **Avatar status request** |
| [`SB_GROUP_CHECKED`](/doc/sb_group_checked-SITqOCN2eO) | Reply from [`SB_AVATAR_GROUP`](/doc/sb_avatar_group-DloC6llFSi) command. |
| **Group chat events** |
| [`SB_CHAT_SUCCESS`](/doc/sb_chat_success-vY11JNPIFL) | Raised when bot successfully connects to group chat ([`SB_CHAT_LISTEN`](/doc/sb_chat_listen-4QEbZ4X4CU)). |
| [`SB_CHAT_MESSAGE`](/doc/sb_chat_message-lAFyaTFRj5) | Raised when a group chat message is received. |



:::info
The numeric values for each event are available [here](/doc/headersconstants-GcLQFSzXtr).

:::

---

**Documents**

- [SB_CHAT_MESSAGE](https://sb-docs-dev.getoutline.com/s/dev/doc/sb_chat_message-lAFyaTFRj5)
- [SB_CHAT_SUCCESS](https://sb-docs-dev.getoutline.com/s/dev/doc/sb_chat_success-vY11JNPIFL)
- [SB_COMMAND_COMPLETED](https://sb-docs-dev.getoutline.com/s/dev/doc/sb_command_completed-w7PzBw47Hw)
- [SB_COMMAND_FAILED](https://sb-docs-dev.getoutline.com/s/dev/doc/sb_command_failed-c1bjVeADs7)
- [SB_GROUP_CHECKED](https://sb-docs-dev.getoutline.com/s/dev/doc/sb_group_checked-SITqOCN2eO)
- [SB_SETUP_BOTNAME](https://sb-docs-dev.getoutline.com/s/dev/doc/sb_setup_botname-bhJIrtJLnw)
- [SB_SETUP_FAILED](https://sb-docs-dev.getoutline.com/s/dev/doc/sb_setup_failed-LLqcCiwisK)
- [SB_SETUP_SUCCESS](https://sb-docs-dev.getoutline.com/s/dev/doc/sb_setup_success-maE4hOMbrT)
- [SB_STATUS_REPLY](https://sb-docs-dev.getoutline.com/s/dev/doc/sb_status_reply-SUOQ7UwhYz)