> ## Documentation Index
> Fetch the complete documentation index at: https://docs.erlc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Discord Channel and Thread Management in erlc.dev Studio

> Create, edit, and manage Discord channels, threads, forum posts, invites, and AutoMod rules directly from your erlc.dev Studio automations.

Studio provides a complete set of blocks for managing the structure of your Discord server — create and configure text, voice, and category channels; spin up threads and forum posts; generate and revoke invites; and control AutoMod rules, all from inside your automation flows. This page covers every channel, thread, and bot-control block available.

## Channel Management

### Creating Channels

Use **`erlc_bot_create_channel`** to create a new channel of any type in the server. After the block runs, set `RESULT_VARIABLE` to store the new channel's ID for use in later blocks.

| Input / Field | Description |
| - | - |
| `NAME` input | The name of the new channel |
| `CHANNEL_TYPE` field | `0` = Text, `2` = Voice, `4` = Category, `5` = Announcement |
| `RESULT_VARIABLE` field | Variable name to store the created channel's ID |

### Deleting and Editing Channels

* **`erlc_bot_delete_channel`** — Permanently delete a channel. Input: `CHANNEL_ID`
* **`erlc_bot_edit_channel`** — Rename an existing channel. Inputs: `CHANNEL_ID`, `NAME`

### Channel Settings

<CardGroup cols={2}>
  <Card title="Set Category" icon="folder">
    **`erlc_bot_set_channel_category`** — Move a channel into a category.

    Inputs: `CHANNEL_ID`, `CATEGORY_ID`
  </Card>

  <Card title="Set Topic" icon="comment-lines">
    **`erlc_bot_set_channel_topic`** — Set the channel topic displayed below the channel name.

    Inputs: `CHANNEL_ID`, `CONTENT`
  </Card>

  <Card title="NSFW Toggle" icon="eye-slash">
    **`erlc_bot_set_channel_nsfw`** — Mark or unmark a channel as age-restricted.

    Inputs: `CHANNEL_ID`; Field: `ENABLED` (`true` / `false`)
  </Card>

  <Card title="Slowmode" icon="snail">
    **`erlc_bot_set_channel_slowmode`** — Set a per-user cooldown between messages (in seconds). Use `0` to disable.

    Inputs: `CHANNEL_ID`, `SECONDS`
  </Card>

  <Card title="Lock Channel" icon="lock">
    **`erlc_bot_lock_channel`** — Lock or unlock a channel, preventing members from sending messages.

    Inputs: `CHANNEL_ID`; Field: `LOCKED` (`true` / `false`)
  </Card>

  <Card title="Sync Permissions" icon="arrows-rotate">
    **`erlc_bot_sync_channel_permissions`** — Sync the channel's permission overrides to match its parent category.

    Input: `CHANNEL_ID`
  </Card>
</CardGroup>

<Tip>
  When locking a channel, pair `erlc_bot_lock_channel` with `erlc_bot_send_message` to notify members why the channel is temporarily closed.
</Tip>

***

## Threads and Forum Posts

### Creating Threads

<CardGroup cols={2}>
  <Card title="Create Thread" icon="code-branch">
    **`erlc_bot_create_thread`** — Create a public thread in a text channel.

    Inputs: `CHANNEL_ID`, `NAME`; Field: `RESULT_VARIABLE`
  </Card>

  <Card title="Create Thread (v2)" icon="code-branch">
    **`erlc_bot_create_thread_v2`** — Create a thread with explicit type control.

    Inputs: `CHANNEL_ID`, `NAME`; Fields: `THREAD_TYPE` (`11` = public, `12` = private), `RESULT_VARIABLE`
  </Card>
</CardGroup>

Use `erlc_bot_create_thread_v2` when you need a **private thread** visible only to explicitly added members.

### Forum Posts

**`erlc_bot_create_forum_post`** — Create a new post in a forum channel.

| Input / Field | Description |
| - | - |
| `CHANNEL_ID` input | The forum channel to post in |
| `NAME` input | Title of the forum post |
| `CONTENT` input | Initial message content for the post |
| `RESULT_VARIABLE` field | Variable to store the created thread's ID |

### Thread Settings

* **`erlc_bot_set_thread_archived`** — Archive or unarchive a thread. Input: `THREAD_ID`; Field: `ARCHIVED` (`true` / `false`)
* **`erlc_bot_set_thread_locked`** — Lock or unlock a thread. Input: `THREAD_ID`; Field: `LOCKED` (`true` / `false`)
* **`erlc_bot_thread_member`** — Add or remove a member from a thread. Inputs: `MEMBER_ID`, `THREAD_ID`; Field: `ADD` (`true` to add, `false` to remove)

***

## Invites

### Creating Invites

**`erlc_bot_create_invite`** — Generate an invite link for a channel.

| Input / Field | Description |
| - | - |
| `CHANNEL_ID` input | The channel the invite points to |
| `MAX_AGE` input | How long the invite is valid, in seconds (`0` = never expires) |
| `MAX_USES` input | Maximum number of times the invite can be used (`0` = unlimited) |
| `RESULT_VARIABLE` field | Variable to store the generated invite code |

### Deleting Invites

**`erlc_bot_delete_invite`** — Revoke an existing invite by its code.

Input: `CODE` (the invite code, not the full URL)

***

## AutoMod Rules

AutoMod lets you automatically flag or block messages that match specific keywords or patterns.

