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

Represents stickers received in messages. More...

#include "message.h"

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 build_json (bool with_id=false) const
 Convert object to json string. More...
 
stickerfill_from_json (nlohmann::json *j)
 Convert object from nlohmann::json. More...
 
constexpr double get_creation_time () const noexcept
 Get the creation time of this object according to Discord. More...
 
std::string get_url () const
 Get the sticker url. 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...
 
stickerset_file_content (const std::string &fc)
 Set the file content. More...
 
stickerset_filename (const std::string &fn)
 Set the filename. More...
 
auto to_json (bool with_id=false) const
 Convert object to nlohmann::json. More...
 

Public Attributes

std::string asset
 Asset ID. More...
 
bool available
 Optional: Whether this guild sticker can be used. More...
 
std::string description
 Description of the sticker. More...
 
std::string filecontent
 File content to upload (raw binary). More...
 
std::string filename
 Name of file to upload (when adding or editing a sticker). More...
 
sticker_format format_type
 type of sticker format. More...
 
snowflake guild_id
 Optional: ID of the guild that owns this sticker. More...
 
snowflake id = {}
 Unique ID of object set by Discord. More...
 
std::string name
 The name of the sticker. More...
 
snowflake pack_id
 Optional: for standard stickers, id of the pack the sticker is from. More...
 
uint8_t sort_value
 Optional: The standard sticker's sort order within its pack. More...
 
user sticker_user
 Optional: The user that uploaded the guild sticker. More...
 
std::string tags
 The sticker's (or related) expressions. More...
 
sticker_type type
 The type of sticker. More...
 

Protected Member Functions

stickerfill_from_json_impl (nlohmann::json *j)
 Read class values from json object. More...
 
virtual json to_json_impl (bool with_id=true) const
 Build JSON from this object. More...
 

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

References asset, description, guild_id, name, pack_id, tags, and type.

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

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.

Referenced by fill_from_json_impl().

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

Referenced by fill_from_json_impl().

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

Referenced by fill_from_json_impl().

◆ id

◆ name

std::string dpp::sticker::name

The name of the sticker.

Referenced by fill_from_json_impl().

◆ pack_id

snowflake dpp::sticker::pack_id

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

Referenced by fill_from_json_impl().

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

Referenced by dpp::message::get_url().

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

Referenced by fill_from_json_impl().

◆ type

sticker_type dpp::sticker::type

The type of sticker.

Referenced by fill_from_json_impl().


The documentation for this struct was generated from the following files: