Class

VoiceConnection

VoiceConnection()

Operates media sources and users in voice channels

Constructor

# new VoiceConnection()

View Source Revoice.js, line 10

Methods

# getUsers() → {Array.<User>}

Get all the users associated with this voice connection

View Source Revoice.js, line 39

An array containing all the User objects

Array.<User>

# isConnected(userId) → {boolean}

Check if a user is connected to this voice channel

Parameters:
Name Type Description
userId string

The id of the user

View Source Revoice.js, line 49

Wether the user is in the voice channel

boolean

# async leave() → {void}

Leave the voice channel

View Source Revoice.js, line 189

void

# async play(media) → {void}

Attach a Media object to this connection

Parameters:
Name Type Description
media Media | MediaPlayer

The media object that should be attached

View Source Revoice.js, line 135

void
Example
const connection = voice.getVoiceConnection("someChannelId");
const player = new MediaPlayer();
connection.play(player);

player.playFile("./audio.mp3");