| D++ (DPP) C++ Discord API Bot Library

Search
Loading...
Searching...
No Matches
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>`

Inheritance diagram for dpp::voiceconn:
[legend]
Collaboration diagram for dpp::voiceconn:
[legend]

## Public Member Functions

| voiceconn (class discord_client *o, voice_connection_gateway_request_callback_t request_callback, snowflake guild_id, snowflake channel_id, bool enable_dave)
| Construct a new voiceconn object.
| ~voiceconn ()
| Destroy the voiceconn object.
voiceconn & | connect ()
| Create websocket object and connect it. Needs hostname, token and session_id to be set or does nothing.
voiceconn & | disconnect ()
| Disconnect from the currently connected voice channel.
bool | is_active () const
| return true if the connection is active (websocket exists)
bool | is_ready () const
| return true if the connection is ready to connect (has hostname, token and session id)
void | reassign_owner (class discord_client *o)
| Reassigns the owner to the given discord_client.
voiceconn & | request ()

## Public Attributes

snowflake | channel_id
| Voice Channel ID.
bool | dave
| True to enable DAVE E2EE.
snowflake | guild_id
| Guild to connect to the voice channel on.
std::string | session_id
| Voice Voice session ID.
std::string | token
| Voice websocket token.
std::unique_ptr< class discord_voice_client > | voiceclient
| voice websocket client
std::string | websocket_hostname
| Websocket hostname for status.

## 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()

dpp::voiceconn::voiceconn | ( | class discord_client * | o,
|  | voice_connection_gateway_request_callback_t | request_callback,
|  | snowflake | guild_id,
|  | snowflake | channel_id,
|  | bool | enable_dave )

Construct a new voiceconn object.

Parameters

  o | owner
  request_callback | Function to ask a discord_client instance to make a request to Gateway to connect to a voice channel
  guild_id | Guild to connect to the voice channel on
  channel_id | voice channel id
  enable_dave | True to enable DAVE E2EE

## ◆ ~voiceconn()

dpp::voiceconn::~voiceconn | ( |  | ) |

Destroy the voiceconn object.

## Member Function Documentation

## ◆ connect()

voiceconn & dpp::voiceconn::connect | ( |  | ) |

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

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 | ( |  | ) | const

return true if the connection is active (websocket exists)

Returns
  true if has an active websocket

## ◆ is_ready()

bool dpp::voiceconn::is_ready | ( |  | ) | const

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

Returns
  true if ready to connect

## ◆ reassign_owner()

void dpp::voiceconn::reassign_owner | ( | class discord_client * | o | ) |

Reassigns the owner to the given discord_client.

## ◆ request()

voiceconn & dpp::voiceconn::request | ( |  | ) |

## Member Data Documentation

## ◆ channel_id

snowflake dpp::voiceconn::channel_id

Voice Channel ID.

## ◆ dave

bool dpp::voiceconn::dave

True to enable DAVE E2EE.

Warning
  This is an EXPERIMENTAL feature!

## ◆ guild_id

snowflake dpp::voiceconn::guild_id

Guild to connect to the voice channel on.

## ◆ session_id

std::string dpp::voiceconn::session_id

Voice Voice session ID.

## ◆ token

std::string dpp::voiceconn::token

Voice websocket token.

## ◆ voiceclient

std::unique_ptr<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 9.0.13 D++ Library version 9.0.12 D++ Library version 9.0.11 D++ Library version 9.0.10 D++ Library version 9.0.9 D++ Library version 9.0.8 D++ Library version 9.0.7 D++ Library version 9.0.6 D++ Library version 9.0.5 D++ Library version 9.0.4 D++ Library version 9.0.3 D++ Library version 9.0.2 D++ Library version 9.0.1 D++ Library version 9.0.0 D++ Library version 1.0.2 D++ Library version 1.0.1 D++ Library version 1.0.0