discord-play (DisPlay) - Beta Project
A powerful module backed by play-dl to create music bots easily and also interact with the new voice module for discord.js v13 in a more robust manner.
Features
- A flexible discord.js module to make music bots without any API key using
play-dl
- Supports YouTube and Spotify (only at the moment)
- Premade AudioPlayer and VoiceConnection event-based logic modules to simplify interacting with the new
@discordjs/voice
module - 100% promise based
- 100% event logic based
Installation
Pre-requisites
The following are some required npm packages to be installed (alternatives provided) :
discord.js
v13+ only- The new voice library -
@discordjs/voice
- Opus encoding library -
@discordjs/opus
or opusscript
- FFmpeg -
ffmpeg-static
or ffmpeg installed globally in your system - Encrytion package -
sodium
or libsodium-wrappers
- The data fetching module -
play-dl
Basic Usage
import { DiscordPlay, DisPlayEvent } from 'discord-play';
const { DiscordPlay, DisPlayEvent } = require('discord-play');
The main DiscordPlay module is currently work in progress but the separate modules are available for use.
Implementing the separate modules in your project
DisPlayConnection
and DisPlayPlayer
are two complete premade event-driven modules available inside DiscordPlay. You can include them in your project separately according to your need.
The full documentation for these two modules are available here.
import {
DisPlayConnection, DisPlayPlayer, DisPlayEvent
} from 'discord-play';
const connection = new DisPlayConnection(message.member.voice);
const player = new DisPlayPlayer(message.guild.id);
connection.on(DisPlayEvent.VOICE_JOIN, (voiceId) => {
message.reply("Joined the voice channel.");
});
player.on(DisPlayEvent.PLAYING, () => {
message.channel.send("Now playing.");
});