# 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 |
Extends
- EventEmitter
Methods
# getUser(id) → {UserData}
Retrieve the user object
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
The id of the user |
An object containing the Revoice user object and the voice connection, the user is in.
# getVoiceConnection(channelId) → {VoiceConnection}
Retrieve the VoiceConnection object for a specified voice channel
Parameters:
Name | Type | Description |
---|---|---|
channelId |
string
|
The id of the voice channel |
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 |
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");
});