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

Represents user presence, e.g. what game they are playing and if they are online. More...

#include <presence.h>

+ Collaboration diagram for dpp::presence:

Public Member Functions

 presence ()
 
 presence (presence_status status, activity_type type, const std::string &activity_description)
 Construct a new presence object with some parameters for sending to a websocket. More...
 
 presence (presence_status status, const activity &a)
 Construct a new presence object with some parameters for sending to a websocket. More...
 
 ~presence ()
 
presencefill_from_json (nlohmann::json *j)
 
std::string build_json () const
 
presence_status desktop_status () const
 
presence_status web_status () const
 
presence_status mobile_status () const
 
presence_status status () const
 

Public Attributes

snowflake user_id
 
snowflake guild_id
 
uint8_t flags
 
std::vector< activityactivities
 

Detailed Description

Represents user presence, e.g. what game they are playing and if they are online.

Constructor & Destructor Documentation

◆ presence() [1/3]

dpp::presence::presence ( )

Constructor

◆ presence() [2/3]

dpp::presence::presence ( presence_status  status,
activity_type  type,
const std::string &  activity_description 
)

Construct a new presence object with some parameters for sending to a websocket.

Parameters
statusStatus of the activity
typeType of activity
activity_descriptionDescription of the activity

◆ presence() [3/3]

dpp::presence::presence ( presence_status  status,
const activity a 
)

Construct a new presence object with some parameters for sending to a websocket.

Parameters
statusStatus of the activity
aActivity itself

◆ ~presence()

dpp::presence::~presence ( )

Destructor

Member Function Documentation

◆ build_json()

std::string dpp::presence::build_json ( ) const

Build JSON from this object.

Note: This excludes any part of the presence object that are not valid for websockets and bots, and includes websocket opcode 3. You will not get what you expect if you call this on a user's presence received from on_presence_update or on_guild_create!

Returns
The JSON text of the presence

◆ desktop_status()

presence_status dpp::presence::desktop_status ( ) const

The users status on desktop

Returns
The user's status on desktop

◆ fill_from_json()

presence & dpp::presence::fill_from_json ( nlohmann::json j)

Fill this object from json.

Parameters
jJSON object to fill from
Returns
A reference to self

◆ mobile_status()

presence_status dpp::presence::mobile_status ( ) const

The user's status on mobile

Returns
The user's status on mobile

◆ status()

presence_status dpp::presence::status ( ) const

The user's status as shown to other users

Returns
The user's status as shown to other users

◆ web_status()

presence_status dpp::presence::web_status ( ) const

The user's status on web

Returns
The user's status on web

Member Data Documentation

◆ activities

std::vector<activity> dpp::presence::activities

List of activities

◆ flags

uint8_t dpp::presence::flags

Flags bitmask containing dpp::presence_flags

◆ guild_id

snowflake dpp::presence::guild_id

Guild ID. Apparently, Discord supports this internally but the client doesn't...

◆ user_id

snowflake dpp::presence::user_id

The user the presence applies to

D++ Library version 10.0.35D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ 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