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

Search
Loading...
Searching...
No Matches
dpp::sticker Struct Reference

Represents stickers received in messages. More...

`#include <message.h>`

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

## Public Member Functions

| sticker ()
| Construct a new sticker object.
virtual | ~sticker ()=default
std::string | build_json (bool with_id=false) const
| Convert object to json string.
sticker & | fill_from_json (nlohmann::json *j)
| Convert object from nlohmann::json.
constexpr double | get_creation_time () const noexcept
| Get the creation time of this object according to Discord.
std::string | get_url () const
| Get the sticker url.
constexpr bool | operator!= (const managed &other) const noexcept
| Comparison operator for comparing two managed objects by id.
constexpr bool | operator== (const managed &other) const noexcept
| Comparison operator for comparing two managed objects by id.
sticker & | set_file_content (std::string_view fc)
| Set the file content.
sticker & | set_filename (std::string_view fn)
| Set the filename.
auto | to_json (bool with_id=false) const
| Convert object to nlohmann::json.

## Public Attributes

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

## Protected Member Functions

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

virtual default

## Member Function Documentation

## ◆ build_json()

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

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

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

## ◆ get_creation_time()

double dpp::managed::get_creation_time | ( |  | ) | const

inline constexpr noexcept inherited

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!=()

bool dpp::managed::operator!= | ( | const managed & | other | ) | const

inline constexpr noexcept inherited

Comparison operator for comparing two managed objects by id.

Parameters

  other | Other object to compare against

Returns
  true objects are not the same id
  false objects are the same id

## ◆ operator==()

bool dpp::managed::operator== | ( | const managed & | other | ) | const

inline constexpr noexcept inherited

Comparison operator for comparing two managed objects by id.

Parameters

  other | Other 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 | ( | std::string_view | fc | ) |

Set the file content.

Parameters

  fc | raw file content

Returns
  message& reference to self

## ◆ set_filename()

sticker & dpp::sticker::set_filename | ( | std::string_view | fn | ) |

Set the filename.

Parameters

  fn | filename

Returns
  message& reference to self

## ◆ to_json()

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

protected virtual

Build JSON from this object.

Parameters

  with_id | True if the ID is to be set in the JSON structure

Returns
  The JSON of the invite

## Friends And Related Symbol 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.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