D++ (DPP)
C++ Discord API Bot Library
dpp::voiceconn Class Reference

Represents a connection to a voice channel. A client can only connect to one voice channel per guild at a time, so these are stored in a map in the dpp::discord_client keyed by guild_id. More...

#include <discordclient.h>

+ Collaboration diagram for dpp::voiceconn:

Public Member Functions

 voiceconn ()=default
 Construct a new voiceconn object. More...
 
 voiceconn (class discord_client *o, snowflake _channel_id)
 Construct a new voiceconn object. More...
 
 ~voiceconn ()
 Destroy the voiceconn object. More...
 
bool is_ready ()
 return true if the connection is ready to connect (has hostname, token and session id) More...
 
bool is_active ()
 return true if the connection is active (websocket exists) More...
 
voiceconnconnect (snowflake guild_id)
 Create websocket object and connect it. Needs hostname, token and session_id to be set or does nothing. More...
 
voiceconndisconnect ()
 Disconnect from the currently connected voice channel. More...
 

Public Attributes

snowflake channel_id
 Voice Channel ID. More...
 
std::string websocket_hostname
 Websocket hostname for status. More...
 
std::string session_id
 Voice Voice session ID. More...
 
std::string token
 Voice websocket token. More...
 
class discord_voice_clientvoiceclient
 voice websocket client More...
 

Detailed Description

Represents a connection to a voice channel. A client can only connect to one voice channel per guild at a time, so these are stored in a map in the dpp::discord_client keyed by guild_id.

Constructor & Destructor Documentation

◆ voiceconn() [1/2]

dpp::voiceconn::voiceconn ( )
default

Construct a new voiceconn object.

◆ voiceconn() [2/2]

dpp::voiceconn::voiceconn ( class discord_client o,
snowflake  _channel_id 
)

Construct a new voiceconn object.

Parameters
oowner
_channel_idvoice channel id

◆ ~voiceconn()

dpp::voiceconn::~voiceconn ( )

Destroy the voiceconn object.

Member Function Documentation

◆ connect()

voiceconn & dpp::voiceconn::connect ( snowflake  guild_id)

Create websocket object and connect it. Needs hostname, token and session_id to be set or does nothing.

Parameters
guild_idGuild to connect to the voice channel on
Returns
reference to self
Note
It can spawn a thread to establish the connection, so this is NOT a synchronous blocking call! You shouldn't call this directly. Use a wrapper function instead. e.g. dpp::guild::connect_member_voice

◆ disconnect()

voiceconn & dpp::voiceconn::disconnect ( )

Disconnect from the currently connected voice channel.

Returns
reference to self

◆ is_active()

bool dpp::voiceconn::is_active ( )

return true if the connection is active (websocket exists)

Returns
true if has an active websocket

◆ is_ready()

bool dpp::voiceconn::is_ready ( )

return true if the connection is ready to connect (has hostname, token and session id)

Returns
true if ready to connect

Member Data Documentation

◆ channel_id

snowflake dpp::voiceconn::channel_id

Voice Channel ID.

◆ session_id

std::string dpp::voiceconn::session_id

Voice Voice session ID.

◆ token

std::string dpp::voiceconn::token

Voice websocket token.

◆ voiceclient

class discord_voice_client* dpp::voiceconn::voiceclient

voice websocket client

◆ websocket_hostname

std::string dpp::voiceconn::websocket_hostname

Websocket hostname for status.

D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0