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

Represents an invite to a discord guild or channel. More...

#include <invite.h>

+ Inheritance diagram for dpp::invite:
+ Collaboration diagram for dpp::invite:

Public Member Functions

 invite ()
 Constructor. More...
 
virtual ~invite ()=default
 Destructor. More...
 
inviteset_max_age (const uint32_t max_age_)
 Set the max age after which the invite expires. More...
 
inviteset_max_uses (const uint8_t max_uses_)
 Set the maximum number of uses for this invite. More...
 
inviteset_target_user_id (const snowflake user_id)
 Set the target user id. More...
 
inviteset_target_type (const invite_target_t type)
 Set the target type for this voice channel invite. More...
 
inviteset_temporary (const bool is_temporary)
 Set temporary property of this invite object. More...
 
inviteset_unique (const bool is_unique)
 Set unique property of this invite object. More...
 
invitefill_from_json (nlohmann::json *j)
 Convert object from nlohmann::json. More...
 
auto to_json (bool with_id=false) const
 Convert object to nlohmann::json. More...
 
std::string build_json (bool with_id=false) const
 Convert object to json string. More...
 

Public Attributes

std::string code
 Invite code. More...
 
time_t expires_at
 Readonly expiration timestamp of this invite or 0 if the invite doesn't expire. More...
 
snowflake guild_id
 Guild ID this invite is for. More...
 
guild destination_guild
 The partial guild this invite is for. More...
 
snowflake channel_id
 Channel ID this invite is for. More...
 
channel destination_channel
 The partial channel this invite is for. More...
 
snowflake inviter_id
 User ID who created this invite. More...
 
user inviter
 User who created this invite. More...
 
snowflake target_user_id
 The user ID whose stream to display for this voice channel stream invite. More...
 
invite_target_t target_type
 Target type for this voice channel invite. More...
 
uint32_t approximate_presence_count
 Approximate number of online users. More...
 
uint32_t approximate_member_count
 Approximate number of total users online and offline. More...
 
uint32_t max_age
 Duration (in seconds) after which the invite expires, or 0 for no expiration. Defaults to 86400 (1 day). More...
 
uint8_t max_uses
 Maximum number of uses, or 0 for unlimited. Defaults to 0. More...
 
bool temporary
 Whether this invite only grants temporary membership. More...
 
bool unique
 True if this invite should not replace or "attach to" similar invites. More...
 
uint32_t uses
 How many times this invite has been used. More...
 
stage_instance stage
 
time_t created_at
 Timestamp at which the invite was created. More...
 

Protected Member Functions

invitefill_from_json_impl (nlohmann::json *j)
 
virtual json to_json_impl (bool with_id=false) const
 

Friends

struct json_interface< invite >
 

Detailed Description

Represents an invite to a discord guild or channel.

Constructor & Destructor Documentation

◆ invite()

dpp::invite::invite ( )

Constructor.

◆ ~invite()

virtual dpp::invite::~invite ( )
virtualdefault

Destructor.

Member Function Documentation

◆ build_json()

std::string dpp::json_interface< invite >::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

◆ fill_from_json()

invite & dpp::json_interface< invite >::fill_from_json ( nlohmann::json *  j)
inlineinherited

Convert object from nlohmann::json.

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

◆ fill_from_json_impl()

invite & dpp::invite::fill_from_json_impl ( nlohmann::json *  j)
protected

Read class values from json object

Parameters
jA json object to read from
Returns
A reference to self

◆ set_max_age()

invite & dpp::invite::set_max_age ( const uint32_t  max_age_)

Set the max age after which the invite expires.

Parameters
max_age_The duration in seconds, or 0 for no expiration. Must be between 0 and 604800 (7 days)
Returns
invite& reference to self for chaining of calls

◆ set_max_uses()

invite & dpp::invite::set_max_uses ( const uint8_t  max_uses_)

Set the maximum number of uses for this invite.

Parameters
max_uses_Maximum number of uses, or 0 for unlimited. Must be between 0 and 100
Returns
invite& reference to self for chaining of calls

◆ set_target_type()

invite & dpp::invite::set_target_type ( const invite_target_t  type)

Set the target type for this voice channel invite.

Parameters
typeinvite_target_t Target type
Returns
invite& reference to self for chaining of calls

◆ set_target_user_id()

invite & dpp::invite::set_target_user_id ( const snowflake  user_id)

Set the target user id.

Parameters
user_idThe user ID whose stream to display for this voice channel stream invite
Returns
invite& reference to self for chaining of calls

◆ set_temporary()

invite & dpp::invite::set_temporary ( const bool  is_temporary)

Set temporary property of this invite object.

Parameters
is_temporaryWhether this invite only grants temporary membership
Returns
invite& reference to self for chaining of calls

◆ set_unique()

invite & dpp::invite::set_unique ( const bool  is_unique)

Set unique property of this invite object.

Parameters
is_uniqueTrue if this invite should not replace or "attach to" similar invites
Returns
invite& reference to self for chaining of calls

◆ to_json()

auto dpp::json_interface< invite >::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

◆ to_json_impl()

virtual json dpp::invite::to_json_impl ( bool  with_id = false) const
protectedvirtual

Build JSON from this object.

Parameters
with_idInclude ID in JSON
Returns
The JSON of the invite

Friends And Related Function Documentation

◆ json_interface< invite >

friend struct json_interface< invite >
friend

Member Data Documentation

◆ approximate_member_count

uint32_t dpp::invite::approximate_member_count

Approximate number of total users online and offline.

Note
Only returned from cluster::invite_get.

◆ approximate_presence_count

uint32_t dpp::invite::approximate_presence_count

Approximate number of online users.

Note
Only returned from cluster::invite_get

◆ channel_id

snowflake dpp::invite::channel_id

Channel ID this invite is for.

◆ code

std::string dpp::invite::code

Invite code.

◆ created_at

time_t dpp::invite::created_at

Timestamp at which the invite was created.

◆ destination_channel

channel dpp::invite::destination_channel

The partial channel this invite is for.

Note
Only filled in retrieved invites.

◆ destination_guild

guild dpp::invite::destination_guild

The partial guild this invite is for.

Note
Only filled in retrieved invites.

◆ expires_at

time_t dpp::invite::expires_at

Readonly expiration timestamp of this invite or 0 if the invite doesn't expire.

Note
Only returned from cluster::invite_get

◆ guild_id

snowflake dpp::invite::guild_id

Guild ID this invite is for.

◆ inviter

user dpp::invite::inviter

User who created this invite.

◆ inviter_id

snowflake dpp::invite::inviter_id

User ID who created this invite.

Deprecated:
Use the inviter field instead

◆ max_age

uint32_t dpp::invite::max_age

Duration (in seconds) after which the invite expires, or 0 for no expiration. Defaults to 86400 (1 day).

Note
Must be between 0 and 604800 (7 days).

◆ max_uses

uint8_t dpp::invite::max_uses

Maximum number of uses, or 0 for unlimited. Defaults to 0.

Note
Must be between 0 and 100.

◆ stage

stage_instance dpp::invite::stage
Note
The stage instance data if there is a public stage instance in the stage channel this invite is for.
Deprecated:
Deprecated

◆ target_type

invite_target_t dpp::invite::target_type

Target type for this voice channel invite.

◆ target_user_id

snowflake dpp::invite::target_user_id

The user ID whose stream to display for this voice channel stream invite.

◆ temporary

bool dpp::invite::temporary

Whether this invite only grants temporary membership.

◆ unique

bool dpp::invite::unique

True if this invite should not replace or "attach to" similar invites.

◆ uses

uint32_t dpp::invite::uses

How many times this invite has been used.

D++ 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