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 () | |
Destroy the webhook object. More... | |
webhook & | fill_from_json (nlohmann::json *j) |
Fill in object from json data. More... | |
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... | |
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 |
Represents a discord webhook.
dpp::webhook::webhook | ( | ) |
Construct a new webhook object.
dpp::webhook::~webhook | ( | ) |
Destroy the webhook object.
std::string dpp::webhook::build_json | ( | bool | with_id = false | ) | const |
Build JSON string from object.
with_id | Include the ID of the webhook in the json |
webhook & dpp::webhook::fill_from_json | ( | nlohmann::json * | j | ) |
Fill in object from json data.
j | JSON data |
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 |
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
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)