# musicord

> A simple, powerful, and user-friendly music package for your Discord bot. Designed for DJS v14.

Latest version **0.0.1-beta** (published 2022-04-01) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install musicord
pnpm add musicord
yarn add musicord
bun add musicord
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1-beta |
| Published | 2022-04-01 |
| First published | 2022-04-01 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16.9.0 |
| Dependencies | 5 |
| Unpacked size | 133.2 KB |
| Known vulnerabilities | 0 (+26 in 1 direct dependencies) |
| Install scripts | no |
| Author | RemyK |
| Maintainers | remyk |
| Keywords | musicord, discord-player, discord-music-system, distube, music, discord, bot, youtube, discord-music-, discord-music-player, discord-youtube, youtube-music |

## Links

- npm: https://www.npmjs.com/package/musicord
- Repository: https://github.com/RemyK888/musicord
- Homepage: https://musicord.js.org/
- Issues: https://github.com/RemyK888/musicord/issues
- npm.io page: https://npm.io/package/musicord

## Dependencies (5)

- [undici](https://npm.io/package/undici.md) ^4.15.1
- [discord.js](https://npm.io/package/discord.js.md) ^14.0.0-dev.1647259751.2297c2b
- [prism-media](https://npm.io/package/prism-media.md) ^1.3.2
- [ffmpeg-static](https://npm.io/package/ffmpeg-static.md) ^4.4.1
- [@discordjs/voice](https://npm.io/package/@discordjs/voice.md) ^0.9.0-dev.1647259738.2297c2b

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [whistle.savefor-mock](https://npm.io/package/whistle.savefor-mock.md) — 4 weekly downloads
- [@nxgt/graphql-codegen-msw](https://npm.io/package/@nxgt/graphql-codegen-msw.md) — 0 weekly downloads
- [fakesmith](https://npm.io/package/fakesmith.md) — 0 weekly downloads
- [@stigmer/eval-runtime](https://npm.io/package/@stigmer/eval-runtime.md) — 0 weekly downloads

## Recent versions

- 0.0.1-beta (latest) — 2022-04-01

## README

<p align="center">
  <img src="https://camo.githubusercontent.com/b916e46a616a53bc0b9c3c57ed146baeb3495ef5710ca87cf09da36eae4cef67/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3830313033373933313139353636323333362f3935363631343834373235303935363331382f6c6f676f5f70726f67726573735f6261722e706e673f77696474683d31343430266865696768743d333230" alt="Musicord logo">
  <img src="https://forthebadge.com/images/badges/made-with-typescript.svg" alt="Made with Typescript"> 
  <br>
  <img src="https://img.shields.io/npm/dt/musicord?style=for-the-badge" alt="Downloads">
</p>

<h3><strong>A simple, powerful, and user-friendly music package for your Discord bot. Made for <a href="https://www.npmjs.com/package/discord.js">Discord.js v14</a> and <a href="https://www.npmjs.com/package/@discordjs/voice">Discord.js/voice v9</a>.</strong></h3>

# 🔑 Features
- Easy to use
- Multiple server
- Audio filters
- Lightweightmu
- Faster than other packages

*Note that this package is still under development, if you encounter any errors, please join the [RemyK Discord server](https://discord.gg/UBUSgw4) so that this problem can be fixed as soon as possible.*

# 🔩 Installation
## Install [@discordjs/opus](https://www.npmjs.com/package/@discordjs/opus) and [FFmpeg](https://www.npmjs.com/package/ffmpeg)
```sh
$ npm install @discordjs/opus ffmpeg
```
## Install [musicord](https://www.npmjs.com/package/musicord)
```sh
$ npm install musicord
```

[Tweetnacl](https://www.npmjs.com/package/tweetnacl) is recommended for better performance.

*If you encounter installation errors, please refer to [this page]() of the [documentation]()*


# 💻 Code example
```js
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { Client } = require('discord.js');
const { Musicord, ApplicationCommandSchema } = require('musicord');

const client = new Client({
  intents: 32767
});

const commandsSchema = new ApplicationCommandSchema({
  play: {
    description: 'Play a song',
    implemented: true,
    options: {
      name: 'link',
      description: 'YouTube URL',
      required: true,
      type: 3
    }
  }
});

const musicordPlayer = new Musicord();
const rest = new REST({ version: '10' }).setToken('token');

(async () => {
  try {
    console.log('Started refreshing application (/) commands.');
    await rest.put(
      Routes.applicationGuildCommands('client id', 'guild id'),
      { body: commandsSchema.extract() },
    )
    console.log('Successfully reloaded application (/) commands.');
  } catch (error) {
    console.error(error);
  }
})();

client.on('interactionCreate', (interaction) => {
if(!command.isCommand()) return; 
if (interaction.commandName === 'play') {
      const msgArgs = interaction.options.get('link').value
      if (!msgArgs) return interaction.reply('Argument required');
      const msgMember = interaction.guild.members.cache.get(interaction.member.user.id);
      if (msgMember && msgMember.voice.channel) {
        if (musicordPlayer.existQueue(interaction.guild)) {
          const queue = musicordPlayer.getQueue(interaction.guild);
          if (queue) await queue.play(msgArgs, msgMember.voice.channel);
          const queueInfo = musicordPlayer.getQueueInfo(interaction.guild);
          if (queueInfo && queue) interaction.reply(`${queueInfo.songs[1].title} has been added to the queue`)
        } else {
          const queue = musicordPlayer.initQueue(interaction.guild, {
            textChannel: interaction.channel ,
            voiceChannel: msgMember.voice.channel
          });
          if (queue) {
            interaction.deferReply();
            await queue.play(msgArgs, msgMember.voice.channel)
          }
          const queueInfo = musicordPlayer.getQueueInfo(interaction.guild);
          if (queueInfo) return await interaction.editReply(`Playing ${queueInfo.songs[0].title}`)
        }
      }
    }
});

client.login('token');
```

# 🔗 Links
 - [Documentation](https://musicord.js.org/)
 - [Github](https://github.com/RemyK888/musicord)
 - [NPM](https://www.npmjs.com/package/musicord)
 - [Discord server](https://discord.gg/UBUSgw4)

# 🌌 Projects made with [musicord](https://www.npmjs.com/package/musicord)
 - [musicord bot](https://github.com/ArthurLeo13/musicord-bot) by [ArthurLeo](https://github.com/ArthurLeo13)

# 🚀 Others

Before creating an issue, be sure that it has not already been deferred and try to come up with a simple approach to the issue so that deferral is accessible to all.

In order to submit a PR, make sure you have read the [contribution guide](https://github.com/RemyK888/musicord/blob/main/.github/CONTRIBUTING.md)

Thanks a lot to [ArthurLeo](https://github.com/ArthurLeo13) who supported me during the development of this project, and who helps me daily to maintain it.

I would also like to thank all the amazing members of my server who are helping to make this project happen !

*Note: This package is not affiliated with Discord Inc. or YouTube Inc.*

<strong>This package is under [Apache-2.0 license](https://www.apache.org/licenses/LICENSE-2.0).</strong>

<img src="https://discord.com/api/guilds/713699044811341895/widget.png?style=banner2" alt="Discord server widget image">


## **Made with ❤ by RemyK**

---
_Source: https://npm.io/package/musicord · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
