| D++ (DPP) C++ Discord API Bot Library

Search
Loading...
Searching...
No Matches
dpp::invite Class Reference

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

`#include <invite.h>`

Inheritance diagram for dpp::invite:
[legend]
Collaboration diagram for dpp::invite:
[legend]

## Public Member Functions

| invite ()
| Constructor.
virtual | ~invite ()=default
| Destructor.
std::string | build_json (bool with_id=false) const
| Convert object to json string.
invite & | fill_from_json (nlohmann::json *j)
| Convert object from nlohmann::json.
invite & | set_max_age (const uint32_t max_age_)
| Set the max age after which the invite expires.
invite & | set_max_uses (const uint8_t max_uses_)
| Set the maximum number of uses for this invite.
invite & | set_target_type (const invite_target_t type)
| Set the target type for this voice channel invite.
invite & | set_target_user_id (const snowflake user_id)
| Set the target user id.
invite & | set_temporary (const bool is_temporary)
| Set temporary property of this invite object.
invite & | set_unique (const bool is_unique)
| Set unique property of this invite object.
auto | to_json (bool with_id=false) const
| Convert object to nlohmann::json.

## Public Attributes

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

## Protected Member Functions

invite & | fill_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 | ( |  | ) |

virtual default

Destructor.

## Member Function Documentation

## ◆ build_json()

std::string dpp::json_interface< invite >::build_json | ( | bool | with_id = false | ) | const

inline inherited

Convert object to json string.

Parameters

  with_id | Whether 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 | ) |

inline inherited

Convert object from nlohmann::json.

Parameters

  j | nlohmann::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

  j | A 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

  type | invite_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_id | The 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_temporary | Whether 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_unique | True 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

inline inherited

Convert object to nlohmann::json.

Parameters

  with_id | Whether 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

protected virtual

Build JSON from this object.

Parameters

  with_id | Include ID in JSON

Returns
  The JSON of the invite

## Friends And Related Symbol 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 9.0.13 D++ Library version 9.0.12 D++ Library version 9.0.11 D++ Library version 9.0.10 D++ Library version 9.0.9 D++ Library version 9.0.8 D++ Library version 9.0.7 D++ Library version 9.0.6 D++ Library version 9.0.5 D++ Library version 9.0.4 D++ Library version 9.0.3 D++ Library version 9.0.2 D++ Library version 9.0.1 D++ Library version 9.0.0 D++ Library version 1.0.2 D++ Library version 1.0.1 D++ Library version 1.0.0