A robust wrapper module for @discordjs/voice, implementing functions and emitting events making it easier to interact with the new voice module.
DisPlayConnection (Voice Connection class)
voiceConnectionKick
, voiceConnectionMove
, etc.toggleMute
and toggleDeafen
.DisPlayPlayer (Audio Player class)
audioPlayerStart
, audioPlayerFinish
, etc.play
function which supports playing from local audio files or online audio urls to readable stream of audio data or even a premade Audio Resource.togglePause
, toggleMute
.For any help, feel free to join the discord server and ask.
The following are some required npm packages to be installed (alternatives provided) :
discord.js
v13+@discordjs/voice
(Gets automatically installed as dependency)@discordjs/opus
or opusscript
ffmpeg-static
or ffmpeg installed globally in your systemsodium
or libsodium-wrappers
import { DiscordPlay, DisPlayEvent } from 'discord-play';
// or
const { DiscordPlay, DisPlayEvent } = require('discord-play');
import { DisPlayConnection, DisPlayPlayer, DisPlayEvent } from 'discord-play';
// joins the voice channel and attaches all connection logic
const connection = new DisPlayConnection(message.member.voice);
// attaches the premade audio player to the connection created
const player = new DisPlayPlayer(message.guild.id);
// sample connection event
connection.on(DisPlayEvent.VOICE_JOIN, (voiceId) => {
message.reply("Joined the voice channel.");
});
// sample player event
player.on(DisPlayEvent.PLAYING, () => {
message.channel.send("Now playing.");
});
This repository uses MIT license.
Generated using TypeDoc