<CardGroup cols={2}>
  <Card title="Create Rule" icon="shield-plus">
    **`erlc_bot_create_automod_rule`** — Create a new AutoMod rule.

    Inputs: `NAME`, `KEYWORDS`, `CONTENT`; Field: `RESULT_VARIABLE`
  </Card>

  <Card title="Delete Rule" icon="shield-minus">
    **`erlc_bot_delete_automod_rule`** — Remove an AutoMod rule.

    Input: `RULE_ID`
  </Card>

  <Card title="Rename Rule" icon="pen">
    **`erlc_bot_rename_automod_rule`** — Rename an existing rule.

    Inputs: `RULE_ID`, `NAME`
  </Card>

  <Card title="Enable / Disable Rule" icon="toggle-on">
    **`erlc_bot_set_automod_enabled`** — Enable or disable an AutoMod rule without deleting it.

    Input: `RULE_ID`; Field: `ENABLED` (`true` / `false`)
  </Card>
</CardGroup>

***

## Bot Control

Use these blocks to control the lifecycle of your custom Discord bot from within an automation flow.

| Block | Description |
| - | - |
| `erlc_start_custom_bot` | Start the custom bot if it is currently stopped |
| `erlc_stop_custom_bot` | Stop the custom bot |
| `erlc_restart_custom_bot` | Restart the custom bot (useful after configuration changes) |
| `erlc_set_custom_bot_status` | Update the bot's status/activity. Input: `STATUS` |

<Warning>
  Stopping or restarting the bot with `erlc_stop_custom_bot` or `erlc_restart_custom_bot` will interrupt any in-progress automations running on that bot. Make sure to use these blocks only at safe points in your flow.
</Warning>

***

## Raw Bot API Requests

For Discord API endpoints that don't have a dedicated block, use **`erlc_bot_request`** to send a raw HTTP request authenticated as your bot.

| Input / Field | Description |
| - | - |
| `ENDPOINT` input | The Discord API endpoint path (e.g. `/channels/{id}/messages`) |
| `PAYLOAD` input | JSON payload for the request body |
| `METHOD` field | HTTP method: `GET`, `POST`, `PUT`, `PATCH`, or `DELETE` |
| `RESULT_VARIABLE` field | Variable to store the API response |

<Note>
  The `ENDPOINT` input is relative to the Discord API base URL. You do not need to include `https://discord.com/api/v10`. Read the [Discord developer documentation](https://discord.com/developers/docs/reference) for available endpoints.
</Note>

***

## Example: Create a Private Thread and Add a Member

The JSON below creates a private thread in a channel and then adds a specific member to it.

```json theme={null}
{
  "type": "erlc_bot_create_thread_v2",
  "id": "create_thread_1",
  "fields": {
    "THREAD_TYPE": "12",
    "RESULT_VARIABLE": "newThreadId"
  },
  "inputs": {
    "CHANNEL_ID": {
      "block": {
        "type": "erlc_discord_channel_value",
        "id": "ch_val_1",
        "fields": { "ID": "1122334455667788990" }
      }
    },
    "NAME": {
      "block": {
        "type": "text",
        "id": "thread_name_1",
        "fields": { "TEXT": "Staff Discussion - Incident #42" }
      }
    }
  },
  "next": {
    "block": {
      "type": "erlc_bot_thread_member",
      "id": "add_member_1",
      "fields": { "ADD": "true" },
      "inputs": {
        "MEMBER_ID": {
          "block": {
            "type": "erlc_discord_event_value",
            "id": "member_id_ev",
            "fields": { "FIELD": "UserId" }
          }
        },
        "THREAD_ID": {
          "block": {
            "type": "erlc_variable_value",
            "id": "thread_id_var",
            "fields": { "VARIABLE": "newThreadId" }
          }
        }
      }
    }
  }
}
```

<Tip>
  Store the result of `erlc_bot_create_thread_v2` in a `RESULT_VARIABLE`, then reference that variable with an `erlc_variable_value` block when you need the thread ID in subsequent blocks.
</Tip>

## Example: Create a Channel and Set Its Topic

```json theme={null}
{
  "type": "erlc_bot_create_channel",
  "id": "create_ch_1",
  "fields": {
    "CHANNEL_TYPE": "0",
    "RESULT_VARIABLE": "newChannelId"
  },
  "inputs": {
    "NAME": {
      "block": {
        "type": "text",
        "id": "ch_name_1",
        "fields": { "TEXT": "incident-log" }
      }
    }
  },
  "next": {
    "block": {
      "type": "erlc_bot_set_channel_topic",
      "id": "set_topic_1",
      "inputs": {
        "CHANNEL_ID": {
          "block": {
            "type": "erlc_variable_value",
            "id": "ch_id_var",
            "fields": { "VARIABLE": "newChannelId" }
          }
        },
        "CONTENT": {
          "block": {
            "type": "text",
            "id": "topic_text",
            "fields": { "TEXT": "Automatically generated incident log channel." }
          }
        }
      },
      "next": {
        "block": {
          "type": "erlc_bot_lock_channel",
          "id": "lock_ch_1",
          "fields": { "LOCKED": "true" },
          "inputs": {
            "CHANNEL_ID": {
              "block": {
                "type": "erlc_variable_value",
                "id": "ch_id_var_2",
                "fields": { "VARIABLE": "newChannelId" }
              }
            }
          }
        }
      }
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.