> For the complete documentation index, see [llms.txt](https://docs.membercounter.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.membercounter.app/commands/setup.md).

# /setup

Set up some basic counters.

`/setup` builds a ready-made set of counters: it creates a category, the counter channels inside it, and a template on each channel. It is the only way to create counters without opening the dashboard.

```
/setup server
/setup twitch username:<channel username>
/setup youtube url:<channel URL>
```

**Who can run it:** administrators by default, and only inside a server. See [who can run `/configure` and `/setup`](/commands/bot-commands.md#who-can-run-configure-and-setup) to give it to other roles.

**What the bot needs:** Manage Channels and Manage Roles. Both are required, because each channel is created together with its permissions. Both are part of the [invite link](/getting-started/adding-bot-to-the-server.md).

<figure><img src="https://1582170640-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lu2S5r7lKtu4IK5ucu9%2Fuploads%2Fgit-blob-b9214a8b9debe32f2678f500691cf4a53091cc50%2Fcommand-setup-autocomplete.png?alt=media" alt="Discord autocomplete for /setup"><figcaption><p>The three subcommands, and the option each one asks for.</p></figcaption></figure>

## `/setup server`

No options. It creates the category **📊 Server Stats 📊** and five voice channels, in this order:

| Channel        | It shows             | Counter used                                                          |
| -------------- | -------------------- | --------------------------------------------------------------------- |
| Online members | `Online: <number>`   | [Members](/counters-reference/members.md), filtered to online members |
| Members        | `Members: <number>`  | [Members](/counters-reference/members.md)                             |
| Nitro boosters | `Boosters: <number>` | [Nitro boosters](/counters-reference/nitro-boosters.md)               |
| Roles          | `Roles: <number>`    | [Roles](/counters-reference/roles.md)                                 |
| Channels       | `Channels: <number>` | [Channels](/counters-reference/channels.md)                           |

These five work on every bot, including the public bot. On the public bot the member and online numbers come from Discord's approximate counts, so they lag more than the other three. See [How counters update](/using-the-dashboard/how-counters-update.md).

{% hint style="info" %}
**Online members** does not mean the same thing on every bot. On the public bot and on the legacy premium bot it counts everyone who is not offline: online, idle and do-not-disturb. A custom bot or a self-hosted bot, which have the privileged intents, counts only the members whose status is online. You can change the filter afterwards on the [Members](/counters-reference/members.md) counter.
{% endhint %}

<figure><img src="https://1582170640-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lu2S5r7lKtu4IK5ucu9%2Fuploads%2Fgit-blob-3e08f5b6f91086e316f07d91344f7b5af65678df%2Fcommand-setup-server-channels.png?alt=media" alt="The Server Stats category with its five counter channels"><figcaption><p>The result, seen by a member without administrator permissions.</p></figcaption></figure>

## `/setup twitch`

**username** is the name from the channel address, `twitch.tv/`**`yourname`**, not the display name. The command creates the category **📊 `<channel name>` Twitch Stats 📊** with two voice channels: `<number> Followers` and `Viewers: <number>`. While the channel is not live the viewers counter shows the word `offline`. More on the options in [Twitch](/counters-reference/twitch.md).

## `/setup youtube`

**url** is the full address of the channel, not of a video. The command creates the category **📊 `<channel name>` YouTube Stats 📊** with three voice channels: `<number> Subscribers`, `<number> Videos` and `<number> Views`. More on the options in [YouTube](/counters-reference/youtube.md).

<figure><img src="https://1582170640-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lu2S5r7lKtu4IK5ucu9%2Fuploads%2Fgit-blob-03a11d35d04e73be1f39678c22e8f75734b17cd1%2Fcommand-setup-twitch-youtube-channels.png?alt=media" alt="Twitch and YouTube stats categories"><figcaption><p>The Twitch set on the left, the YouTube set on the right.</p></figcaption></figure>

{% hint style="warning" %}
Both subcommands need a bot that can use those counters: the legacy premium bot, a [custom bot](/custom-bot/custom-bot.md) or a [self-hosted bot](/self-hosting/self-hosting.md). On the public bot nothing is created: the category name itself contains the counter, so the category fails and the command ends in an error. A self-hosted bot also needs the Twitch or YouTube API credentials, see [Configuration](/self-hosting/configuration.md).
{% endhint %}

## What the reply looks like

The reply updates itself while the work runs, with one line per channel showing whether it is pending, created or failed. The last line points you at `/configure`.

<figure><img src="https://1582170640-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lu2S5r7lKtu4IK5ucu9%2Fuploads%2Fgit-blob-a155e32d3bad8385ba3cd5dd08e64968507b5193%2Fcommand-setup-server-reply.png?alt=media" alt="The /setup server reply while it runs and when it finishes"><figcaption><p>The same message mid-run and after "Creation completed."</p></figcaption></figure>

## Why the new channels show a lock

Every channel the command creates denies **Connect** to **@everyone**, so members can read the counters but cannot join the voice channels and turn them into a call. Administrators bypass that and see no lock. This is also why the invite link asks for Manage Roles.

To let people in, open **Edit Channel** > **Permissions** on each counter channel and remove the @everyone **Connect** deny there, or sync that channel with the category. Clearing it on the category alone changes nothing, because a channel's own overwrite wins. The counters keep updating either way.

## If something fails

The category is created first, because the channels go inside it. If the category fails, nothing is created and the command ends in an error. If one channel fails, the others are still created, and you make the missing one yourself on the [dashboard](https://membercounter.app/dashboard).

| Message                                                                                | What to do                                                                                                                                                                          |
| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| "The specified Twitch channel could not be found."                                     | Check **username**. Use the name from the channel address, not the display name.                                                                                                    |
| "The provided YouTube channel URL is invalid."                                         | Paste the address of the channel itself, not of a video or a playlist. Channel id, `@handle` and legacy user addresses all work.                                                    |
| "The bot is not a premium version and lacks certain features needed for this counter." | This bot cannot use Twitch or YouTube counters. Use the legacy premium bot, a [custom bot](/custom-bot/custom-bot.md) or a [self-hosted bot](/self-hosting/self-hosting.md).        |
| "Something went wrong, please try again later."                                        | Anything the bot does not recognise, including a missing Manage Channels or Manage Roles permission. Quote the error ID in the [support server](https://membercounter.app/support). |

## After the command

Each created channel already has its template enabled, so it appears on the dashboard right away and updates on the normal cycle. From there you can rename it, change the wording around the number or delete it. See [Edit a counter's template](/using-the-dashboard/template-editor.md) and [Create a counter from scratch](/getting-started/create-from-scratch.md).

Running `/setup` again always creates a new category and new channels; it never reuses the ones you have.

<details>

<summary>Technical details</summary>

* The category names and channel templates are the locale strings under `interaction.commands.setup` in `apps/bot/src/locales/en-US/main.json`; that is where you change what `/setup` creates.
* The category is created and awaited first; the channels are then created with `Promise.all`, so they finish in any order even though the table lists them in template order.
* Every channel, category included, is created with two overwrites: the bot user allowed Connect + View Channel, the `@everyone` role denied Connect. The channels are not synced to the category, so each one carries its own deny.
* Templates are stored with `isTemplateEnabled: true` and a `LastTemplateUpdateDate` log entry (`GuildSettingsService.channels`), which is why the channel is already live on the dashboard.
* The templates are rendered in the language of the person who ran the command, not the server's language.
* The YouTube option's i18n key is `channelUrl`, but the name Discord shows and accepts is `url`.
* The Twitch and YouTube evaluators assert the premium flag first and otherwise throw `BOT_IS_NOT_PREMIUM`.
* Self-hosting: `/setup twitch` needs `TWITCH_CLIENT_ID` and `TWITCH_CLIENT_SECRET`, `/setup youtube` needs `YOUTUBE_API_KEY`, and `DISCORD_BOT_INSTANCE_IS_PREMIUM` must stay `true`. The three credentials are empty in `.env.example`, and a missing one throws a plain `Error`, not a `KnownError`, so the reply is the generic "Something went wrong, please try again later." with no hint about the cause.

</details>
