# MusicClient Guide

## Make music system works

Importing the packages needed using the following code

```javascript
const { musicClient } = require("discord.lib")
require("node-opus or opusscript")
```

{% hint style="info" %}
&#x20;You should probably install ffmpeg since ffmpeg-binaries from npm might cause error, This function will not work on online services
{% endhint %}

## Install ffmpeg

### Windows

Download at <https://ffmpeg.zeranoe.com/builds/>

### Mac

Download at <https://evermeet.cx/ffmpeg/>

### Linux Command Line

```javascript
1. sudo apt update
2. sudo apt install ffmpeg
3. ffmpeg -version
```

## Actual code

```javascript
const { musicClient, login } = require("discord.lib")
musicClient("your prefix", "Youtube api key")
login("token", "game")
```

### Install opusscript or node-opus for it to work

```javascript
npm i node-opus/opusscript
```

## Using discord.lib to play music

### Let's import packages first

```javascript
const { musicClient, login } = require("discord.lib")
require("node-opus or opusscript")
```

### Main code

The main code is one of the function in discord.lib.

```javascript
musicClient("your prefix", "yt-api-key")
login("token")
```

### Resulting code

```javascript
const { musicClient, login } = require("discord.lib")
require("node-opus or opusscript")
musicClient("your prefix", "yt-api-key")
login("token")
```

And you are all set!


---

# 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://discordlib.js.org/guides/musicclient-guide.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.
