D++ (DPP)
C++ Discord API Bot Library
dpp::scheduled_event Struct Reference

A scheduled event. More...

#include <scheduled_event.h>

+ Inheritance diagram for dpp::scheduled_event:
+ Collaboration diagram for dpp::scheduled_event:

Public Member Functions

 scheduled_event ()
 Create a scheduled_event object. More...
 
scheduled_eventset_name (const std::string &n)
 Set the name of the event. Minimum length: 1, Maximum length: 100. More...
 
scheduled_eventset_description (const std::string &d)
 Set the description of the event. Minimum length: 1 (if set), Maximum length: 100. More...
 
scheduled_eventclear_description ()
 Clear the description of the event. More...
 
scheduled_eventset_location (const std::string &l)
 Set the location of the event. Minimum length: 1, Maximum length: 1000. More...
 
scheduled_eventset_channel_id (snowflake c)
 Set the voice channel id of the event. More...
 
scheduled_eventset_creator_id (snowflake c)
 Set the creator id of the event. More...
 
scheduled_eventset_status (event_status s)
 Set the status of the event. More...
 
scheduled_eventset_start_time (time_t t)
 Set the start time of the event. More...
 
scheduled_eventset_end_time (time_t t)
 Set the end time of the event. More...
 
scheduled_eventload_image (std::string_view image_blob, const image_type type)
 Load an image for the event cover. More...
 
scheduled_eventload_image (const std::byte *data, uint32_t size, const image_type type)
 Load an image for the event cover. More...
 
constexpr double get_creation_time () const noexcept
 Get the creation time of this object according to Discord. More...
 
constexpr bool operator== (const managed &other) const noexcept
 Comparison operator for comparing two managed objects by id. More...
 
constexpr bool operator!= (const managed &other) const noexcept
 Comparison operator for comparing two managed objects by id. More...
 
scheduled_eventfill_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

snowflake guild_id
 The guild ID which the scheduled event belongs to. More...
 
snowflake channel_id
 The channel ID in which the scheduled event will be hosted, or null if scheduled entity type is EXTERNAL. More...
 
snowflake creator_id
 Optional: The ID of the user that created the scheduled event. More...
 
std::string name
 The name of the scheduled event. More...
 
std::string description
 Optional: The description of the scheduled event (1-1000 characters). More...
 
utility::icon image
 The image of the scheduled event. More...
 
time_t scheduled_start_time
 The time the scheduled event will start. More...
 
time_t scheduled_end_time
 The time the scheduled event will end, or null if the event does not have a scheduled time to end. More...
 
event_privacy_level privacy_level
 The privacy level of the scheduled event. More...
 
event_status status
 The status of the scheduled event. More...
 
event_entity_type entity_type
 The type of hosting entity associated with a scheduled event. e.g. voice channel or stage channel. More...
 
snowflake entity_id
 Any additional ID of the hosting entity associated with event. e.g. stage instance ID. More...
 
event_entities entity_metadata
 The entity metadata for the scheduled event. More...
 
user creator
 Optional: The creator of the scheduled event. More...
 
uint32_t user_count
 Optional: The number of users subscribed to the scheduled event. More...
 
snowflake id = {}
 Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relevant to us as useful metadata. More...
 

Protected Member Functions

scheduled_eventfill_from_json_impl (const nlohmann::json *j)
 Serialise a scheduled_event object from json. More...
 
json to_json_impl (bool with_id=false) const
 Build json for this object. More...
 

Friends

struct json_interface< scheduled_event >
 

Detailed Description

A scheduled event.

Constructor & Destructor Documentation

◆ scheduled_event()

dpp::scheduled_event::scheduled_event ( )

Create a scheduled_event object.

Member Function Documentation

◆ build_json()

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

◆ clear_description()

scheduled_event & dpp::scheduled_event::clear_description ( )

Clear the description of the event.

Returns
scheduled_event& reference to self

◆ fill_from_json()

scheduled_event & dpp::json_interface< scheduled_event >::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()

scheduled_event & dpp::scheduled_event::fill_from_json_impl ( const nlohmann::json *  j)
protected

Serialise a scheduled_event object from json.

Returns
scheduled_event& a reference to self

◆ get_creation_time()

constexpr double dpp::managed::get_creation_time ( ) const
inlineconstexprnoexceptinherited

Get the creation time of this object according to Discord.

Returns
double creation time inferred from the snowflake ID. The minimum possible value is the first second of 2015.

◆ load_image() [1/2]

scheduled_event & dpp::scheduled_event::load_image ( const std::byte *  data,
uint32_t  size,
const image_type  type 
)

Load an image for the event cover.

Parameters
dataImage binary data
sizeSize of the image.
typeType of image. It can be one of i_gif, i_jpg or i_png.
Returns
emoji& Reference to self

◆ load_image() [2/2]

scheduled_event & dpp::scheduled_event::load_image ( std::string_view  image_blob,
const image_type  type 
)

Load an image for the event cover.

Parameters
image_blobImage binary data
typeType of image. It can be one of i_gif, i_jpg or i_png.
Returns
emoji& Reference to self

