# music-2pg-clone

> Discord.js music used for 2PG (Clone)

Latest version **0.0.0** (published 2021-10-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install music-2pg-clone
pnpm add music-2pg-clone
yarn add music-2pg-clone
bun add music-2pg-clone
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2021-10-03 |
| First published | 2021-10-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 361.8 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | SturmBrot |
| Maintainers | elias33506 |
| Keywords | discord, discord music, discord.js music |

## Links

- npm: https://www.npmjs.com/package/music-2pg-clone
- Repository: https://github.com/twopg/music
- Homepage: https://twopg.github.io/music
- Issues: https://github.com/twopg/music/issues
- npm.io page: https://npm.io/package/music-2pg-clone

## Dependencies (6)

- [yt-search](https://npm.io/package/yt-search.md) ^2.4.1
- [ffmpeg-static](https://npm.io/package/ffmpeg-static.md) ^4.2.7
- [@discordjs/opus](https://npm.io/package/@discordjs/opus.md) ^0.3.3
- [@discordjs/voice](https://npm.io/package/@discordjs/voice.md) ^0.6.0
- [@types/yt-search](https://npm.io/package/@types/yt-search.md) ^2.3.0
- [discord-ytdl-core](https://npm.io/package/discord-ytdl-core.md) ^4.1.3

## Recent versions

- 0.0.0 (latest) — 2021-10-03

## README

# 2PG Music Clone
Simple music module, built with TypeScript, used by 2PG.

> This package was made as a proof-of-concept and is no longer maintained. Please consider using [alternatives](https://www.npmjs.com/search?q=discord%20music).

[![Discord](https://img.shields.io/discord/685862664223850497?color=46828d&label=Support&style=for-the-badge)](https://discord.io/twopg)

**Docs** - https://theadamjr.github.io/2pg-music

## Example
`npm i -S music-2p-clone discord.js`

**ES6**:
```ts
import { Client } from 'discord.js';
import { MusicClient } from '2pg-music';

const music = new MusicClient();
const bot = new Client();

music.on('trackStart', ({ textChannel }, track) => textChannel?.send(`\`${track.title}\` - **${track.requestor}** started.`));

bot.on('message', async (msg) => {
  if (msg.author.bot) return;
  
  if (msg.content === '.play') {
    const player = getPlayer(msg);
    await player.play('discord bot dashboard intro', { member: msg.member });
  }
});

function getPlayer(msg) {
  return music.get(msg.guild.id)
    ?? music.create({
      voiceChannel: msg.member.voice.channel,
      textChannel: msg.channel
    });
}

bot.login('<your_bot_token>');
```

[![Discord](https://img.shields.io/discord/685862664223850497?color=46828d&label=Support&style=for-the-badge)](https://discord.io/twopg)

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