Skip to content

Commit 794190b

Browse files
committed
feat: implement missing application event webhook fields
1 parent d2810d7 commit 794190b

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

include/dpp/application.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,24 @@ class DPP_EXPORT app_team {
212212
snowflake owner_user_id;
213213
};
214214

215+
/**
216+
* @brief Status indicating whether event webhooks are enabled or disabled for an application.
217+
*/
218+
enum application_event_webhook_status: uint8_t {
219+
/**
220+
* @brief Webhook events are disabled by developer
221+
*/
222+
ews_disabled = 1,
223+
/**
224+
* @brief Webhook events are enabled by developer
225+
*/
226+
ews_enabled = 2,
227+
/**
228+
* @brief Webhook events are disabled by Discord, usually due to inactivity
229+
*/
230+
ews_disabled_by_discord = 3,
231+
};
232+
215233
/**
216234
* @brief Configuration object for an app installation
217235
*/
@@ -357,6 +375,21 @@ class DPP_EXPORT application : public managed, public json_interface<application
357375
*/
358376
std::string role_connections_verification_url;
359377

378+
/**
379+
* @brief Event webhooks URL for the app to receive webhook events
380+
*/
381+
std::string event_webhooks_url;
382+
383+
/**
384+
* @brief List of Webhook event types the app subscribes to.
385+
*/
386+
std::vector<std::string> event_webhooks_types;
387+
388+
/**
389+
* If webhook events are enabled for the app.
390+
*/
391+
application_event_webhook_status event_webhooks_status;
392+
360393
/**
361394
* @brief Up to 5 tags describing the content and functionality of the application.
362395
*/

src/dpp/application.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ application& application::fill_from_json_impl(nlohmann::json* j) {
123123
set_string_not_null(j, "interactions_endpoint_url", interactions_endpoint_url);
124124
set_string_not_null(j, "role_connections_verification_url", role_connections_verification_url);
125125

126+
set_string_not_null(j, "event_webhooks_url", event_webhooks_url);
127+
if (j->contains("event_webhooks_types")) {
128+
for (const auto& event_webhook_type : (*j)["event_webhooks_types"]) {
129+
this->event_webhooks_types.push_back(to_string(event_webhook_type));
130+
}
131+
}
132+
this->event_webhooks_status = static_cast<application_event_webhook_status>(int8_not_null(j, "event_webhooks_status"));
133+
126134
if (j->contains("tags")) {
127135
for (const auto& tag : (*j)["tags"]) {
128136
this->tags.push_back(to_string(tag));

0 commit comments

Comments
 (0)