Skip to content
Closed
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
2 changes: 2 additions & 0 deletions gencodecs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ HEADERS = $(API_DIR)/application.h \
$(API_DIR)/channel.h \
$(API_DIR)/custom.h \
$(API_DIR)/emoji.h \
$(API_DIR)/entitlements.h \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: use spaces to keep aligned with the rest

$(API_DIR)/gateway.h \
$(API_DIR)/guild.h \
$(API_DIR)/guild_scheduled_event.h \
Expand All @@ -43,6 +44,7 @@ HEADERS = $(API_DIR)/application.h \
$(API_DIR)/message_components.h \
$(API_DIR)/oauth2.h \
$(API_DIR)/permissions.h \
$(API_DIR)/poll.h \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

$(API_DIR)/stage_instance.h \
$(API_DIR)/sticker.h \
$(API_DIR)/teams.h \
Expand Down
2 changes: 2 additions & 0 deletions gencodecs/all.PRE.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "invite.PRE.h"
#include "channel.PRE.h"
#include "emoji.PRE.h"
#include "entitlements.PRE.h"
#include "guild.PRE.h"
#include "guild_scheduled_event.PRE.h"
#include "guild_template.PRE.h"
Expand All @@ -18,6 +19,7 @@
#include "gateway.PRE.h"
#include "oauth2.PRE.h"
#include "permissions.PRE.h"
#include "poll.PRE.h"
#include "teams.PRE.h"
#include "voice_connections.PRE.h"

