> For the complete documentation index, see [llms.txt](https://documentation.botghost.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.botghost.com/custom-commands-and-events/actions/music-actions/set-autoleave.md).

# Set AutoLeave

{% hint style="warning" %}
This action requires a [Premium Subscription](/premium/premium-and-priority-hosting-plans.md#premium-plans) to function.
{% endhint %}

<figure><img src="/files/e9qXi4kINuzpsiFBe7zc" alt=""><figcaption></figcaption></figure>

The Set AutoLeave action enables or disables the bot’s automatic disconnection from the voice channel when the music queue ends.

## Server

This setting selects which server the action applies to. You have two options to choose from:

{% tabs %}
{% tab title="Current Server" %}

<figure><img src="/files/AwoU2UKcfbmtcE9P6qob" alt=""><figcaption></figcaption></figure>

When you choose the Current Server option, the AutoLeave setting will be applied to the server where the command is executed.
{% endtab %}

{% tab title="Server ID" %}

<figure><img src="/files/BL5Y9J0bEnnF8I9pqxZZ" alt=""><figcaption></figcaption></figure>

When you select the Server ID option, the AutoLeave setting will be applied to the server matching the provided ID.

### Server ID

In this field, you can enter the ID of the server where you want the AutoLeave setting to be applied. Variables can be used in this field.
{% endtab %}
{% endtabs %}

## AutoLeave Status

<figure><img src="/files/FcEiKPLYdxVFR5kiVZ2N" alt=""><figcaption></figcaption></figure>

In this option you can choose whether the bot should automatically leave the voice channel when the music queue ends. If set to Enabled, the bot will disconnect once there are no tracks left to play. If set to Disabled, the bot will remain in the voice channel even after the queue is empty.
