Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

discord-play

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-play

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

  • 3.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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.

Keywords

FAQs

Package last updated on 07 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc