This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

discord-play
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

NPM

GITHUB DISCORD

discord-play (DisPlay)

A robust wrapper module for @discordjs/voice, implementing functions and emitting events making it easier to interact with the new voice module.

Features

  • DisPlayConnection (Voice Connection class)

    • Emits voice connection events like voiceConnectionKick, voiceConnectionMove, etc.
    • Contains utility functions such as toggleMute and toggleDeafen.
    • Contains built-in reconnection logic.
  • DisPlayPlayer (Audio Player class)

    • Emits audio player events like audioPlayerStart, audioPlayerFinish, etc.
    • Contains a simplified powerful 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.
    • Contains utility functions such as togglePause, toggleMute.

Documentation

For any help, feel free to join the discord server and ask.

Installation

NPM

Pre-requisites

The following are some required npm packages to be installed (alternatives provided) :

  • discord.js v13+
  • The new voice library - @discordjs/voice (Gets automatically installed as dependency)
  • Opus encoding library - @discordjs/opus or opusscript
  • FFmpeg - ffmpeg-static or ffmpeg installed globally in your system
  • Encrytion package - sodium or libsodium-wrappers

Importing

import { DiscordPlay, DisPlayEvent } from 'discord-play';
// or
const { DiscordPlay, DisPlayEvent } = require('discord-play');

Basic Usage

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.");
});

License

This repository uses MIT license.

Package Sidebar

Install

npm i discord-play

Weekly Downloads

4

Version

3.0.1

License

MIT

Unpacked Size

99.3 kB

Total Files

28

Last publish

Collaborators

  • tr1ckydev