D++ (DPP)
C++ Discord API Bot Library
|
Represents user presence, e.g. what game they are playing and if they are online. More...
#include <presence.h>
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 () | |
presence & | fill_from_json (nlohmann::json *j) |
virtual std::string | build_json (bool with_id=false) const |
presence_status | desktop_status () const |
presence_status | web_status () const |
presence_status | mobile_status () const |
presence_status | status () const |
presence & | parse_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
Public Attributes | |
snowflake | user_id |
snowflake | guild_id |
uint8_t | flags |
std::vector< activity > | activities |
Represents user presence, e.g. what game they are playing and if they are online.
dpp::presence::presence | ( | ) |
Constructor
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.
status | Status of the activity |
type | Type of activity |
activity_description | Description of the activity |
dpp::presence::presence | ( | presence_status | status, |
const activity & | a | ||
) |
Construct a new presence object with some parameters for sending to a websocket.
status | Status of the activity |
a | Activity itself |
dpp::presence::~presence | ( | ) |
Destructor
|
virtual |
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!
with_id | Add ID to output |
Reimplemented from dpp::json_interface< presence >.
presence_status dpp::presence::desktop_status | ( | ) | const |
The users status on desktop
presence & dpp::presence::fill_from_json | ( | nlohmann::json * | j | ) |
Fill this object from json.
j | JSON object to fill from |
presence_status dpp::presence::mobile_status | ( | ) | const |
The user's status on mobile
|
inlineinherited |
Convert object from nlohmann::json.
j | nlohmann::json object |
presence_status dpp::presence::status | ( | ) | const |
The user's status as shown to other users
presence_status dpp::presence::web_status | ( | ) | const |
The user's status on web
std::vector<activity> dpp::presence::activities |
List of activities
uint8_t dpp::presence::flags |
Flags bitmask containing dpp::presence_flags
snowflake dpp::presence::guild_id |
Guild ID. Apparently, Discord supports this internally but the client doesn't...
snowflake dpp::presence::user_id |
The user the presence applies to