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

Represents the voice state of a user on a guild These are stored in the dpp::guild object, and accessible there, or via dpp::channel::get_voice_members. More...

#include "voicestate.h"

Inheritance diagram for dpp::voicestate:
Collaboration diagram for dpp::voicestate:

Public Member Functions

 voicestate ()
 Construct a new voicestate object. More...
 
virtual ~voicestate ()=default
 Destroy the voicestate object. More...
 
template<typename U = T, typename = decltype(std::declval<U&>().to_json_impl(bool{}))>
std::string build_json (bool with_id=false) const
 Convert object to json string. More...
 
template<typename U = T, typename = decltype(std::declval<U&>().fill_from_json_impl(std::declval<nlohmann::json*>()))>
T & fill_from_json (nlohmann::json *j)
 Convert object from nlohmann::json. More...
 
bool is_deaf () const
 Return true if the user is deafened by the server. More...
 
bool is_mute () const
 Return true if the user is muted by the server. More...
 
bool is_self_deaf () const
 Return true if user deafened themselves. More...
 
bool is_self_mute () const
 Return true if user muted themselves. More...
 
bool is_suppressed () const
 Return true if user is suppressed. More...
 
bool self_stream () const
 Return true if the user is streaming using "Go Live". More...
 
bool self_video () const
 Return true if the user's camera is enabled. More...
 
template<typename U = T, typename = decltype(std::declval<U&>().to_json_impl(bool{}))>
auto to_json (bool with_id=false) const
 Convert object to nlohmann::json. More...
 

Public Attributes

snowflake channel_id {0}
 The channel id this user is connected to. More...
 
uint8_t flags {0}
 Voice state flags from dpp::voicestate_flags. More...
 
snowflake guild_id {0}
 Optional: The guild id this voice state is for. More...
 
time_t request_to_speak {0}
 The time at which the user requested to speak. More...
 
std::string session_id
 The session id for this voice state. More...
 
class discord_clientshard
 Owning shard. More...
 
snowflake user_id {0}
 The user id this voice state is for. More...
 

Protected Member Functions

voicestatefill_from_json_impl (nlohmann::json *j)
 Fill voicestate object from json data. More...
 

Friends

struct json_interface< voicestate >
 

Detailed Description

Represents the voice state of a user on a guild These are stored in the dpp::guild object, and accessible there, or via dpp::channel::get_voice_members.

Constructor & Destructor Documentation

◆ voicestate()

dpp::voicestate::voicestate ( )

Construct a new voicestate object.

References flags, and dpp::vs_self_deaf.

◆ ~voicestate()

virtual dpp::voicestate::~voicestate ( )
virtualdefault

Destroy the voicestate object.

Member Function Documentation

◆ build_json()

template<typename T >
template<typename U = T, typename = decltype(std::declval<U&>().to_json_impl(bool{}))>
std::string dpp::json_interface< T >::build_json ( bool  with_id = false) const
inlineinherited

Convert object to json string.

Parameters
with_idWhether to include the ID or not
Note
Some fields are conditionally filled, do not rely on all fields being present
Returns
std::string Json built from the structure

Referenced by dpp::cluster::create_webhook(), dpp::cluster::guild_ban_add(), dpp::cluster::guild_ban_delete(), dpp::cluster::guild_command_edit_permissions(), dpp::cluster::guild_create(), dpp::cluster::guild_get_integrations(), dpp::cluster::guild_get_preview(), dpp::cluster::guild_get_vanity(), and dpp::cluster::roles_get().

Here is the caller graph for this function:

◆ fill_from_json()

template<typename T >
template<typename U = T, typename = decltype(std::declval<U&>().fill_from_json_impl(std::declval<nlohmann::json*>()))>
T& dpp::json_interface< T >::fill_from_json ( nlohmann::json j)
inlineinherited

Convert object from nlohmann::json.

Parameters
jnlohmann::json object
Returns
T& Reference to self for fluent calling

Referenced by dpp::invite::fill_from_json_impl(), dpp::thread::fill_from_json_impl(), dpp::scheduled_event::fill_from_json_impl(), dpp::from_json(), dpp::message::get_url(), and dpp::interaction_response::interaction_response().

Here is the caller graph for this function:

◆ fill_from_json_impl()

voicestate & dpp::voicestate::fill_from_json_impl ( nlohmann::json j)
protected

Fill voicestate object from json data.

Parameters
jJSON data to fill from
Returns
voicestate& Reference to self

◆ is_deaf()

bool dpp::voicestate::is_deaf ( ) const

Return true if the user is deafened by the server.

References flags, and dpp::vs_self_video.

◆ is_mute()

bool dpp::voicestate::is_mute ( ) const

Return true if the user is muted by the server.

References flags, and dpp::vs_suppress.

◆ is_self_deaf()

bool dpp::voicestate::is_self_deaf ( ) const

Return true if user deafened themselves.

◆ is_self_mute()

bool dpp::voicestate::is_self_mute ( ) const

Return true if user muted themselves.

◆ is_suppressed()

bool dpp::voicestate::is_suppressed ( ) const

Return true if user is suppressed.

"HELP HELP I'M BEING SUPPRESSED!"

◆ self_stream()

bool dpp::voicestate::self_stream ( ) const

Return true if the user is streaming using "Go Live".

◆ self_video()

bool dpp::voicestate::self_video ( ) const

Return true if the user's camera is enabled.

◆ to_json()

template<typename T >
template<typename U = T, typename = decltype(std::declval<U&>().to_json_impl(bool{}))>
auto dpp::json_interface< T >::to_json ( bool  with_id = false) const
inlineinherited

Convert object to nlohmann::json.

Parameters
with_idWhether to include the ID or not
Note
Some fields are conditionally filled, do not rely on all fields being present
Returns
json Json built from the structure

Referenced by dpp::cluster::delete_webhook_with_token(), and dpp::onboarding_prompt::onboarding_prompt().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ json_interface< voicestate >

friend struct json_interface< voicestate >
friend

Member Data Documentation

◆ channel_id

snowflake dpp::voicestate::channel_id {0}

The channel id this user is connected to.

Note
This may be empty.

◆ flags

uint8_t dpp::voicestate::flags {0}

Voice state flags from dpp::voicestate_flags.

Referenced by is_deaf(), is_mute(), and voicestate().

◆ guild_id

snowflake dpp::voicestate::guild_id {0}

Optional: The guild id this voice state is for.

◆ request_to_speak

time_t dpp::voicestate::request_to_speak {0}

The time at which the user requested to speak.

Note
If the user never requested to speak, this is 0.

◆ session_id

std::string dpp::voicestate::session_id

The session id for this voice state.

◆ shard

class discord_client* dpp::voicestate::shard

Owning shard.

◆ user_id

snowflake dpp::voicestate::user_id {0}

The user id this voice state is for.


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