# Music

## <mark style="color:blue;">Introduction</mark>

The Music configuration file (`music.json`) controls Lavalink node connections, default playback settings, channel restrictions, and autoplay features.

***

## <mark style="color:blue;">Lavalink Nodes</mark>

**Type:** Array of Objects

Configure Lavalink servers for music playback.

```json
lavalink_nodes: [
    {
        name: 'Iynx',
        url: '127.0.0.1:2333',
        auth: 'youshallnotpass',
        secure: false,
    },
]
```

**name** - Descriptive name for the node\
**url** - Server address in format `ip:port`\
**auth** - Lavalink server password\
**secure** - Whether to use secure connection (true/false)

You can add multiple nodes and the bot will automatically select the one with the lowest traffic for optimal performance.

{% hint style="warning" %}
**Lavalink Addon Users:** If you have the Lavalink premium addon, this configuration is automatically overridden by the addon's servers.
{% endhint %}

***

## <mark style="color:blue;">Default Volume</mark>

**Type:** Number

Starting volume level for new music sessions.

```json
default_volume: 60
```

**Valid range:** 1 to 1000

This is the volume level used when the bot first starts playing music. Users can adjust it afterward using music commands.

***

## <mark style="color:blue;">Whitelist Channels</mark>

Restrict music commands to specific channels.

### <mark style="color:yellow;">enabled</mark>

**Type:** Boolean

Whether to enable channel restrictions.

```json
whitelist_channels: {
    enabled: false,
}
```

**When `true`:** Music commands only work in configured channels\
**When `false`:** Music commands work everywhere

***

### <mark style="color:yellow;">channels</mark>

**Type:** Array of Strings

List of channel IDs where music commands are allowed.

```json
channels: ["804354119523500082", "947577986939514881"]
```

Only applies when `enabled` is set to `true`.

***

## <mark style="color:blue;">Use Own Lavalink</mark>

**Type:** Boolean

Override addon Lavalink servers with your own configuration.

```json
use_own_lavalink: false
```

**When `true`:** Uses your configured Lavalink nodes even if you own the addon\
**When `false`:** Uses premium addon Lavalink servers (if you have the addon)

This option only matters if you have purchased the Lavalink addon.

***

## <mark style="color:blue;">Autoplay Enabled by Default</mark>

**Type:** Boolean

Automatically add similar songs to the queue.

```json
autoplay_enabled_by_default: false
```

**When `true`:** After the first song plays, the bot automatically adds similar tracks based on metadata\
**When `false`:** Bot only plays queued songs

***

## <mark style="color:blue;">Complete Configuration Example</mark>

Here's a production-ready music configuration:

```json
{
    config: {
        lavalink_nodes: [
            {
                name: 'Primary Node',
                url: '127.0.0.1:2333',
                auth: 'yourpassword',
                secure: false,
            },
            {
                name: 'Backup Node',
                url: '192.168.1.100:2333',
                auth: 'yourpassword',
                secure: false,
            },
        ],

        default_volume: 60,

        whitelist_channels: {
            enabled: true,
            channels: ["804354119523500082", "947577986939514881"],
        },

        use_own_lavalink: false,

        autoplay_enabled_by_default: false,
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.iynxdev.com/configuration-files/music.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