Expand Down
96 changes: 93 additions & 3 deletions gencodecs/api/application.PRE.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,70 @@
* @ingroup DiscordConstants
* @{ */

#if GENCODECS_RECIPE == DATA
ENUM(discord_application_integration_type)
/** app is installable to servers */
ENUMERATOR(DISCORD_APPLICATIONS_GUILD_INSTALL, = 0)
/** app is installable to users */
ENUMERATOR_LAST(DISCORD_APPLICATIONS_USER_INSTALL, = 1)
ENUM_END
#endif

/** @CCORD_pub_list{discord_application_integration_types} */
#if GENCODECS_RECIPE & (DATA | JSON)
PUB_LIST(discord_application_integration_types)
LISTTYPE_ENUM(discord_application_integration_type)
LIST_END
#endif

#if GENCODECS_RECIPE == DATA
ENUM(discord_application_event_webhook_status)
/** webhook events are disabled by developer */
ENUMERATOR(DISCORD_APPLICATIONS_WEBHOOK_DISABLED, = 1)
/** webhook events are enabled by developer */
ENUMERATOR(DISCORD_APPLICATIONS_WEBHOOK_ENABLED, = 2)
/** webhook events are disabled by Discord, usually due to inactivity */
ENUMERATOR_LAST(DISCORD_APPLICATIONS_WEBHOOK_DISABLED_BY_DISCORD, = 3)
ENUM_END
#endif

/** indicates if an app uses the Auto Moderation API */
PP_DEFINE(DISCORD_APPLICATION_APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE 1 << 6)
/** intent required for bots in 100 or more servers to
receive presence_update events */
PP_DEFINE(DISCORD_APPLICATION_GATEWAY_PRESENCE 1 << 12)
/** intent required for bots in under 100 servers to receive
presence_update events */
PP_DEFINE(DISCORD_APPLICATION_GATEWAY_PRESENCE_LIMITED 1 << 13)
/** intent required for bots in 100 or more servers to receive
member-related events like guild_member_add */
PP_DEFINE(DISCORD_APPLICATION_GATEWAY_GUILD_MEMBERS 1 << 14)
/** intent required for bots in under 100 servers to receive
member-related events like guild_member_add */
PP_DEFINE(DISCORD_APPLICATION_GATEWAY_GUILD_MEMBERS_LIMITED 1 << 15)
/** indicates unusual growth of an app that prevents verification */
PP_DEFINE(DISCORD_APPLICATION_VERIFICATION_PENDING_GUILD_LIMIT 1 << 16)
/** indicates if an app is embedded within the Discord client */
PP_DEFINE(DISCORD_APPLICATION_EMBEDDED 1 << 17)
/** intent required for bots in 100 or more servers to receive message content */
PP_DEFINE(DISCORD_APPLICATION_GATEWAY_MESSAGE_CONTENT 1 << 18)
/** intent required for bots in under 100 servers to receive message content */
PP_DEFINE(DISCORD_APPLICATION_GATEWAY_MESSAGE_CONTENT_LIMITED 1 << 19)
/** indicates if an app has registered global application commands */
PP_DEFINE(DISCORD_APPLICATION_APPLICATION_COMMAND_BADGE 1 << 23)

/** @} DiscordApplicationFlags */

/** @CCORD_pub_struct{discord_application_install_params} */
#if GENCODECS_RECIPE & (DATA | JSON)
PUB_STRUCT(discord_application_install_params)
/** the scopes to add the application to the server with */
FIELD_STRUCT_PTR(scopes, strings, *)
/** the permissions to request for the bot role */
FIELD_BITMASK(permissions)
STRUCT_END
#endif

/** @CCORD_pub_struct{discord_application} */
#if GENCODECS_RECIPE & (DATA | JSON)
PUB_STRUCT(discord_application)
Expand All @@ -37,6 +90,10 @@ PUB_STRUCT(discord_application)
/** when true the app's bot will only join upon completion of the full
oauth2 code grant flow */
FIELD(bot_require_code_grant, bool, false)
/** partial user object for the bot user associated with the app */
COND_WRITE(self->bot != NULL)
FIELD_STRUCT_PTR(bot, discord_user, *)
COND_END
/** the url of the app's terms of service */
FIELD_PTR(terms_of_service_url, char, *)
/** the url of the app's privacy policy */
Expand All @@ -45,9 +102,6 @@ PUB_STRUCT(discord_application)
COND_WRITE(self->owner != NULL)
FIELD_STRUCT_PTR(owner, discord_user, *)
COND_END
/** if this application is a game sold on Discord, this field will be the
summary field for the store page of its primary sku */
FIELD_PTR(summary, char, *)
/** the hex encoded key for verification in interactions and the GameSDK's
GetTicket */
FIELD_PTR(verify_key, char, *)
Expand All @@ -59,6 +113,10 @@ PUB_STRUCT(discord_application)
/** if this application is a game sold on Discord, this field will be the
guild to which it has been linked */
FIELD_SNOWFLAKE(guild_id)
/** Partial object of the associated guild */
COND_WRITE(self->guild != NULL)
FIELD_STRUCT_PTR(guild, discord_guild, *)
COND_END
/** if this application is a game sold on Discord, this field will be the
ID of the \"Game SKU\" that is created, if exists */
FIELD_SNOWFLAKE(primary_sku_id)
Expand All @@ -69,6 +127,38 @@ PUB_STRUCT(discord_application)
FIELD_PTR(cover_image, char, *)
/** the application's public flags @see DiscordApplicationFlags */
FIELD_BITMASK(flags)
/** the approximate count of guilds the app has been added to */
FIELD(applicatimate_guild_count, size_t, 0)
/** the approximate count of users that have installed the app */
FIELD(approximate_user_install_count, size_t, 0)
/** array of redirect URIs for the app */
COND_WRITE(self->redirect_uris != NULL)
FIELD_STRUCT_PTR(redirect_uris, strings, *)
COND_END
/** the interactions endpoint URL for the app */
FIELD_PTR(interactions_endpoint_url, char, *)
/** the role connection verification URL for the app */
FIELD_PTR(role_connections_verification_url, char, *)
/** the event webhooks URL for the app to receive webhook events */
FIELD_PTR(event_webhooks_url, char, *)
/** if webhook events are enabled for the app. */
FIELD_ENUM(event_webhooks_status, discord_application_event_webhook_status)
/** the list of Webhook event types the app subscribes to */
COND_WRITE(self->event_webhooks_types != NULL)
FIELD_STRUCT_PTR(event_webhooks_types, strings, *)
COND_END
/** the list of tags describing the content and functionality of the
app. Max of 5 tags. */
COND_WRITE(self->tags != NULL)
FIELD_STRUCT_PTR(tags, strings, *)
COND_END
/** the settings for the app's default in-app authorization link, if enabled */
COND_WRITE(self->install_params != NULL)
FIELD_STRUCT_PTR(install_params, discord_application_install_params, *)
COND_END
/* TODO: integration_types_config */
/** default custom authorization URL for the app, if enabled */
FIELD_PTR(custom_install_url, char, *)
STRUCT_END
#endif

Expand Down
Loading