This package has been deprecated

Author message:

This package is no longer maintained. Please consider using alternatives.

@2pg/music
TypeScript icon, indicating that this package has built-in type declarations

1.1.7 • Public • Published

2PG Music

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

Discord

Docs - https://twopg.github.io/music

Example

npm i -S @2pg/music discord.js

ES6:

import { Client } from 'discord.js';
import { MusicClient } from '@2pg/music';

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

music.on('trackStart', (player, track) => player.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

Package Sidebar

Install

npm i @2pg/music

Weekly Downloads

14

Version

1.1.7

License

ISC

Unpacked Size

410 kB

Total Files

47

Last publish

Collaborators

  • adamjr