Class

Revoice

Revoice(loginData, apiConfigopt) → {Revoice}

The main class used to join channels and initiate voice connections

Constructor

# new Revoice(loginData, apiConfigopt) → {Revoice}

Initiate a new Revoice instance

Parameters:
Name Type Attributes Default Description
loginData Login | string

The way to login. If you're using a bot use your token, otherwise specify an email and password.

apiConfig APIConfig <optional>
{}

A configuration object for revolt-api. @see https://github.com/insertish/oapi#example The last example for further information

View Source Revoice.js, line 215

Revoice

Extends

  • EventEmitter

Methods

# getUser(id) → {UserData}

Retrieve the user object

Parameters:
Name Type Description
id string

The id of the user

View Source Revoice.js, line 313

An object containing the Revoice user object and the voice connection, the user is in.

UserData

# getVoiceConnection(channelId) → {VoiceConnection}

Retrieve the VoiceConnection object for a specified voice channel

Parameters:
Name Type Description
channelId string

The id of the voice channel

View Source Revoice.js, line 380

The voice connection object

# join(channelId, leaveIfEmpty) → {Promise.<VoiceConnection>}

Join a specified channel

Parameters:
Name Type Default Description
channelId string

The id of the voice channel you want the bot to join

leaveIfEmpty false | number false

Specifies the amount of time in sconds, after which the bot leaves an empty voice channel. If this is set to false, the bot will stay unless told to leave

View Source Revoice.js, line 338

A promise containing the resulting VoiceConnection for this channel.

Promise.<VoiceConnection>
Example
voice.join("channel", 60).then(connection => { // leave after 60 seconds of inactivity
  const player = new MediaPlayer();
  connection.play(player);
  player.playFile("audio.mp3");
});