# Temporary channel

> A voice channel created for whoever asks for one and deleted by MayaBot once it is empty.

Source: https://docs.mayabot.eu/modules/temp-channels

MayaBot creates a voice channel for a member and deletes it once it is empty. You'll find it in **Config > Automation**.

You can have up to **3 setups** per server, of two types:

| Type | How the channel is requested |
|---|---|
| **Voice channel** | The member joins a voice channel you chose, the generator. MayaBot creates their channel and moves them into it |
| **Message with button** | MayaBot publishes a message with the **Create channel** button. Whoever presses it gets the link to their channel |

There are no commands: the channel owner manages it with the Discord permissions they receive.

## Creating a setup

### Turn the module on and press +

Turn on the **Temporary channel** switch and press **+**.

### Choose the type

In **Type** choose **Voice channel** or **Message with button**, then the generator voice channel or the **Message channel**.

### Choose the category

In **Category** choose where to create the channels. MayaBot must have **Manage Channels** and **Manage Permissions** there; for the Voice channel type also **Move Members** and **Connect**.

### Name and permissions, then Save

Set the **Channel name** and the **Permissions for whoever creates the channel**, then press **Save**. With the Message with button type, MayaBot publishes the message straight away.

## The two types

**Voice channel**

When a member joins the generator:

- if they already have an open channel from this setup, MayaBot moves them there;
- otherwise it creates the channel in the category and moves them into it.

If something goes wrong (module off, missing permissions, too many channels) the member stays in the generator and gets no message. A voice channel can be the generator for only one setup.

**Message with button**

MayaBot publishes a message with the **Create channel** button in the **Message channel**. Whoever presses it gets a reply only they can see, with the link to the channel; they aren't moved, they join from the link themselves. If nobody joins, the channel is deleted after about 30 seconds.

The message has the three formats of the [Automatic message](https://docs.mayabot.eu/modules/auto-messages#format) (Content, Embed v1, Embed v2), but without uploaded images: image fields only take links or `%servericon%`. Default text: "Press the button to create your temporary voice channel."

In **Button** choose **Label** (up to 80 characters) and **Emoji**. In Embed (v2) you can put the button wherever you like by choosing **Create channel** as the **Action** of a button; if you don't, MayaBot adds it at the end.

To publish the message again, for example after deleting it on Discord, use the **Publish again** icon in the setup's row. If the channel and format haven't changed, MayaBot edits the existing message instead of sending another one.

The replies to the button:

| Reply | Meaning |
|---|---|
| Your channel is ready | Channel created |
| You already have a channel | You already have a channel from this setup |
| Temporary channels are turned off in this server. | The module is off |
| This button is no longer set up. | The setup or the category no longer exists |
| MayaBot is missing the permissions to create the channel. | Permissions are missing in the category |
| There are too many channels in this server, try again later. | Too many open channels |
| Try again in a moment. | You pressed twice in a row or there's a temporary error |

## Channel name

The default name is "%displayname%'s channel", in the [server language](https://docs.mayabot.eu/getting-started/server-language). You can write up to **40 characters** of text, not counting placeholders, and the final name is no longer than 100 characters.

| Placeholder | Becomes |
|---|---|
| `%username%` | Username of whoever creates the channel |
| `%displayname%` | Display name in the server |
| `%userid%` | User ID |
| `%createdat%` | Account creation date, DD/MM/YYYY |
| `%server%` | Server name |
| `%serverid%` | Server ID |
| `%membercount%` | Member count |

MayaBot only sets the name on creation and never renames channels. User limit and bitrate stay at Discord's defaults: the owner can change them if they have **Manage Channel**.

## Owner permissions

Whoever creates the channel is its owner and always gets **View Channel** and **Connect**, plus the ones chosen in **Permissions for whoever creates the channel**:

| Checkbox | What they can do in their channel |
|---|---|
| **Manage Channel** (default) | Change the name, user limit and other settings |
| **Manage Permissions** | Decide who joins and who speaks |
| **Move Members** | Move or disconnect people |
| **Mute and deafen members** | Mute people in their channel |

Otherwise the channel has the same permissions as the category. MayaBot only gives a permission if it has it too, in the server and in the category.

> **Manage Permissions**
>
> The owner only gets **Manage Permissions** if MayaBot has the **Administrator** permission in the server. Without it, the checkbox has no effect: the dashboard reminds you below the checkboxes.

### Mutes only in the channel

On Discord muting someone applies across the whole server. When it's the owner who mutes a person in their channel, MayaBot makes the mute apply only there: it removes it when the person goes to another voice channel and puts it back when they return.

MayaBot needs **View Audit Log**, **Mute Members** and **Deafen Members**. Mutes given by others, for example by moderators, stay as Discord handles them.

With the module off, MayaBot doesn't save new mutes and doesn't put them back: it only removes the ones given before, when the person leaves the channel, so they don't stay across the whole server.

## When a channel is deleted

MayaBot deletes a channel about 30 seconds after the last person leaves. This also applies to a newly created channel that nobody joins. A bot left inside, for example a music bot, counts as a person and keeps the channel open.

- Each person can have one channel per setup.
- A server can have at most **50** temporary channels open.
- Turning the module off, deleting a setup or resetting doesn't delete channels already open: they disappear once they're empty.
- After a restart, MayaBot remembers the channels it created and deletes them once they're empty.

## MayaBot's permissions

| Where | Permissions |
|---|---|
| Category | **View Channel**, **Manage Channels**, **Manage Permissions**; for the Voice channel type also **Move Members** and **Connect** |
| Generator channel | **Move Members** |
| Message channel | **View Channel**, **Send Messages**; with Embed (v1) also **Embed Links** |
| Mutes | **View Audit Log**, **Mute Members**, **Deafen Members** |

## Common problems

| Problem | Fix |
|---|---|
| The **+** is grey: **No category where MayaBot can create channels.** | Give MayaBot **Manage Channels** and **Manage Permissions** on at least one category |
| I join the generator and nothing happens | Check the red warnings in the setup's row. Leave and rejoin after a few seconds |
| The channel is created but I'm not moved | MayaBot is missing **Move Members** or **Connect** |
| The owner doesn't get a permission | MayaBot doesn't have that permission in the category, or it's **Manage Permissions** and MayaBot isn't Administrator |
| The empty channel isn't deleted | A bot is still inside, or MayaBot has lost **Manage Channels** on that channel |
| The mute applies across the whole server | MayaBot is missing **View Audit Log**, or it wasn't the owner who muted |
| The message with the button doesn't appear | Check the permissions in the channel and use **Publish again** |
