npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

revoice.js

v0.1.7542

Published

A voice module for Revolt

Downloads

21

Readme

Revoice.js - A Voice Module for Revolt

This package is still in developement and lacks many features.

You still are able to play sound to a voice channel. Other features like channel info will follow.

Developement paused because of vortex rewrite

Vortex are the voice servers behind revolt and they are currently being rewritten so adding new features now doesn't make any sense. User stuff, play/pause, audio works but without proper docs. I'm sorry about the docs but they will be updated in the upcoming rewrite of the library after the vortex update.

TODO:

  • [X] Play/Pause for the media class (help apreciated ;))
  • [X] Non-voice events like UserJoined and roominfo
  • [ ] Audio reception
  • [ ] Error Handling; Right now, you have to take care of things like stopping the music if you start to play another song while one is playing

Disclamer: I might have forgotten some things on the list and thus it might be extended. Feel free to open issues to suggest new features :)

Installation

Just execute npm install revoice.js to install the package, have fun! :)

Usage

TL;DR: You initiate a client, you join a voice channel and then you play media.

Please note that unlike on Discord bots, Revolt bots are able to join multiple voice channels at once. Thus a single bot is able to be in every voice channel it has access to. I have no idea about the limitations.

Media has to be created using the MediaPlayer class. You can stream both node streams and media files to revolt.

Example:

If you want to see a working music bot using revoice, check out Remix!

const { Revoice, MediaPlayer } = require("revoice.js");
const fs = require("fs");

const revoice = new Revoice("the-token-of-your-bot");
const connection = await revoice.join("the-voice-channel-id");
const media = new MediaPlayer();
connection.on("join", () => {
  connection.play(media); // playing audio does only work after the the bot joined the voice channel

  // IMPORTANT: If you want to hear music,
  // you have to call connection.play(media)
  // BEFORE you start playing something in the media player

  media.playFile("./assets/some-nice-song.mp3");
  // or something like the following:
  media.playStream(fs.createReadStream("./assets/some-nice-song.mp3"));

  // you don't have to store the voice connection, you can retrieve it if you have the id of the voice channel like this:
  const con = revoice.getVoiceConnection("someChannelId");

  // ... pause it
  media.pause();

  // ... resume it later
  media.resume();
});

Connect to self-hosted instances

You can pass the configuration data for revolt-api and thus connect it to a self-hosted instance. For the data you can pass, see oapi

Documentation

For the documentation, please have a look at the pages deployment: https://shadowlp174.github.io/revoice.js/docs