◆ operator!=()

constexpr bool dpp::managed::operator!= ( const managed other) const
inlineconstexprnoexceptinherited

Comparison operator for comparing two managed objects by id.

Parameters
otherOther object to compare against
Returns
true objects are not the same id
false objects are the same id

◆ operator==()

constexpr bool dpp::managed::operator== ( const managed other) const
inlineconstexprnoexceptinherited

Comparison operator for comparing two managed objects by id.

Parameters
otherOther object to compare against
Returns
true objects are the same id
false objects are not the same id

◆ set_channel_id()

scheduled_event & dpp::scheduled_event::set_channel_id ( snowflake  c)

Set the voice channel id of the event.

Note
clears location
Parameters
cchannel ID
Returns
scheduled_event& reference to self

◆ set_creator_id()

scheduled_event & dpp::scheduled_event::set_creator_id ( snowflake  c)

Set the creator id of the event.

Parameters
ccreator user ID
Returns
scheduled_event& reference to self

◆ set_description()

scheduled_event & dpp::scheduled_event::set_description ( const std::string &  d)

Set the description of the event. Minimum length: 1 (if set), Maximum length: 100.

Parameters
devent description
Returns
scheduled_event& reference to self
Exceptions
dpp::length_errorif length < 1

◆ set_end_time()

scheduled_event & dpp::scheduled_event::set_end_time ( time_t  t)

Set the end time of the event.

Parameters
tending time
Returns
scheduled_event& reference to self
Exceptions
dpp::length_errorif time is before now

◆ set_location()

scheduled_event & dpp::scheduled_event::set_location ( const std::string &  l)

Set the location of the event. Minimum length: 1, Maximum length: 1000.

Note
Clears channel_id
Parameters
levent location
Returns
scheduled_event& reference to self
Exceptions
dpp::length_errorif length < 1

◆ set_name()

scheduled_event & dpp::scheduled_event::set_name ( const std::string &  n)

Set the name of the event. Minimum length: 1, Maximum length: 100.

Parameters
nevent name
Returns
scheduled_event& reference to self
Exceptions
dpp::length_errorif length < 1

◆ set_start_time()

scheduled_event & dpp::scheduled_event::set_start_time ( time_t  t)

Set the start time of the event.

Parameters
tstarting time
Returns
scheduled_event& reference to self
Exceptions
dpp::length_errorif time is before now

◆ set_status()

scheduled_event & dpp::scheduled_event::set_status ( event_status  s)

Set the status of the event.

Parameters
sstatus to set
Returns
scheduled_event& reference to self
Exceptions
dpp::logic_exceptionif status change is not valid

◆ to_json()

auto dpp::json_interface< scheduled_event >::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()

json dpp::scheduled_event::to_json_impl ( bool  with_id = false) const
protected

Build json for this object.

Parameters
with_idInclude id field in json
Returns
std::string Json of this object

Friends And Related Function Documentation

◆ json_interface< scheduled_event >

friend struct json_interface< scheduled_event >
friend

Member Data Documentation

◆ channel_id

snowflake dpp::scheduled_event::channel_id

The channel ID in which the scheduled event will be hosted, or null if scheduled entity type is EXTERNAL.

Note
This may be empty.

◆ creator

user dpp::scheduled_event::creator

Optional: The creator of the scheduled event.

◆ creator_id

snowflake dpp::scheduled_event::creator_id

Optional: The ID of the user that created the scheduled event.

◆ description

std::string dpp::scheduled_event::description

Optional: The description of the scheduled event (1-1000 characters).

◆ entity_id

snowflake dpp::scheduled_event::entity_id

Any additional ID of the hosting entity associated with event. e.g. stage instance ID.

Note
This may be empty.

◆ entity_metadata

event_entities dpp::scheduled_event::entity_metadata

The entity metadata for the scheduled event.

Note
This may be empty.

◆ entity_type

event_entity_type dpp::scheduled_event::entity_type

The type of hosting entity associated with a scheduled event. e.g. voice channel or stage channel.

◆ guild_id

snowflake dpp::scheduled_event::guild_id

The guild ID which the scheduled event belongs to.

◆ id

snowflake dpp::managed::id = {}
inherited

Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relevant to us as useful metadata.

◆ image

utility::icon dpp::scheduled_event::image

The image of the scheduled event.

Note
This may be empty.

◆ name

std::string dpp::scheduled_event::name

The name of the scheduled event.

◆ privacy_level

event_privacy_level dpp::scheduled_event::privacy_level

The privacy level of the scheduled event.

◆ scheduled_end_time

time_t dpp::scheduled_event::scheduled_end_time

The time the scheduled event will end, or null if the event does not have a scheduled time to end.

Note
This may be empty.

◆ scheduled_start_time

time_t dpp::scheduled_event::scheduled_start_time

The time the scheduled event will start.

◆ status

event_status dpp::scheduled_event::status

The status of the scheduled event.

◆ user_count

uint32_t dpp::scheduled_event::user_count

Optional: The number of users subscribed to the scheduled event.

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