Represents an emoji for a dpp::guild.
More...
#include <emoji.h>
Represents an emoji for a dpp::guild.
◆ emoji() [1/2]
Construct a new emoji object.
◆ emoji() [2/2]
dpp::emoji::emoji |
( |
const std::string |
n, |
|
|
const snowflake |
i = 0 , |
|
|
const uint8_t |
f = 0 |
|
) |
| |
Construct a new emoji object with name, ID and flags.
- Parameters
-
n | The emoji's name |
i | ID, if it has one (unicode does not) |
f | Emoji flags (emoji_flags) |
◆ ~emoji()
virtual dpp::emoji::~emoji |
( |
| ) |
|
|
virtual |
Destroy the emoji object.
◆ build_json()
std::string dpp::emoji::build_json |
( |
bool |
with_id = false | ) |
const |
|
virtual |
Build the json for this object.
- Parameters
-
with_id | include the id in the JSON |
- Returns
- std::string json data
Reimplemented from dpp::json_interface< emoji >.
◆ fill_from_json()
emoji & dpp::emoji::fill_from_json |
( |
nlohmann::json * |
j | ) |
|
Read class values from json object.
- Parameters
-
j | A json object to read from |
- Returns
- A reference to self
◆ format()
std::string dpp::emoji::format |
( |
| ) |
const |
Format to name if unicode, name:id if has id or a:name:id if animated.
- Returns
- Formatted name for reactions
◆ get_creation_time()
double dpp::managed::get_creation_time |
( |
| ) |
const |
|
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_mention() [1/2]
std::string dpp::emoji::get_mention |
( |
| ) |
const |
Get the mention/ping for the emoji.
- Returns
- std::string mention
◆ get_mention() [2/2]
static std::string dpp::emoji::get_mention |
( |
const std::string & |
name, |
|
|
const snowflake & |
id, |
|
|
bool |
is_animated = false |
|
) |
| |
|
static |
Create a mentionable emoji.
- Parameters
-
name | The name of the emoji. |
id | The ID of the emoji. |
is_animated | is emoji animated. |
- Returns
- std::string The formatted mention of the emoji.
◆ is_animated()
bool dpp::emoji::is_animated |
( |
| ) |
const |
Emoji is animated.
- Returns
- true Is animated
-
false Is noy animated
◆ is_available()
bool dpp::emoji::is_available |
( |
| ) |
const |
Is available.
- Returns
- true Is available
-
false Is unavailable
◆ is_managed()
bool dpp::emoji::is_managed |
( |
| ) |
const |
Emoji is managed.
- Returns
- true Is managed
-
false Is not managed
◆ load_image()
emoji & dpp::emoji::load_image |
( |
const std::string & |
image_blob, |
|
|
const image_type |
type |
|
) |
| |
Load an image into the object as base64.
- Parameters
-
image_blob | Image binary data |
type | Type of image. It can be one of i_gif , i_jpg or i_png . |
- Returns
- emoji& Reference to self
- Exceptions
-
◆ operator!=()
bool dpp::managed::operator!= |
( |
const managed & |
other | ) |
const |
|
noexceptinherited |
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 |
|
noexceptinherited |
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
◆ requires_colons()
bool dpp::emoji::requires_colons |
( |
| ) |
const |
Emoji requires colons.
- Returns
- true Requires colons
-
false Does not require colons
◆ flags
uint8_t dpp::emoji::flags |
◆ 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.
◆ image_data
std::string* dpp::emoji::image_data |
Image data for the emoji if uploading.
◆ name
std::string dpp::emoji::name |
◆ user_id
User id who uploaded the emoji.