0.1.7542 • Published 4 months ago

revoice.js v0.1.7542

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

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:

  • Play/Pause for the media class (help apreciated ;))
  • 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

0.1.7542

4 months ago

0.1.754

6 months ago

0.1.7541

6 months ago

0.1.7537

11 months ago

0.1.749

1 year ago

0.1.748

1 year ago

0.1.752

1 year ago

0.1.751

1 year ago

0.1.753

1 year ago

0.1.75

1 year ago

0.1.738

1 year ago

0.1.739

1 year ago

0.1.7533

1 year ago

0.1.745

1 year ago

0.1.7532

1 year ago

0.1.744

1 year ago

0.1.7535

1 year ago

0.1.747

1 year ago

0.1.7534

1 year ago

0.1.746

1 year ago

0.1.741

1 year ago

0.1.7536

12 months ago

0.1.740

1 year ago

0.1.743

1 year ago

0.1.742

1 year ago

0.1.7531

1 year ago

0.1.736

1 year ago

0.1.735

1 year ago

0.1.737

1 year ago

0.1.70

2 years ago

0.1.71

2 years ago

0.1.72

2 years ago

0.1.73

2 years ago

0.1.51

2 years ago

0.1.733

2 years ago

0.1.732

2 years ago

0.1.731

2 years ago

0.1.63

2 years ago

0.1.44

2 years ago

0.1.61

2 years ago

0.1.62

2 years ago

0.1.623

2 years ago

0.1.622

2 years ago

0.1.621

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.43

2 years ago

0.1.42

2 years ago

0.1.41

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago