Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions include/dpp/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,24 @@ class DPP_EXPORT app_team {
snowflake owner_user_id;
};

/**
* @brief Status indicating whether event webhooks are enabled or disabled for an application.
*/
enum application_event_webhook_status: uint8_t {
/**
* @brief Webhook events are disabled by developer
*/
ews_disabled = 1,
/**
* @brief Webhook events are enabled by developer
*/
ews_enabled = 2,
/**
* @brief Webhook events are disabled by Discord, usually due to inactivity
*/
ews_disabled_by_discord = 3,
};

/**
* @brief Configuration object for an app installation
*/
Expand Down Expand Up @@ -357,6 +375,21 @@ class DPP_EXPORT application : public managed, public json_interface<application
*/
std::string role_connections_verification_url;

/**
* @brief Event webhooks URL for the app to receive webhook events
*/
std::string event_webhooks_url;

/**
* @brief List of Webhook event types the app subscribes to.
*/
std::vector<std::string> event_webhooks_types;

/**
* If webhook events are enabled for the app.
*/
application_event_webhook_status event_webhooks_status;

/**
* @brief Up to 5 tags describing the content and functionality of the application.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/dpp/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ application& application::fill_from_json_impl(nlohmann::json* j) {
set_string_not_null(j, "interactions_endpoint_url", interactions_endpoint_url);
set_string_not_null(j, "role_connections_verification_url", role_connections_verification_url);

set_string_not_null(j, "event_webhooks_url", event_webhooks_url);
if (j->contains("event_webhooks_types")) {
for (const auto& event_webhook_type : (*j)["event_webhooks_types"]) {
this->event_webhooks_types.push_back(to_string(event_webhook_type));
}
}
this->event_webhooks_status = static_cast<application_event_webhook_status>(int8_not_null(j, "event_webhooks_status"));

if (j->contains("tags")) {
for (const auto& tag : (*j)["tags"]) {
this->tags.push_back(to_string(tag));
Expand Down
Loading