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

Represents stickers received in messages. More...

+ Inheritance diagram for dpp::sticker:
+ Collaboration diagram for dpp::sticker:

Public Member Functions

 sticker ()
 Construct a new sticker object. More...
 
virtual ~sticker ()=default
 
std::string get_url () const
 Get the sticker url. More...
 
stickerset_filename (const std::string &fn)
 Set the filename. More...
 
stickerset_file_content (const std::string &fc)
 Set the file content. 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...
 
stickerfill_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 pack_id
 Optional: for standard stickers, id of the pack the sticker is from. More...
 
std::string name
 The name of the sticker. More...
 
std::string description
 Description of the sticker. More...
 
std::string tags
 The sticker's (or related) expressions. More...
 
std::string asset
 Asset ID. More...
 
sticker_type type
 The type of sticker. More...
 
sticker_format format_type
 type of sticker format. More...
 
bool available
 Optional: Whether this guild sticker can be used. More...
 
snowflake guild_id
 Optional: ID of the guild that owns this sticker. More...
 
user sticker_user
 Optional: The user that uploaded the guild sticker. More...
 
uint8_t sort_value
 Optional: The standard sticker's sort order within its pack. More...
 
std::string filename
 Name of file to upload (when adding or editing a sticker). More...
 
std::string filecontent
 File content to upload (raw binary). 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

stickerfill_from_json_impl (nlohmann::json *j)
 
virtual json to_json_impl (bool with_id=true) const
 

Friends

struct json_interface< sticker >
 

Detailed Description

Represents stickers received in messages.

Constructor & Destructor Documentation

◆ sticker()

dpp::sticker::sticker ( )

Construct a new sticker object.

◆ ~sticker()

virtual dpp::sticker::~sticker ( )
virtualdefault

Member Function Documentation

◆ build_json()

std::string dpp::json_interface< sticker >::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()

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

sticker& dpp::sticker::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

◆ 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.

◆ get_url()

std::string dpp::sticker::get_url ( ) const

Get the sticker url.

Returns
std::string The sticker url or an empty string, if the id is empty

◆ 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_file_content()

sticker& dpp::sticker::set_file_content ( const std::string &  fc)

Set the file content.

Parameters
fcraw file content contained in std::string
Returns
message& reference to self

◆ set_filename()

sticker& dpp::sticker::set_filename ( const std::string &  fn)

Set the filename.

Parameters
fnfilename
Returns
message& reference to self

◆ to_json()

auto dpp::json_interface< sticker >::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::sticker::to_json_impl ( bool  with_id = true) const
protectedvirtual

Build JSON from this object.

Parameters
with_idTrue if the ID is to be set in the JSON structure
Returns
The JSON of the invite

Friends And Related Function Documentation

◆ json_interface< sticker >

friend struct json_interface< sticker >
friend

Member Data Documentation

◆ asset

std::string dpp::sticker::asset

Asset ID.

Deprecated:
now an empty string but still sent by discord. While discord still send this empty string value, we will still have this field here in the library.

◆ available

bool dpp::sticker::available

Optional: Whether this guild sticker can be used.

Note
May be false due to loss of Server Boosts.

◆ description

std::string dpp::sticker::description

Description of the sticker.

Note
This may be empty.

◆ filecontent

std::string dpp::sticker::filecontent

File content to upload (raw binary).

◆ filename

std::string dpp::sticker::filename

Name of file to upload (when adding or editing a sticker).

◆ format_type

sticker_format dpp::sticker::format_type

type of sticker format.

◆ guild_id

snowflake dpp::sticker::guild_id

Optional: ID of the guild that owns this sticker.

◆ 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.

◆ name

std::string dpp::sticker::name

The name of the sticker.

◆ pack_id

snowflake dpp::sticker::pack_id

Optional: for standard stickers, id of the pack the sticker is from.

◆ sort_value

uint8_t dpp::sticker::sort_value

Optional: The standard sticker's sort order within its pack.

◆ sticker_user

user dpp::sticker::sticker_user

Optional: The user that uploaded the guild sticker.

◆ tags

std::string dpp::sticker::tags

The sticker's (or related) expressions.

Note
If it's a guild sticker, this will be the Discord name of a unicode emoji representing the sticker's expression. Otherwise, this will be a comma-separated list of related expressions.

◆ type

sticker_type dpp::sticker::type

The type of sticker.

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