1.0.0 • Published 3 years ago

tabbymusicmodule v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Installation

Current stable version: 1.0

$ npm install tabbymusicmodule

Usage

const prefix = '!';
const music = require('tabbymusicmodule');
const manager = new music({
    ytapi: 'YouTube API token'
})

client.on('message', (msg) => {
    if(msg.author.bot) return;
    if(msg.content.startsWith(`${prefix}play`)){
        let player;
        if(!manager.getPlayer(msg.guild.id)){
            player = manager.createPlayer({
                voiceChannel: msg.member.voice.channel,
                textChannel: msg.channel,
            })
            .on('startedPlaying', (track) => {
                player.textChannel.send(`Now playing **${track.title}**`);
            })

            player.play(msg.content.split(' ').slice(1).join(' '));
        }else{
            player = manager.getPlayer(msg.guild.id);
            player.play(msg.content.split(' ').slice(1).join(' '));
        }
    }
})