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

Represents a connection to a voice channel. 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...
 
voiceconnconnect (snowflake guild_id)
 Create websocket object and connect it. More...
 
voiceconndisconnect ()
 Disconnect from the currently connected voice channel. More...
 
bool is_active ()
 return true if the connection is active (websocket exists) More...
 
bool is_ready ()
 return true if the connection is ready to connect (has hostname, token and session id) More...
 

Public Attributes

snowflake channel_id
 Voice Channel ID. 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...
 
std::string websocket_hostname
 Websocket hostname for status. 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.

References disconnect().

Here is the call graph for this function:

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

References channel_id, dpp::discord_client::creator, is_active(), is_ready(), dpp::ll_debug, dpp::discord_client::log(), dpp::discord_voice_client::run(), dpp::unicode_emoji::thread, and voiceclient.

Here is the call graph for this function:

◆ disconnect()

voiceconn & dpp::voiceconn::disconnect ( )

Disconnect from the currently connected voice channel.

Returns
reference to self

References is_active(), and voiceclient.

Referenced by ~voiceconn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_active()

bool dpp::voiceconn::is_active ( )

return true if the connection is active (websocket exists)

Returns
true if has an active websocket

References voiceclient.

Referenced by connect(), and disconnect().

Here is the caller graph for this function:

◆ 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

References session_id, token, and websocket_hostname.

Referenced by connect().

Here is the caller graph for this function:

Member Data Documentation

◆ channel_id

snowflake dpp::voiceconn::channel_id

Voice Channel ID.

Referenced by connect().

◆ session_id

std::string dpp::voiceconn::session_id

Voice Voice session ID.

Referenced by is_ready().

◆ token

std::string dpp::voiceconn::token

Voice websocket token.

Referenced by is_ready().

◆ voiceclient

class discord_voice_client* dpp::voiceconn::voiceclient

voice websocket client

Referenced by connect(), disconnect(), and is_active().

◆ websocket_hostname

std::string dpp::voiceconn::websocket_hostname

Websocket hostname for status.

Referenced by is_ready().


The documentation for this class was generated from the following files: