Represents an invite to a discord guild or channel. More...
#include "invite.h"
Public Member Functions | |
invite () | |
Constructor. More... | |
virtual | ~invite ()=default |
Destructor. More... | |
std::string | build_json (bool with_id=false) const |
Convert object to json string. More... | |
invite & | fill_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
invite & | set_max_age (const uint32_t max_age_) |
Set the max age after which the invite expires. More... | |
invite & | set_max_uses (const uint8_t max_uses_) |
Set the maximum number of uses for this invite. More... | |
invite & | set_target_type (const invite_target_t type) |
Set the target type for this voice channel invite. More... | |
invite & | set_target_user_id (const snowflake user_id) |
Set the target user id. More... | |
invite & | set_temporary (const bool is_temporary) |
Set temporary property of this invite object. More... | |
invite & | set_unique (const bool is_unique) |
Set unique property of this invite object. More... | |
auto | to_json (bool with_id=false) const |
Convert object to nlohmann::json. More... | |
Public Attributes | |
uint32_t | approximate_member_count |
Approximate number of total users online and offline. More... | |
uint32_t | approximate_presence_count |
Approximate number of online users. More... | |
snowflake | channel_id |
Channel ID this invite is for. More... | |
std::string | code |
Invite code. More... | |
time_t | created_at |
Timestamp at which the invite was created. More... | |
channel | destination_channel |
The partial channel this invite is for. More... | |
guild | destination_guild |
The partial guild this invite is for. 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... | |
user | inviter |
User who created this invite. More... | |
snowflake | inviter_id |
User ID who created this invite. More... | |
uint32_t | max_age |
Duration (in seconds) after which the invite expires, or 0 for no expiration. More... | |
uint8_t | max_uses |
Maximum number of uses, or 0 for unlimited. More... | |
stage_instance | stage |
invite_target_t | target_type |
Target type for this voice channel invite. More... | |
snowflake | target_user_id |
The user ID whose stream to display for this voice channel stream invite. 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... | |
Protected Member Functions | |
invite & | fill_from_json_impl (nlohmann::json *j) |
Read class values from json object. More... | |
virtual json | to_json_impl (bool with_id=false) const |
Build JSON from this object. More... | |
Friends | |
struct | json_interface< invite > |
Represents an invite to a discord guild or channel.
dpp::invite::invite | ( | ) |
Constructor.
|
virtualdefault |
Destructor.
|
inlineinherited |
Convert object to json string.
with_id | Whether to include the ID or not |
|
inlineinherited |
Convert object from nlohmann::json.
j | nlohmann::json object |
|
protected |
Read class values from json object.
j | A json object to read from |
References approximate_member_count, approximate_presence_count, dpp::bool_not_null(), channel_id, code, created_at, destination_channel, destination_guild, expires_at, dpp::json_interface< T >::fill_from_json(), dpp::guild::fill_from_json(), guild_id, dpp::managed::id, dpp::int32_not_null(), dpp::int8_not_null(), inviter, inviter_id, max_age, max_uses, dpp::snowflake_not_null(), stage, dpp::string_not_null(), target_type, target_user_id, temporary, dpp::ts_not_null(), unique, and uses.
invite & dpp::invite::set_max_age | ( | const uint32_t | max_age_ | ) |
Set the max age after which the invite expires.
max_age_ | The duration in seconds, or 0 for no expiration. Must be between 0 and 604800 (7 days) |
References max_age.
invite & dpp::invite::set_max_uses | ( | const uint8_t | max_uses_ | ) |
Set the maximum number of uses for this invite.
max_uses_ | Maximum number of uses, or 0 for unlimited. Must be between 0 and 100 |
References max_uses.
invite & dpp::invite::set_target_type | ( | const invite_target_t | type | ) |
Set the target type for this voice channel invite.
type | invite_target_t Target type |
References target_type.
Set the target user id.
user_id | The user ID whose stream to display for this voice channel stream invite |
References target_user_id.
invite & dpp::invite::set_temporary | ( | const bool | is_temporary | ) |
Set temporary property of this invite object.
is_temporary | Whether this invite only grants temporary membership |
References temporary.
invite & dpp::invite::set_unique | ( | const bool | is_unique | ) |
Set unique property of this invite object.
is_unique | True if this invite should not replace or "attach to" similar invites |
References unique.
|
inlineinherited |
Convert object to nlohmann::json.
with_id | Whether to include the ID or not |
|
protectedvirtual |
Build JSON from this object.
with_id | Include ID in JSON |
References dpp::itt_none, max_age, max_uses, target_type, target_user_id, temporary, and unique.
|
friend |
uint32_t dpp::invite::approximate_member_count |
Approximate number of total users online and offline.
Referenced by fill_from_json_impl().
uint32_t dpp::invite::approximate_presence_count |
Approximate number of online users.
Referenced by fill_from_json_impl().
snowflake dpp::invite::channel_id |
Channel ID this invite is for.
Referenced by fill_from_json_impl().
std::string dpp::invite::code |
Invite code.
Referenced by fill_from_json_impl().
time_t dpp::invite::created_at |
Timestamp at which the invite was created.
Referenced by fill_from_json_impl().
channel dpp::invite::destination_channel |
The partial channel this invite is for.
Referenced by fill_from_json_impl().
guild dpp::invite::destination_guild |
The partial guild this invite is for.
Referenced by fill_from_json_impl().
time_t dpp::invite::expires_at |
Readonly expiration timestamp of this invite or 0 if the invite doesn't expire.
Referenced by fill_from_json_impl().
snowflake dpp::invite::guild_id |
Guild ID this invite is for.
Referenced by fill_from_json_impl().
user dpp::invite::inviter |
User who created this invite.
Referenced by fill_from_json_impl().
snowflake dpp::invite::inviter_id |
User ID who created this invite.
inviter
field instead Referenced by fill_from_json_impl().
uint32_t dpp::invite::max_age |
Duration (in seconds) after which the invite expires, or 0 for no expiration.
Defaults to 86400 (1 day).
Referenced by fill_from_json_impl(), set_max_age(), and to_json_impl().
uint8_t dpp::invite::max_uses |
Maximum number of uses, or 0 for unlimited.
Defaults to 0.
Referenced by fill_from_json_impl(), set_max_uses(), and to_json_impl().
stage_instance dpp::invite::stage |
Referenced by fill_from_json_impl().
invite_target_t dpp::invite::target_type |
Target type for this voice channel invite.
Referenced by fill_from_json_impl(), set_target_type(), and to_json_impl().
snowflake dpp::invite::target_user_id |
The user ID whose stream to display for this voice channel stream invite.
Referenced by fill_from_json_impl(), set_target_user_id(), and to_json_impl().
bool dpp::invite::temporary |
Whether this invite only grants temporary membership.
Referenced by fill_from_json_impl(), set_temporary(), and to_json_impl().
bool dpp::invite::unique |
True if this invite should not replace or "attach to" similar invites.
Referenced by fill_from_json_impl(), set_unique(), and to_json_impl().
uint32_t dpp::invite::uses |
How many times this invite has been used.
Referenced by fill_from_json_impl().