D++ (DPP)
C++ Discord API Bot Library
|
Represents a discord webhook. More...
#include <webhook.h>
Public Member Functions | |
webhook () | |
Construct a new webhook object. More... | |
webhook (const std::string &webhook_url) | |
Construct a new webhook object using the Webhook URL provided by Discord. More... | |
webhook (const snowflake webhook_id, const std::string &webhook_token) | |
Construct a new webhook object using the webhook ID and the webhook token. More... | |
~webhook () | |
Destroy the webhook object. More... | |
webhook & | fill_from_json (nlohmann::json *j) |
Fill in object from json data. More... | |
virtual std::string | build_json (bool with_id=false) const |
Build JSON string from object. More... | |
webhook & | load_image (const std::string &image_blob, const image_type type, bool is_base64_encoded=false) |
Base64 encode image data and allocate it to image_data. More... | |
double | get_creation_time () const |
Get the creation time of this object according to Discord. More... | |
bool | operator== (const managed &other) const noexcept |
Comparison operator for comparing two managed objects by id. More... | |
bool | operator!= (const managed &other) const noexcept |
Comparison operator for comparing two managed objects by id. More... | |
Public Attributes | |
uint8_t | type |
the type of the webhook More... | |
snowflake | guild_id |
Optional: the guild id this webhook is for. More... | |
snowflake | channel_id |
the channel id this webhook is for More... | |
snowflake | user_id |
Optional: the user this webhook was created by (not returned when getting a webhook with its token) More... | |
std::string | name |
the default name of the webhook (may be empty) More... | |
std::string | avatar |
the default avatar of the webhook (may be empty) More... | |
std::string | token |
Optional: the secure token of the webhook (returned for Incoming Webhooks) More... | |
snowflake | application_id |
the bot/OAuth2 application that created this webhook (may be empty) More... | |
std::string * | image_data |
base64 encoded image data if uploading a new image 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... | |
Represents a discord webhook.
dpp::webhook::webhook | ( | ) |
Construct a new webhook object.
dpp::webhook::webhook | ( | const std::string & | webhook_url | ) |
Construct a new webhook object using the Webhook URL provided by Discord.
webhook_url | a fully qualified web address of an existing webhook |
dpp::webhook::webhook | ( | const snowflake | webhook_id, |
const std::string & | webhook_token | ||
) |
Construct a new webhook object using the webhook ID and the webhook token.
webhook_id | id taken from a link of an existing webhook |
webhook_token | token taken from a link of an existing webhook |
dpp::webhook::~webhook | ( | ) |
Destroy the webhook object.
|
virtual |
Build JSON string from object.
with_id | Include the ID of the webhook in the json |
Reimplemented from dpp::json_interface< webhook >.
webhook & dpp::webhook::fill_from_json | ( | nlohmann::json * | j | ) |
Fill in object from json data.
j | JSON data |
|
inherited |
Get the creation time of this object according to Discord.
webhook & dpp::webhook::load_image | ( | const std::string & | image_blob, |
const image_type | type, | ||
bool | is_base64_encoded = false |
||
) |
Base64 encode image data and allocate it to image_data.
image_blob | Binary image data |
type | Image type |
is_base64_encoded | True if the image data is already base64 encoded |
dpp::exception | Image data is larger than the maximum size of 256 kilobytes |
|
noexceptinherited |
Comparison operator for comparing two managed objects by id.
other | Other object to compare against |
|
noexceptinherited |
Comparison operator for comparing two managed objects by id.
other | Other object to compare against |
snowflake dpp::webhook::application_id |
the bot/OAuth2 application that created this webhook (may be empty)
std::string dpp::webhook::avatar |
the default avatar of the webhook (may be empty)
snowflake dpp::webhook::channel_id |
the channel id this webhook is for
snowflake dpp::webhook::guild_id |
Optional: the guild id this webhook is for.
|
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.
std::string* dpp::webhook::image_data |
base64 encoded image data if uploading a new image
std::string dpp::webhook::name |
the default name of the webhook (may be empty)
std::string dpp::webhook::token |
Optional: the secure token of the webhook (returned for Incoming Webhooks)
uint8_t dpp::webhook::type |
the type of the webhook
snowflake dpp::webhook::user_id |
Optional: the user this webhook was created by (not returned when getting a webhook with its token)