From 42c1fa4fa93636708028f916d17304a178c407d8 Mon Sep 17 00:00:00 2001 From: Archie Jaskowicz Date: Mon, 30 Oct 2023 09:23:04 +0000 Subject: [PATCH 1/5] style: refactored comments in several files to follow standard (#975) --- include/dpp/appcommand.h | 319 ++++++++++++++++++++++----- include/dpp/application.h | 404 +++++++++++++++++++++++++++++------ include/dpp/automod.h | 118 +++++----- include/dpp/ban.h | 11 +- include/dpp/cache.h | 5 +- include/dpp/coro/async.h | 54 +++-- include/dpp/coro/coro.h | 16 +- include/dpp/coro/coroutine.h | 7 +- include/dpp/coro/job.h | 23 +- include/dpp/coro/task.h | 29 ++- include/dpp/coro/when_any.h | 105 ++++++--- include/dpp/sku.h | 3 + include/dpp/wsclient.h | 36 +++- 13 files changed, 862 insertions(+), 268 deletions(-) diff --git a/include/dpp/appcommand.h b/include/dpp/appcommand.h index 5ffc850525..8f75001c23 100644 --- a/include/dpp/appcommand.h +++ b/include/dpp/appcommand.h @@ -48,27 +48,59 @@ namespace dpp { * These are the possible parameter value types. */ enum command_option_type : uint8_t { - /** A sub-command */ + /** + * @brief A sub-command. + */ co_sub_command = 1, - /** A sub-command group */ + + /** + * @brief A sub-command group. + */ co_sub_command_group = 2, - /** A string value */ + + /** + * @brief A string value. + */ co_string = 3, - /** An integer value */ + + /** + * @brief An integer value. + */ co_integer = 4, - /** A boolean value */ + + /** + * @brief A boolean value. + */ co_boolean = 5, - /** A user snowflake id */ + + /** + * @brief A user snowflake id. + */ co_user = 6, - /** A channel snowflake id. Includes all channel types and categories */ + + /** + * @brief A channel snowflake id. Includes all channel types and categories. + */ co_channel = 7, - /** A role snowflake id */ + + /** + * @brief A role id (snowflake). + */ co_role = 8, - /** A mentionable. Includes users and roles */ + + /** + * @brief A mentionable (users and roles). + */ co_mentionable = 9, - /** Any double between -2^53 and 2^53 */ + + /** + * @brief Any double between -2^53 and 2^53. + */ co_number = 10, - /** File attachment type */ + + /** + * @brief File attachment type. + */ co_attachment = 11, }; @@ -104,9 +136,20 @@ struct DPP_EXPORT command_option_choice : public json_interface name_localizations; //!< Localisations of command option name + /** + * @brief Option name (1-32 chars). + */ + std::string name; + + /** + * @brief Option value. + */ + command_value value; + + /** + * @brief Localisations of command option name. + */ + std::map name_localizations; /** * @brief Construct a new command option choice object @@ -170,22 +213,79 @@ struct DPP_EXPORT command_option : public json_interface { command_option& fill_from_json_impl(nlohmann::json* j); public: - command_option_type type; //!< Option type (what type of value is accepted) - std::string name; //!< Option name (1-32 chars) - std::string description; //!< Option description (1-100 chars) - bool required; //!< True if this is a mandatory parameter - bool focused; //!< True if the user is typing in this field, when sent via autocomplete - command_value value; //!< Set only by autocomplete went sent as part of an interaction - std::vector choices; //!< List of choices for multiple choice command - bool autocomplete; //!< True if this option supports auto completion - std::vector options; //!< Sub-commands - std::vector channel_types; //!< Allowed channel types for channel snowflake id options + /** + * @brief Option type (what type of value is accepted). + */ + command_option_type type; + + /** + * @brief Option name (1-32 chars). + */ + std::string name; + + /** + * @brief Option description (1-100 chars). + */ + std::string description; + + /** + * @brief Is this a mandatory parameter? + */ + bool required; + + /** + * @brief Is the user is typing in this field? + * + * @note This is sent via autocomplete. + */ + bool focused; + + /** + * @brief Set only by autocomplete when sent as part of an interaction. + */ + command_value value; + + /** + * @brief List of choices for multiple choice command. + */ + std::vector choices; + + /** + * @brief Does this option supports auto completion? + */ + bool autocomplete; + + /** + * @brief An array of sub-commands (options). + */ + std::vector options; + + /** + * @brief Allowed channel types for channel snowflake id options. + */ + std::vector channel_types; + // Combines the `min_length` and `max_length` field by storing its value in the int64_t of the command_option_range - command_option_range min_value; //!< Minimum value/length that can be entered, for dpp::co_number, dpp::co_integer and dpp::co_string types only - command_option_range max_value; //!< Maximum value/length that can be entered, for dpp::co_number, dpp::co_integer and dpp::co_string types only - std::map name_localizations; //!< Localisations of command name - std::map description_localizations; //!< Localisations of command description + /** + * @brief Minimum value/length that can be entered, for dpp::co_number, dpp::co_integer and dpp::co_string types only. + */ + command_option_range min_value; + + /** + * @brief Maximum value/length that can be entered, for dpp::co_number, dpp::co_integer and dpp::co_string types only. + */ + command_option_range max_value; + + /** + * @brief Localisations of command name. + */ + std::map name_localizations; + + /** + * @brief Localisations of command description. + */ + std::map description_localizations; /** * @brief Construct a new command option object @@ -302,10 +402,12 @@ enum interaction_response_type { * @brief Acknowledge a Ping */ ir_pong = 1, + /** * @brief Respond to an interaction with a message. */ ir_channel_message_with_source = 4, + /** * @brief Acknowledge an interaction and edit a response later, the user sees a loading state */ @@ -584,18 +686,37 @@ struct DPP_EXPORT command_resolved { * the command on a channel or in DM. */ struct DPP_EXPORT command_data_option { - std::string name; //!< the name of the parameter - command_option_type type; //!< value of ApplicationCommandOptionType - command_value value; //!< Optional: the value of the pair - std::vector options; //!< Optional: present if this option is a group or subcommand - bool focused; //!< Optional: true if this option is the currently focused option for autocomplete + /** + * @brief The name of the parameter. + */ + std::string name; + + /** + * @brief The type of option (value of ApplicationCommandOptionType). + */ + command_option_type type; + + /** + * @brief Optional: the value of the pair + */ + command_value value; + + /** + * @brief Optional: present if this option is a group or subcommand + */ + std::vector options; + + /** + * @brief Optional: true if this option is the currently focused option for autocomplete + */ + bool focused; /** * @brief Check if the value variant holds std::monostate and options vector is empty (i.e. the option wasn't supplied) * @return bool true, if value variant holds std::monostate and options vector is empty */ bool empty() { - return std::holds_alternative(value) && options.empty(); + return std::holds_alternative(value) && options.empty(); } /** @@ -623,21 +744,55 @@ void from_json(const nlohmann::json& j, command_data_option& cdo); /** Types of interaction in the dpp::interaction class */ enum interaction_type { - it_ping = 1, //!< ping - it_application_command = 2, //!< application command (slash command) - it_component_button = 3, //!< button click or select menu chosen (component interaction) - it_autocomplete = 4, //!< Autocomplete interaction - it_modal_submit = 5, //!< Modal form submission + /** + * @brief A ping interaction. + */ + it_ping = 1, + + /** + * @brief Application command (slash command) interaction. + */ + it_application_command = 2, + + /** + * @brief Button click or select menu chosen (component interaction) + */ + it_component_button = 3, + + /** + * @brief Autocomplete interaction. + */ + it_autocomplete = 4, + + /** + * @brief Modal form submission. + */ + it_modal_submit = 5, }; /** * @brief Right-click context menu types */ enum slashcommand_contextmenu_type { - ctxm_none = 0, //!< Undefined context menu type - ctxm_chat_input = 1, //!< DEFAULT, these are the slash commands you're used to - ctxm_user = 2, //!< Add command to user context menu - ctxm_message = 3 //!< Add command to message context menu + /** + * @brief Undefined context menu type + */ + ctxm_none = 0, + + /** + * @brief DEFAULT: these are the generic slash commands (e.g. /ping, /pong, etc) + */ + ctxm_chat_input = 1, + + /** + * @brief A slashcommand that goes in the user context menu. + */ + ctxm_user = 2, + + /** + * @brief A slashcommand that goes in the message context menu. + */ + ctxm_message = 3 }; /** @@ -646,11 +801,32 @@ enum slashcommand_contextmenu_type { * with the interaction. */ struct DPP_EXPORT command_interaction { - snowflake id; //!< the ID of the invoked command - std::string name; //!< the name of the invoked command - std::vector options; //!< Optional: the params + values from the user - slashcommand_contextmenu_type type; //!< type of the command interaction - dpp::snowflake target_id; //!< Non-zero target ID for context menu actions. e.g. user id or message id whom clicked or tapped with the context menu https://discord.com/developers/docs/interactions/application-commands#user-commands + /** + * @brief The ID of the invoked command. + */ + snowflake id; + + /** + * @brief The name of the invoked command. + */ + std::string name; + + /** + * @brief Optional: the params + values from the user. + */ + std::vector options; + + /** + * @brief The type of command interaction. + */ + slashcommand_contextmenu_type type; + + /** + * @brief Non-zero target ID for context menu actions (e.g. user id or message id whom clicked or tapped with the context menu). + * + * @see https://discord.com/developers/docs/interactions/application-commands#user-commands + */ + dpp::snowflake target_id; /** * @brief Get an option value by index @@ -690,10 +866,12 @@ struct DPP_EXPORT component_interaction { * @brief Component type (dpp::component_type) */ uint8_t component_type; + /** * @brief Custom ID set when created */ std::string custom_id; + /** * @brief Possible values for a drop down list */ @@ -1031,12 +1209,11 @@ void from_json(const nlohmann::json& j, interaction& i); enum command_permission_type { /** * @brief Role permission - * */ cpt_role = 1, + /** * @brief User permission - * */ cpt_user = 2, }; @@ -1058,12 +1235,23 @@ class DPP_EXPORT command_permission : public json_interface command_permission &fill_from_json_impl(nlohmann::json *j); public: - snowflake id; //!< the ID of the role or user - command_permission_type type; //!< the type of permission - bool permission; //!< true to allow, false, to disallow + /** + * @brief The ID of the role/user. + */ + snowflake id; /** - * @brief Construct a new command permission object + * @brief The type of permission. + */ + command_permission_type type; + + /** + * @brief True to allow, false to disallow. + */ + bool permission; + + /** + * @brief Construct a new command permission object. */ command_permission() = default; @@ -1105,10 +1293,25 @@ class DPP_EXPORT guild_command_permissions : public json_interface permissions; //!< the permissions for the command in the guild + /** + * @brief The id of the command. + */ + snowflake id; + + /** + * @brief The id of the application the command belongs to. + */ + snowflake application_id; + + /** + * @brief The id of the guild. + */ + snowflake guild_id; + + /** + * @brief The permissions for the command, in the guild. + */ + std::vector permissions; /** * @brief Construct a new guild command permissions object diff --git a/include/dpp/application.h b/include/dpp/application.h index 33e0ff27f1..eb7e8b32df 100644 --- a/include/dpp/application.h +++ b/include/dpp/application.h @@ -37,9 +37,13 @@ namespace dpp { * @brief status of a member of a team who maintain a bot/application */ enum team_member_status : uint8_t { - /// User was invited to the team + /** + * @brief User was invited to the team. + */ tms_invited = 1, - /// User has accepted membership onto the team + /** + * @brief User has accepted membership onto the team. + */ tms_accepted = 2 }; @@ -47,25 +51,54 @@ enum team_member_status : uint8_t { * @brief Flags for a bot or application */ enum application_flags : uint32_t { - /// Indicates if an app uses the Auto Moderation API + /** + * @brief Indicates if an app uses the Auto Moderation API + */ apf_application_automod_rule_create_badge = (1 << 6), - /// Has gateway presence intent + + /** + * @brief Has gateway presence intent + */ apf_gateway_presence = (1 << 12), - /// Has gateway presence intent for <100 guilds + + /** + * @brief Has gateway presence intent for <100 guilds + */ apf_gateway_presence_limited = (1 << 13), - /// Has guild members intent + + /** + * @brief Has guild members intent + */ apf_gateway_guild_members = (1 << 14), - /// Has guild members intent for <100 guilds + + /** + * @brief Has guild members intent for <100 guilds + */ apf_gateway_guild_members_limited = (1 << 15), - /// Verification is pending + + /** + * @brief Verification is pending + */ apf_verification_pending_guild_limit = (1 << 16), - /// Embedded + + /** + * @brief Embedded + */ apf_embedded = (1 << 17), - /// Has approval for message content + + /** + * @brief Has approval for message content + */ apf_gateway_message_content = (1 << 18), - /// Has message content, but <100 guilds + + /** + * @brief Has message content, but <100 guilds + */ apf_gateway_message_content_limited = (1 << 19), - /// Indicates if the app has registered global application commands + + /** + * @brief Indicates if the app has registered global application commands + */ apf_application_command_badge = (1 << 23) }; @@ -73,8 +106,17 @@ enum application_flags : uint32_t { * @brief Represents the settings for the bot/application's in-app authorization link */ struct DPP_EXPORT application_install_params { - permission permissions; //!< A bitmask of dpp::permissions to request for the bot role - std::vector scopes; //!< The [scopes](https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) as strings to add the application to the server with + /** + * @brief A bitmask of dpp::permissions to request for the bot role. + */ + permission permissions; + + /** + * @brief The scopes as strings to add the application to the server with. + * + * @see https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes + */ + std::vector scopes; }; /** @@ -84,10 +126,25 @@ struct DPP_EXPORT application_install_params { * this enum will be extended to support them. */ enum team_member_role_t : uint8_t { - tmr_owner, //!< Team owner - tmr_admin, //!< Team admin - tmr_developer, //!< Developer - tmr_readonly, //!< Read-Only + /** + * @brief Team owner. + */ + tmr_owner, + + /** + * @brief Team admin. + */ + tmr_admin, + + /** + * @brief Developer + */ + tmr_developer, + + /** + * @brief Read-Only + */ + tmr_readonly, }; /** @@ -95,11 +152,30 @@ enum team_member_role_t : uint8_t { */ class DPP_EXPORT team_member { public: - team_member_status membership_state; //!< the user's membership state on the team - std::string permissions; //!< will always be [""] - snowflake team_id; //!< the id of the parent team of which they are a member - user member_user; //!< the avatar, discriminator, id, and username of the user - team_member_role_t member_role; //!< the role of the user + /** + * @brief The user's membership state on the team. + */ + team_member_status membership_state; + + /** + * @brief Will always be "". + */ + std::string permissions; + + /** + * @brief The id of the parent team of which they are a member. + */ + snowflake team_id; + + /** + * @brief The avatar, discriminator, id, and username, of the user. + */ + user member_user; + + /** + * @brief The role of the user in the team. + */ + team_member_role_t member_role; }; /** @@ -107,11 +183,30 @@ class DPP_EXPORT team_member { */ class DPP_EXPORT app_team { public: - utility::iconhash icon; //!< a hash of the image of the team's icon (may be empty) - snowflake id; //!< the unique id of the team - std::vector members; //!< the members of the team - std::string name; //!< the name of the team - snowflake owner_user_id; //!< the user id of the current team owner + /** + * @brief A hash of the image of the team's icon (may be empty). + */ + utility::iconhash icon; + + /** + * @brief The id of the team. + */ + snowflake id; + + /** + * @brief The members of the team. + */ + std::vector members; + + /** + * @brief The name of the team. + */ + std::string name; + + /** + * @brief The user id of the current team owner. + */ + snowflake owner_user_id; }; /** @@ -128,48 +223,213 @@ class DPP_EXPORT application : public managed, public json_interface rpc_origins; //!< Optional: an array of rpc origin urls, if rpc is enabled - bool bot_public; //!< when false only app owner can join the app's bot to guilds - bool bot_require_code_grant; //!< when true the app's bot will only join upon completion of the full oauth2 code grant flow - user bot; //!< Optional: Partial user object for the bot user associated with the app. - std::string terms_of_service_url; //!< Optional: the url of the app's terms of service - std::string privacy_policy_url; //!< Optional: the url of the app's privacy policy - user owner; //!< Optional: partial user object containing info on the owner of the application - std::string summary; //!< if this application is a game sold on Discord, this field will be the summary field for the store page of its primary sku @deprecated Will be removed in v11 - std::string verify_key; //!< the hex encoded key for verification in interactions and the GameSDK's GetTicket - app_team team; //!< if the application belongs to a team, this will be a list of the members of that team (may be empty) - snowflake guild_id; //!< Optional: if this application is a game sold on Discord, this field will be the guild to which it has been linked - guild guild_obj; //!< Optional: Partial object of the associated guild - snowflake primary_sku_id; //!< Optional: if this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists - std::string slug; //!< Optional: if this application is a game sold on Discord, this field will be the URL slug that links to the store page - utility::iconhash cover_image; //!< Optional: the application's default rich presence invite cover image hash - uint32_t flags; //!< Optional: the application's public flags - uint64_t approximate_guild_count; //!< Optional: Approximate count of guilds the app has been added to - std::vector redirect_uris; //!< Optional: Array of redirect URIs for the app - std::string interactions_endpoint_url; //!< Optional: Interactions endpoint URL for the app - std::string role_connections_verification_url; //!< The application's role connection verification entry point, which when configured will render the app as a verification method in the guild role verification configuration - std::vector tags; //!< Up to 5 tags describing the content and functionality of the application - application_install_params install_params; //!< Settings for the application's default in-app authorization link, if enabled - std::string custom_install_url; //!< The application's default custom authorization link, if enabled - - uint8_t discoverability_state; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - uint32_t discovery_eligibility_flags; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - uint8_t explicit_content_filter; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - uint8_t creator_monetization_state; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - bool integration_public; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - bool integration_require_code_grant; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - std::vector interactions_event_types; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - uint8_t interactions_version; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - bool is_monetized; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - uint32_t monetization_eligibility_flags; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - uint8_t monetization_state; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - bool hook; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - uint8_t rpc_application_state; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - uint8_t store_application_state; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. - uint8_t verification_state; //!< @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + /** + * @brief The name of the app. + */ + std::string name; + + /** + * @brief The icon hash of the app (may be empty). + */ + utility::iconhash icon; + + /** + * @brief The description of the app. + */ + std::string description; + + /** + * @brief Optional: an array of rpc origin urls, if rpc is enabled. + */ + std::vector rpc_origins; + + /** + * @brief When false, only app owner add the bot to guilds. + */ + bool bot_public; + + /** + * @brief When true, the app's bot will only join upon completion of the full oauth2 code grant flow + */ + bool bot_require_code_grant; + + /** + * @brief Optional: Partial user object for the bot user associated with the app. + */ + user bot; + + /** + * @brief Optional: the url of the app's terms of service. + */ + std::string terms_of_service_url; + + /** + * @brief Optional: the url of the app's privacy policy. + */ + std::string privacy_policy_url; + + /** + * @brief Optional: partial user object containing info on the owner of the application. + */ + user owner; + + /** + * @brief If this application is a game sold on Discord, this field will be the summary field for the store page of its primary SKU. + * + * @deprecated Will be removed in v11 + */ + std::string summary; + + /** + * @brief The hex encoded key for verification in interactions and the GameSDK's GetTicket. + */ + std::string verify_key; + + /** + * @brief If the application belongs to a team, this will be a list of the members of that team (may be empty). + */ + app_team team; + + /** + * @brief Optional: if this application is a game sold on Discord, this field will be the guild to which it has been linked. + */ + snowflake guild_id; + + /** + * @brief Partial object of the associated guild. + */ + guild guild_obj; + + /** + * @brief Optional: if this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists. + */ + snowflake primary_sku_id; + + /** + * @brief Optional: if this application is a game sold on Discord, this field will be the URL slug that links to the store page. + */ + std::string slug; + + /** + * @brief Optional: the application's default rich presence invite cover image hash + */ + utility::iconhash cover_image; + + /** + * @brief Optional: the application's public flags. + */ + uint32_t flags; + + /** + * @brief Optional: Approximate count of guilds the app has been added to. + */ + uint64_t approximate_guild_count; + + /** + * @brief Optional: Array of redirect URIs for the app. + */ + std::vector redirect_uris; + + /** + * @brief Optional: Interactions endpoint URL for the app. + */ + std::string interactions_endpoint_url; + + /** + * @brief The application's role connection verification entry point + * which, when configured, will render the app as a verification method + * in the guild role verification configuration. + */ + std::string role_connections_verification_url; + + /** + * @brief Up to 5 tags describing the content and functionality of the application. + */ + std::vector tags; + + /** + * @brief Settings for the application's default in-app authorization link, if enabled. + */ + application_install_params install_params; + + /** + * @brief The application's default custom authorization link, if enabled. + */ + std::string custom_install_url; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + uint8_t discoverability_state; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + uint32_t discovery_eligibility_flags; + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + uint8_t explicit_content_filter; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + uint8_t creator_monetization_state; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + bool integration_public; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + bool integration_require_code_grant; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + std::vector interactions_event_types; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + uint8_t interactions_version; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + bool is_monetized; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + uint32_t monetization_eligibility_flags; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + uint8_t monetization_state; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + bool hook; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + uint8_t rpc_application_state; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + uint8_t store_application_state; + + /** + * @warning This variable is not documented by discord, we have no idea what it means and how it works. Use at your own risk. + */ + uint8_t verification_state; /** Constructor */ application(); @@ -198,7 +458,9 @@ class DPP_EXPORT application : public managed, public json_interface { * Prefix - word must start with the keyword * * | keyword | matches | - * |----------|-------------------------------------| - * | cat* | catch, Catapult, CAttLE | - * | the mat* | the matrix | - * - * Suffix - word must end with the keyword - * - * | keyword | matches | - * |----------|--------------------------| - * | *cat | wildcat, copyCat | - * | *the mat | breathe mat | - * - * Anywhere - keyword can appear anywhere in the content - * - * | keyword | matches | - * |-----------|-----------------------------| - * | \*cat* | location, eduCation | - * | \*the mat* | breathe matter | - * - * Whole Word - keyword is a full word or phrase and must be surrounded by whitespace at the beginning and end - * - * | keyword | matches | - * |---------|-------------| - * | cat | Cat | - * | the mat | the mat | - * + * |----------|-------------------------------------| + * | cat* | catch, Catapult, CAttLE | + * | the mat* | the matrix | + * + * Suffix - word must end with the keyword + * + * | keyword | matches | + * |----------|--------------------------| + * | *cat | wildcat, copyCat | + * | *the mat | breathe mat | + * + * Anywhere - keyword can appear anywhere in the content + * + * | keyword | matches | + * |-----------|-----------------------------| + * | \*cat* | location, eduCation | + * | \*the mat* | breathe matter | + * + * Whole Word - keyword is a full word or phrase and must be surrounded by whitespace at the beginning and end + * + * | keyword | matches | + * |---------|-------------| + * | cat | Cat | + * | the mat | the mat | + * */ std::vector keywords; @@ -196,31 +204,31 @@ struct DPP_EXPORT automod_metadata : public json_interface { * Prefix - word must start with the keyword * * | keyword | matches | - * |----------|-------------------------------------| - * | cat* | catch, Catapult, CAttLE | - * | the mat* | the matrix | - * - * Suffix - word must end with the keyword - * - * | keyword | matches | - * |----------|--------------------------| - * | *cat | wildcat, copyCat | - * | *the mat | breathe mat | - * - * Anywhere - keyword can appear anywhere in the content - * - * | keyword | matches | - * |-----------|-----------------------------| - * | \*cat* | location, eduCation | - * | \*the mat* | breathe matter | - * - * Whole Word - keyword is a full word or phrase and must be surrounded by whitespace at the beginning and end - * - * | keyword | matches | - * |---------|-------------| - * | cat | Cat | - * | the mat | the mat | - * + * |----------|-------------------------------------| + * | cat* | catch, Catapult, CAttLE | + * | the mat* | the matrix | + * + * Suffix - word must end with the keyword + * + * | keyword | matches | + * |----------|--------------------------| + * | *cat | wildcat, copyCat | + * | *the mat | breathe mat | + * + * Anywhere - keyword can appear anywhere in the content + * + * | keyword | matches | + * |-----------|-----------------------------| + * | \*cat* | location, eduCation | + * | \*the mat* | breathe matter | + * + * Whole Word - keyword is a full word or phrase and must be surrounded by whitespace at the beginning and end + * + * | keyword | matches | + * |---------|-------------| + * | cat | Cat | + * | the mat | the mat | + * */ std::vector allow_list; @@ -326,42 +334,52 @@ class DPP_EXPORT automod_rule : public managed, public json_interface actions; + /** * @brief Whether the rule is enabled */ bool enabled; + /** * @brief the role ids that should not be affected by the rule (Maximum of 20) */ std::vector exempt_roles; + /** * @brief the channel ids that should not be affected by the rule (Maximum of 50) */ diff --git a/include/dpp/ban.h b/include/dpp/ban.h index 2a68696660..6a02352ed1 100644 --- a/include/dpp/ban.h +++ b/include/dpp/ban.h @@ -44,9 +44,14 @@ class DPP_EXPORT ban : public json_interface { ban& fill_from_json_impl(nlohmann::json* j); public: - /** The ban reason */ + /** + * @brief The ban reason. + */ std::string reason; - /** User ID the ban applies to */ + + /** + * @brief User ID the ban applies to. + */ snowflake user_id; /** Constructor */ @@ -57,7 +62,7 @@ class DPP_EXPORT ban : public json_interface { }; /** - * A group of bans. The key is the user ID + * @brief A group of bans. The key is the user ID. */ typedef std::unordered_map ban_map; diff --git a/include/dpp/cache.h b/include/dpp/cache.h index 5895af576d..c43242b444 100644 --- a/include/dpp/cache.h +++ b/include/dpp/cache.h @@ -65,7 +65,7 @@ template class cache { /** * @brief Construct a new cache object. * - * Caches must contain classes derived from dpp::managed. + * @note Caches must contain classes derived from dpp::managed. */ cache() { cache_map = new std::unordered_map; @@ -255,7 +255,8 @@ template class cache { }; -/** Run garbage collection across all caches removing deleted items +/** + * Run garbage collection across all caches removing deleted items * that have been deleted over 60 seconds ago. */ void DPP_EXPORT garbage_collection(); diff --git a/include/dpp/coro/async.h b/include/dpp/coro/async.h index bd78369dd9..2c7c9f13e3 100644 --- a/include/dpp/coro/async.h +++ b/include/dpp/coro/async.h @@ -56,39 +56,54 @@ namespace async { * @brief Represents the step an std::async is at. */ enum class state_t { - sent, /* Request was sent but not co_await-ed. handle is nullptr, result_storage is not constructed */ - waiting, /* Request was co_await-ed. handle is valid, result_storage is not constructed */ - done, /* Request was completed. handle is unknown, result_storage is valid */ - dangling /* Request was never co_await-ed. */ + /** + * @brief Request was sent but not co_await-ed. handle is nullptr, result_storage is not constructed. + */ + sent, + + /** + * @brief Request was co_await-ed. handle is valid, result_storage is not constructed. + */ + waiting, + + /** + * @brief Request was completed. handle is unknown, result_storage is valid. + */ + done, + + /** + * @brief Request was never co_await-ed. + */ + dangling }; /** - * @brief State of the async and its callback. - * - * Defined outside of dpp::async because this seems to work better with Intellisense. - */ + * @brief State of the async and its callback. + * + * Defined outside of dpp::async because this seems to work better with Intellisense. + */ template struct async_callback_data { /** - * @brief Number of references to this callback state. - */ + * @brief Number of references to this callback state. + */ std::atomic ref_count{1}; /** - * @brief State of the awaitable and the API callback - */ + * @brief State of the awaitable and the API callback + */ std::atomic state = state_t::sent; /** - * @brief The stored result of the API call, stored as an array of bytes to directly construct in place - */ + * @brief The stored result of the API call, stored as an array of bytes to directly construct in place + */ alignas(R) std::array result_storage; /** - * @brief Handle to the coroutine co_await-ing on this API call - * - * @see std::coroutine_handle - */ + * @brief Handle to the coroutine co_await-ing on this API call + * + * @see std::coroutine_handle + */ std_coroutine::coroutine_handle<> coro_handle = nullptr; /** @@ -374,7 +389,8 @@ class async_base { struct confirmation_callback_t; -/** @class async async.h coro/async.h +/** + * @class async async.h coro/async.h * @brief A co_await-able object handling an API call in parallel with the caller. * * This class is the return type of the dpp::cluster::co_* methods, but it can also be created manually to wrap any async call. diff --git a/include/dpp/coro/coro.h b/include/dpp/coro/coro.h index 2dd0836b94..76f3256ed8 100644 --- a/include/dpp/coro/coro.h +++ b/include/dpp/coro/coro.h @@ -45,17 +45,17 @@ namespace std { namespace dpp { /** - * @brief Implementation details for internal use only. - * - * @attention This is only meant to be used by D++ internally. Support will not be given regarding the facilities in this namespace. - */ + * @brief Implementation details for internal use only. + * + * @attention This is only meant to be used by D++ internally. Support will not be given regarding the facilities in this namespace. + */ namespace detail { #ifdef _DOXYGEN_ /** - * @brief Alias for either std or std::experimental depending on compiler and library. Used by coroutine implementation. - * - * @todo Remove and use std when all supported libraries have coroutines in it - */ + * @brief Alias for either std or std::experimental depending on compiler and library. Used by coroutine implementation. + * + * @todo Remove and use std when all supported libraries have coroutines in it + */ namespace std_coroutine {} #else # ifdef STDCORO_EXPERIMENTAL_NAMESPACE diff --git a/include/dpp/coro/coroutine.h b/include/dpp/coro/coroutine.h index ea656f578e..a03d670b41 100644 --- a/include/dpp/coro/coroutine.h +++ b/include/dpp/coro/coroutine.h @@ -51,8 +51,8 @@ struct promise_t; template /** - * @brief Alias for the handle_t of a coroutine. - */ + * @brief Alias for the handle_t of a coroutine. + */ using handle_t = std_coroutine::coroutine_handle>; /** @@ -188,7 +188,8 @@ class coroutine_base { } // namespace detail -/** @class coroutine coroutine.h coro/coroutine.h +/** + * @class coroutine coroutine.h coro/coroutine.h * @brief Base type for a coroutine, starts on co_await. * * @warning - This feature is EXPERIMENTAL. The API may change at any time and there may be bugs. diff --git a/include/dpp/coro/job.h b/include/dpp/coro/job.h index f7371977d2..ed6ab2518c 100644 --- a/include/dpp/coro/job.h +++ b/include/dpp/coro/job.h @@ -38,7 +38,8 @@ struct job_dummy { namespace dpp { -/** @class job job.h coro/job.h +/** + * @class job job.h coro/job.h * @brief Extremely light coroutine object designed to send off a coroutine to execute on its own. * Can be used in conjunction with coroutine events via @ref dpp::event_router_t::operator()(F&&) "event routers", or on its own. * @@ -78,20 +79,20 @@ struct promise { } #endif - /* - * @brief Function called when the job is done. - * - * @return std::suspend_never Do not suspend at the end, destroying the handle immediately - */ + /** + * @brief Function called when the job is done. + * + * @return std::suspend_never Do not suspend at the end, destroying the handle immediately + */ std_coroutine::suspend_never final_suspend() const noexcept { return {}; } - /* - * @brief Function called when the job is started. - * - * @return std::suspend_never Do not suspend at the start, starting the job immediately - */ + /** + * @brief Function called when the job is started. + * + * @return std::suspend_never Do not suspend at the start, starting the job immediately + */ std_coroutine::suspend_never initial_suspend() const noexcept { return {}; } diff --git a/include/dpp/coro/task.h b/include/dpp/coro/task.h index c208440de5..5cdf4577d1 100644 --- a/include/dpp/coro/task.h +++ b/include/dpp/coro/task.h @@ -51,15 +51,25 @@ namespace detail { /* Internal cogwheels for dpp::task */ namespace task { -/** @brief State of a task */ +/** + * @brief State of a task + */ enum class state_t { - /** @brief Task was started but never co_await-ed */ + /** + * @brief Task was started but never co_await-ed + */ started, - /** @brief Task was co_await-ed and is pending completion */ + /** + * @brief Task was co_await-ed and is pending completion + */ awaited, - /** @brief Task is completed */ + /** + * @brief Task is completed + */ done, - /** @brief Task is still running but the actual dpp::task object is destroyed */ + /** + * @brief Task is still running but the actual dpp::task object is destroyed + */ dangling }; @@ -261,7 +271,8 @@ class task_base { } // namespace detail -/** @class task task.h coro/task.h +/** + * @class task task.h coro/task.h * @brief A coroutine task. It starts immediately on construction and can be co_await-ed, making it perfect for parallel coroutines returning a value. * * @warning - This feature is EXPERIMENTAL. The API may change at any time and there may be bugs. @@ -487,7 +498,7 @@ class task : private detail::task::task_base { #endif /* _DOXYGEN_ */ namespace detail::task { - /** +/** * @brief Awaitable returned from task::promise_t's final_suspend. Resumes the parent and cleans up its handle if needed */ template @@ -499,7 +510,7 @@ struct final_awaiter { return (false); } - /* + /** * @brief The suspension logic of the coroutine when it finishes. Always suspend the caller, meaning cleaning up the handle is on us * * @param handle The handle of this coroutine @@ -507,7 +518,7 @@ struct final_awaiter { */ [[nodiscard]] std_coroutine::coroutine_handle<> await_suspend(handle_t handle) const noexcept; - /* + /** * @brief Function called when this object is co_awaited by the standard library at the end of final_suspend. Do nothing, return nothing */ void await_resume() const noexcept {} diff --git a/include/dpp/coro/when_any.h b/include/dpp/coro/when_any.h index 96952c17e7..1e3fd5a359 100644 --- a/include/dpp/coro/when_any.h +++ b/include/dpp/coro/when_any.h @@ -45,18 +45,30 @@ class awaitable; } -/** @brief Internal cogwheels for dpp::when_any */ +/** + * @brief Internal cogwheels for dpp::when_any + */ namespace when_any { -/** @brief Current state of a when_any object */ +/** + * @brief Current state of a when_any object + */ enum class await_state { - /** @brief Object was started but not awaited */ + /** + * @brief Object was started but not awaited + */ started, - /** @brief Object is being awaited */ + /** + * @brief Object is being awaited + */ waiting, - /** @brief Object was resumed*/ + /** + * @brief Object was resumed + */ done, - /** @brief Object was destroyed */ + /** + * @brief Object was destroyed + */ dangling }; @@ -102,14 +114,20 @@ using awaitable_type = typename arg_helper_s::type; template using arg_helper = arg_helper_s>; -/** @brief Empty result from void-returning awaitable */ +/** + * @brief Empty result from void-returning awaitable + */ struct empty{}; -/** @brief Actual type a result will be stores as in when_any */ +/** + * @brief Actual type a result will be stores as in when_any + */ template using storage_type = std::conditional_t, empty, T>; -/** @brief Concept satisfied if a stored result is void */ +/** + * @brief Concept satisfied if a stored result is void + */ template concept void_result = std::same_as; @@ -117,7 +135,8 @@ concept void_result = std::same_as; } // namespace detail -/** @class when_any when_any.h coro/when_any.h +/** + * @class when_any when_any.h coro/when_any.h * @brief Experimental class to co_await on a bunch of awaitable objects, resuming when the first one completes. * On completion, returns a @ref result object that contains the index of the awaitable that finished first. * A user can call @ref result::index() and @ref result::get() on the result object to get the result, similar to std::variant. @@ -130,7 +149,9 @@ template requires (sizeof...(Args) >= 1) #endif class when_any { - /** @brief Alias for the type of the result variant */ + /** + * @brief Alias for the type of the result variant + */ using variant_type = std::variant>>...>; /** @@ -193,9 +214,9 @@ class when_any { template static dpp::job make_job(std::shared_ptr shared_state) { /** - * Any exceptions from the awaitable's await_suspend should be thrown to the caller (the coroutine creating the when_any object) - * If the co_await passes, and it is the first one to complete, try construct the result, catch any exceptions to rethrow at resumption, and resume. - */ + * Any exceptions from the awaitable's await_suspend should be thrown to the caller (the coroutine creating the when_any object) + * If the co_await passes, and it is the first one to complete, try construct the result, catch any exceptions to rethrow at resumption, and resume. + */ if constexpr (!std::same_as, detail::when_any::empty>) { decltype(auto) result = co_await std::get(shared_state->awaitables); @@ -236,7 +257,8 @@ class when_any { } /** - * @brief Spawn a dpp::job to handle each awaitable. Each of them will co_await the awaitable and set the result if they are the first to finish + * @brief Spawn a dpp::job to handle each awaitable. + * Each of them will co_await the awaitable and set the result if they are the first to finish */ void make_jobs() { [](when_any *self, std::index_sequence) { @@ -251,26 +273,40 @@ class when_any { class result { friend class when_any; - /** @brief Reference to the shared state to pull the data from */ + /** + * @brief Reference to the shared state to pull the data from + */ std::shared_ptr shared_state; - /** @brief Default construction is deleted */ + /** + * @brief Default construction is deleted + */ result() = delete; - /** @brief Internal constructor taking the shared state */ + /** + * @brief Internal constructor taking the shared state + */ result(std::shared_ptr state) : shared_state{state} {} public: - /** @brief Move constructor */ + /** + * @brief Move constructor + */ result(result&&) = default; - /** @brief This object is not copyable. */ + /** + * @brief This object is not copyable. + */ result(const result &) = delete; - /** @brief Move assignment operator */ + /** + * @brief Move assignment operator + */ result &operator=(result&&) = default; - /** @brief This object is not copyable. */ + /** + * @brief This object is not copyable. + */ result &operator=(const result&) = delete; /** @@ -361,7 +397,9 @@ class when_any { * @see result */ struct awaiter { - /** @brief Pointer to the when_any object */ + /** + * @brief Pointer to the when_any object + */ when_any *self; /** @@ -394,7 +432,10 @@ class when_any { } }; - /** @brief Default constructor. A when_any object created this way holds no state */ + /** + * @brief Default constructor. + * A when_any object created this way holds no state + */ when_any() = default; /** @@ -411,10 +452,14 @@ class when_any { make_jobs(); } - /** @brief This object is not copyable. */ + /** + * @brief This object is not copyable. + */ when_any(const when_any &) = delete; - /** @brief Move constructor. */ + /** + * @brief Move constructor. + */ when_any(when_any &&) noexcept = default; /** @@ -444,10 +489,14 @@ class when_any { }(this, std::index_sequence_for()); } - /** @brief This object is not copyable. */ + /** + * @brief This object is not copyable. + */ when_any &operator=(const when_any &) = delete; - /** @brief Move assignment operator. */ + /** + * @brief Move assignment operator. + */ when_any &operator=(when_any &&) noexcept = default; /** diff --git a/include/dpp/sku.h b/include/dpp/sku.h index 88b07d0728..80db89ff2e 100644 --- a/include/dpp/sku.h +++ b/include/dpp/sku.h @@ -38,6 +38,7 @@ enum sku_type : uint8_t { * @brief Represents a recurring subscription */ SUBSCRIPTION = 5, + /** * @brief System-generated group for each SUBSCRIPTION SKU created * @warning These are automatically created for each subscription SKU and are not used at this time. Please refrain from using these. @@ -53,10 +54,12 @@ enum sku_flags : uint16_t { * @brief SKU is available for purchase */ sku_available = 0b000000000000100, + /** * @brief Recurring SKU that can be purchased by a user and applied to a single server. Grants access to every user in that server. */ sku_guild_subscription = 0b000000010000000, + /** * @brief Recurring SKU purchased by a user for themselves. Grants access to the purchasing user in every server. */ diff --git a/include/dpp/wsclient.h b/include/dpp/wsclient.h index c7cb3b143e..7f047fd6c6 100644 --- a/include/dpp/wsclient.h +++ b/include/dpp/wsclient.h @@ -37,6 +37,7 @@ enum websocket_protocol_t : uint8_t { * @brief JSON data, text, UTF-8 character set */ ws_json = 0, + /** * @brief Erlang Term Format (ETF) binary protocol */ @@ -65,12 +66,35 @@ enum ws_state : uint8_t { */ enum ws_opcode : uint8_t { - OP_CONTINUATION = 0x00, //!< Continuation - OP_TEXT = 0x01, //!< Text frame - OP_BINARY = 0x02, //!< Binary frame - OP_CLOSE = 0x08, //!< Close notification with close code - OP_PING = 0x09, //!< Low level ping - OP_PONG = 0x0a //!< Low level pong + /** + * @brief Continuation. + */ + OP_CONTINUATION = 0x00, + + /** + * @brief Text frame. + */ + OP_TEXT = 0x01, + + /** + * @brief Binary frame. + */ + OP_BINARY = 0x02, + + /** + * @brief Close notification with close code. + */ + OP_CLOSE = 0x08, + + /** + * @brief Low level ping. + */ + OP_PING = 0x09, + + /** + * @brief Low level pong. + */ + OP_PONG = 0x0a }; /** From 596e76ea2b0e8511f61a1ec4196bae497d1a6dc7 Mon Sep 17 00:00:00 2001 From: Archie Jaskowicz Date: Mon, 30 Oct 2023 12:59:13 +0000 Subject: [PATCH 2/5] refactor: renamed inner_emoji to component_emoji, changed select_menu and component to use it. (#974) --- include/dpp/message.h | 94 ++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/include/dpp/message.h b/include/dpp/message.h index f877bb2db6..bd1864f4f4 100644 --- a/include/dpp/message.h +++ b/include/dpp/message.h @@ -54,6 +54,43 @@ enum component_type : uint8_t { cot_channel_selectmenu = 8, }; +/** + * @brief An emoji for a component (select menus included). + * + * To set an emoji on your button, you must set one of either the name or id fields. + * The easiest way is to use the dpp::component::set_emoji method. + * + * @note This is a **very** scaled down version of dpp::emoji, we advise that you refrain from using this. + */ +struct component_emoji { + /** + * @brief The name of the emoji. + * + * For built in unicode emojis, set this to the + * actual unicode value of the emoji e.g. "😄" + * and not for example ":smile:" + */ + std::string name{""}; + + /** + * @brief The emoji ID value for emojis that are custom + * ones belonging to a guild. + * + * The same rules apply as with other emojis, + * that the bot must be on the guild where the emoji resides + * and it must be available for use + * (e.g. not disabled due to lack of boosts, etc) + */ + dpp::snowflake id{0}; + + /** + * @brief Is the emoji animated? + * + * @note Only applies to custom emojis. + */ + bool animated{false}; +}; + /** * @brief Types of text input */ @@ -135,35 +172,11 @@ struct DPP_EXPORT select_option : public json_interface { * @brief True if option is the default option */ bool is_default; + /** - * @brief Emoji definition. To set an emoji on your button - * you must set one of either the name or id fields. - * The easiest way is to use the component::set_emoji - * method. + * @brief The emoji for the select option. */ - struct inner_select_emoji { - /** - * @brief Set the name field to the name of the emoji. - * For built in unicode emojis, set this to the - * actual unicode value of the emoji e.g. "😄" - * and not for example ":smile:" - */ - std::string name; - /** - * @brief The emoji ID value for emojis that are custom - * ones belonging to a guild. The same rules apply - * as with other emojis, that the bot must be on - * the guild where the emoji resides and it must - * be available for use (e.g. not disabled due to - * lack of boosts etc) - */ - dpp::snowflake id = 0; - /** - * @brief True if the emoji is animated. Only applies to - * custom emojis. - */ - bool animated = false; - } emoji; + component_emoji emoji; /** * @brief Construct a new select option object @@ -340,31 +353,10 @@ class DPP_EXPORT component : public json_interface { */ std::variant value; - /** Emoji definition. To set an emoji on your button - * you must set one of either the name or id fields. - * The easiest way is to use the component::set_emoji - * method. + /** + * @brief The emoji for this component. */ - struct inner_emoji { - /** Set the name field to the name of the emoji. - * For built in unicode emojis, set this to the - * actual unicode value of the emoji e.g. "😄" - * and not for example ":smile:" - */ - std::string name; - /** The emoji ID value for emojis that are custom - * ones belonging to a guild. The same rules apply - * as with other emojis, that the bot must be on - * the guild where the emoji resides and it must - * be available for use (e.g. not disabled due to - * lack of boosts etc) - */ - dpp::snowflake id; - /** True if the emoji is animated. Only applies to - * custom emojis. - */ - bool animated; - } emoji; + component_emoji emoji; /** Constructor */ From 6622b25613fd3b380a07817b5c06b7f880c99da5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 09:00:08 -0400 Subject: [PATCH 3/5] build(deps): bump doxygen-awesome-css from `00a52f6` to `8cea9a0` (#976) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- doxygen-awesome-css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doxygen-awesome-css b/doxygen-awesome-css index 00a52f6c74..8cea9a073e 160000 --- a/doxygen-awesome-css +++ b/doxygen-awesome-css @@ -1 +1 @@ -Subproject commit 00a52f6c74065ffbd836cbd791ddfe8edf2836b8 +Subproject commit 8cea9a073ecd50a5b2c0958a3df100292d6c7374 From 3eaf6682712ad34b0089cfb501ad50746cb577a2 Mon Sep 17 00:00:00 2001 From: Archie Jaskowicz Date: Mon, 30 Oct 2023 13:00:41 +0000 Subject: [PATCH 4/5] style: refactored comments part 2 (#977) --- include/dpp/auditlog.h | 515 ++++++++--- include/dpp/channel.h | 346 ++++++-- include/dpp/collector.h | 54 +- include/dpp/colors.h | 1433 +++++++++++++++--------------- include/dpp/commandhandler.h | 54 +- include/dpp/discordevents.h | 66 +- include/dpp/discordvoiceclient.h | 11 + include/dpp/dispatcher.h | 305 +++++-- include/dpp/dtemplate.h | 13 +- include/dpp/emoji.h | 19 +- include/dpp/entitlement.h | 2 + include/dpp/etf.h | 196 ++-- include/dpp/event.h | 3 +- include/dpp/event_router.h | 17 +- 14 files changed, 1920 insertions(+), 1114 deletions(-) diff --git a/include/dpp/auditlog.h b/include/dpp/auditlog.h index f5cc599baa..90339ec331 100644 --- a/include/dpp/auditlog.h +++ b/include/dpp/auditlog.h @@ -33,117 +33,284 @@ namespace dpp { * @brief Defines types of audit log entry */ enum audit_type { - /// Guild update - aut_guild_update = 1, - /// Channel create - aut_channel_create = 10, - /// Channel update - aut_channel_update = 11, - /// Channel delete - aut_channel_delete = 12, - /// Channel overwrite create - aut_channel_overwrite_create = 13, - /// Channel overwrite update - aut_channel_overwrite_update = 14, - /// Channel overwrite delete - aut_channel_overwrite_delete = 15, - /// Channel member kick - aut_member_kick = 20, - /// Channel member prune - aut_member_prune = 21, - /// Channel member ban add - aut_member_ban_add = 22, - /// Channel member ban remove - aut_member_ban_remove = 23, - /// Guild member update - aut_member_update = 24, - /// Guild member role update - aut_member_role_update = 25, - /// Guild member move - aut_member_move = 26, - /// Guild member voice disconnect - aut_member_disconnect = 27, - /// Guild bot add - aut_bot_add = 28, - /// Guild role create - aut_role_create = 30, - /// Guild role update - aut_role_update = 31, - /// Guild role delete - aut_role_delete = 32, - /// Guild invite create - aut_invite_create = 40, - /// Guild invite update - aut_invite_update = 41, - /// Guild invite delete - aut_invite_delete = 42, - /// Guild webhook create - aut_webhook_create = 50, - /// Guild webhook update - aut_webhook_update = 51, - /// Guild webhook delete - aut_webhook_delete = 52, - /// Guild emoji create - aut_emoji_create = 60, - /// Guild emoji update - aut_emoji_update = 61, - /// Guild emoji delete - aut_emoji_delete = 62, - /// Guild message delete - aut_message_delete = 72, - /// Guild message bulk delete - aut_message_bulk_delete = 73, - /// Guild message pin - aut_message_pin = 74, - /// Guild message unpin - aut_message_unpin = 75, - /// Guild integration create - aut_integration_create = 80, - /// Guild integration update - aut_integration_update = 81, - /// Guild integration delete - aut_integration_delete = 82, - /// Stage instance create - aut_stage_instance_create = 83, - /// Stage instance update - aut_stage_instance_update = 84, - /// stage instance delete - aut_stage_instance_delete = 85, - /// Sticker create - aut_sticker_create = 90, - /// Sticker update - aut_sticker_update = 91, - /// Sticker delete - aut_sticker_delete = 92, - /// Scheduled event creation - aut_guild_scheduled_event_create = 100, - /// Scheduled event update - aut_guild_scheduled_event_update = 101, - /// Scheduled event deletion - aut_guild_scheduled_event_delete = 102, - /// Thread create - aut_thread_create = 110, - /// Thread update - aut_thread_update = 111, - /// Thread delete - aut_thread_delete = 112, - /// Application command permissions update - aut_appcommand_permission_update = 121, - /// Auto moderation rule creation - aut_automod_rule_create = 140, - /// Auto moderation rule update - aut_automod_rule_update = 141, - /// Auto moderation rule deletion - aut_automod_rule_delete = 142, - /// Message was blocked by Auto Moderation - aut_automod_block_message = 143, - /// Message was flagged by Auto Moderation - aut_automod_flag_to_channel = 144, - /// Member was timed out by Auto Moderation - aut_automod_user_communication_disabled = 145, - /// Creator monetization request was created + /** + * @brief Guild update + */ + aut_guild_update = 1, + + /** + * @brief Channel create + */ + aut_channel_create = 10, + + /** + * @brief Channel update + */ + aut_channel_update = 11, + + /** + * @brief Channel delete + */ + aut_channel_delete = 12, + + /** + * @brief Channel overwrite create + */ + aut_channel_overwrite_create = 13, + + /** + * @brief Channel overwrite update + */ + aut_channel_overwrite_update = 14, + + /** + * @brief Channel overwrite delete + */ + aut_channel_overwrite_delete = 15, + + /** + * @brief Channel member kick + */ + aut_member_kick = 20, + + /** + * @brief Channel member prune + */ + aut_member_prune = 21, + + /** + * @brief Channel member ban add + */ + aut_member_ban_add = 22, + + /** + * @brief Channel member ban remove + */ + aut_member_ban_remove = 23, + + /** + * @brief Guild member update + */ + aut_member_update = 24, + + /** + * @brief Guild member role update + */ + aut_member_role_update = 25, + + /** + * @brief Guild member move + */ + aut_member_move = 26, + + /** + * @brief Guild member voice disconnect + */ + aut_member_disconnect = 27, + + /** + * @brief Guild bot add + */ + aut_bot_add = 28, + + /** + * @brief Guild role create + */ + aut_role_create = 30, + + /** + * @brief Guild role update + */ + aut_role_update = 31, + + /** + * @brief Guild role delete + */ + aut_role_delete = 32, + + /** + * @brief Guild invite create + */ + aut_invite_create = 40, + + /** + * @brief Guild invite update + */ + aut_invite_update = 41, + + /** + * @brief Guild invite delete + */ + aut_invite_delete = 42, + + /** + * @brief Guild webhook create + */ + aut_webhook_create = 50, + + /** + * @brief Guild webhook update + */ + aut_webhook_update = 51, + + /** + * @brief Guild webhook delete + */ + aut_webhook_delete = 52, + + /** + * @brief Guild emoji create + */ + aut_emoji_create = 60, + + /** + * @brief Guild emoji update + */ + aut_emoji_update = 61, + + /** + * @brief Guild emoji delete + */ + aut_emoji_delete = 62, + + /** + * @brief Guild message delete + */ + aut_message_delete = 72, + + /** + * @brief Guild message bulk delete + */ + aut_message_bulk_delete = 73, + + /** + * @brief Guild message pin + */ + aut_message_pin = 74, + + /** + * @brief Guild message unpin + */ + aut_message_unpin = 75, + + /** + * @brief Guild integration create + */ + aut_integration_create = 80, + + /** + * @brief Guild integration update + */ + aut_integration_update = 81, + + /** + * @brief Guild integration delete + */ + aut_integration_delete = 82, + + /** + * @brief Stage instance create + */ + aut_stage_instance_create = 83, + + /** + * @brief Stage instance update + */ + aut_stage_instance_update = 84, + + /** + * @brief stage instance delete + */ + aut_stage_instance_delete = 85, + + /** + * @brief Sticker create + */ + aut_sticker_create = 90, + + /** + * @brief Sticker update + */ + aut_sticker_update = 91, + + /** + * @brief Sticker delete + */ + aut_sticker_delete = 92, + + /** + * @brief Scheduled event creation + */ + aut_guild_scheduled_event_create = 100, + + /** + * @brief Scheduled event update + */ + aut_guild_scheduled_event_update = 101, + + /** + * @brief Scheduled event deletion + */ + aut_guild_scheduled_event_delete = 102, + + /** + * @brief Thread create + */ + aut_thread_create = 110, + + /** + * @brief Thread update + */ + aut_thread_update = 111, + + /** + * @brief Thread delete + */ + aut_thread_delete = 112, + + /** + * @brief Application command permissions update + */ + aut_appcommand_permission_update = 121, + + /** + * @brief Auto moderation rule creation + */ + aut_automod_rule_create = 140, + + /** + * @brief Auto moderation rule update + */ + aut_automod_rule_update = 141, + + /** + * @brief Auto moderation rule deletion + */ + aut_automod_rule_delete = 142, + + /** + * @brief Message was blocked by Auto Moderation + */ + aut_automod_block_message = 143, + + /** + * @brief Message was flagged by Auto Moderation + */ + aut_automod_flag_to_channel = 144, + + /** + * @brief Member was timed out by Auto Moderation + */ + aut_automod_user_communication_disabled = 145, + + /** + * @brief Creator monetization request was created + */ aut_creator_monetization_request_created = 150, - /// Creator monetization terms were accepted + + /** + * @brief Creator monetization terms were accepted + */ aut_creator_monetization_terms_accepted = 151, }; @@ -151,32 +318,81 @@ enum audit_type { * @brief Defines audit log changes */ struct DPP_EXPORT audit_change { - /// Optional: Serialised new value of the change, e.g. for nicknames, the new nickname - std::string new_value; - /// Optional: Serialised old value of the change, e.g. for nicknames, the old nickname - std::string old_value; /** - * The property name that was changed, e.g. `nick` for nickname changes - * @note For dpp::aut_appcommand_permission_update updates the key is the id of the user, channel, role, or a permission constant that was updated instead of an actual property name + * @brief Optional: Serialised new value of the change, e.g. for nicknames, the new nickname. + */ + std::string new_value; + + /** + * @brief Optional: Serialised old value of the change, e.g. for nicknames, the old nickname. + */ + std::string old_value; + + /** + * @brief The property name that was changed (e.g. `nick` for nickname changes). + * @note For dpp::aut_appcommand_permission_update updates the key is the id of the user, channel, role, or a permission constant that was updated instead of an actual property name. */ - std::string key; + std::string key; }; /** * @brief Extra information for an audit log entry */ struct DPP_EXPORT audit_extra { - std::string automod_rule_name; //!< Name of the Auto Moderation rule that was triggered - std::string automod_rule_trigger_type; //!< Trigger type of the Auto Moderation rule that was triggered - std::string delete_member_days; //!< number of days after which inactive members were kicked - std::string members_removed; //!< number of members removed by the prune - snowflake channel_id; //!< channel in which the entities were targeted - snowflake message_id; //!< id of the message that was targeted - std::string count; //!< number of entities that were targeted - snowflake id; //!< id of the overwritten entity - std::string type; //!< type of overwritten entity - "0" for "role" or "1" for "member" - std::string role_name; //!< name of the role if type is "0" (not present if type is "1") - snowflake application_id; //!< ID of the app whose permissions were targeted + /** + * @brief Name of the Auto Moderation rule that was triggered. + */ + std::string automod_rule_name; + + /** + * @brief Trigger type of the Auto Moderation rule that was triggered. + */ + std::string automod_rule_trigger_type; + + /** + * @brief Number of days after which inactive members were kicked. + */ + std::string delete_member_days; + + /** + * @brief Number of members removed by the prune. + */ + std::string members_removed; + + /** + * @brief Channel in which the entities were targeted. + */ + snowflake channel_id; + + /** + * @brief ID of the message that was targeted. + */ + snowflake message_id; + + /** + * @brief Number of entities that were targeted. + */ + std::string count; + + /** + * @brief ID of the overwritten entity. + */ + snowflake id; + + /** + * @brief Type of overwritten entity - "0" for "role" or "1" for "member" + */ + std::string type; + + /** + * @brief Name of the role if type is "0" (not present if type is "1"). + */ + std::string role_name; + + /** + * @brief ID of the app whose permissions were targeted + */ + snowflake application_id; }; /** @@ -193,17 +409,41 @@ struct DPP_EXPORT audit_entry : public json_interface { audit_entry& fill_from_json_impl(nlohmann::json* j); public: - snowflake id; //!< id of the entry + /** + * @brief ID of the entry. + */ + snowflake id; + /** * ID of the affected entity (webhook, user, role, etc.) (may be empty) * @note For dpp::audit_type::aut_appcommand_permission_update updates, it's the command ID or the app ID */ - snowflake target_id; - std::vector changes; //!< Optional: changes made to the target_id - snowflake user_id; //!< the user or app that made the changes (may be empty) - audit_type type; //!< type of action that occurred - std::optional extra; //!< Optional: additional info for certain action types - std::string reason; //!< Optional: the reason for the change (1-512 characters) + snowflake target_id; + + /** + * @brief Optional: changes made to the target_id. + */ + std::vector changes; + + /** + * @brief The user or app that made the changes (may be empty). + */ + snowflake user_id; + + /** + * @brief Type of action that occurred. + */ + audit_type type; + + /** + * @brief Optional: additional info for certain action types. + */ + std::optional extra; + + /** + * @brief Optional: the reason for the change (1-512 characters). + */ + std::string reason; /** Constructor */ audit_entry(); @@ -226,7 +466,10 @@ class DPP_EXPORT auditlog : public json_interface { auditlog& fill_from_json_impl(nlohmann::json* j); public: - std::vector entries; //!< Audit log entries + /** + * @brief Audit log entries. + */ + std::vector entries; /** Constructor */ auditlog() = default; diff --git a/include/dpp/channel.h b/include/dpp/channel.h index 14c1d92396..59080ee0df 100644 --- a/include/dpp/channel.h +++ b/include/dpp/channel.h @@ -37,28 +37,81 @@ namespace dpp { /** @brief Flag integers as received from and sent to discord */ enum channel_type : uint8_t { - CHANNEL_TEXT = 0, //!< a text channel within a server - DM = 1, //!< a direct message between users - CHANNEL_VOICE = 2, //!< a voice channel within a server + /** + * @brief A text channel within a server. + */ + CHANNEL_TEXT = 0, + + /** + * @brief A direct message between users. + */ + DM = 1, + + /** + * @brief A voice channel within a server. + */ + CHANNEL_VOICE = 2, + /** * @brief a direct message between multiple users - * @deprecated this channel type was intended to be used with the now deprecated GameBridge SDK. Existing group dms with bots will continue to function, but newly created channels will be unusable + * @deprecated this channel type was intended to be used with the now deprecated GameBridge SDK. + * Existing group dms with bots will continue to function, but newly created channels will be unusable. */ - GROUP_DM = 3, - CHANNEL_CATEGORY = 4, //!< an organizational category that contains up to 50 channels - CHANNEL_ANNOUNCEMENT = 5, //!< a channel that users can follow and crosspost into their own server + GROUP_DM = 3, + /** - * @brief a channel in which game developers can sell their game on Discord - * @deprecated store channels are deprecated by Discord + * @brief An organizational category that contains up to 50 channels. */ - CHANNEL_STORE = 6, - CHANNEL_ANNOUNCEMENT_THREAD = 10, //!< a temporary sub-channel within a GUILD_ANNOUNCEMENT channel - CHANNEL_PUBLIC_THREAD = 11, //!< a temporary sub-channel within a GUILD_TEXT or GUILD_FORUM channel - CHANNEL_PRIVATE_THREAD = 12, //!< a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission - CHANNEL_STAGE = 13, //!< a "stage" channel, like a voice channel with one authorised speaker - CHANNEL_DIRECTORY = 14, //!< the channel in a [hub](https://support.discord.com/hc/en-us/articles/4406046651927-Discord-Student-Hubs-FAQ) containing the listed servers - CHANNEL_FORUM = 15, //!< forum channel that can only contain threads - CHANNEL_MEDIA = 16, //!< Media channel that can only contain threads, similar to forum channels + CHANNEL_CATEGORY = 4, + + /** + * @brief A channel that users can follow and cross-post into their own server. + */ + CHANNEL_ANNOUNCEMENT = 5, + + /** + * @brief A channel in which game developers can sell their game on Discord. + * @deprecated Store channels are deprecated by Discord. + */ + CHANNEL_STORE = 6, + + /** + * @brief A temporary sub-channel within a `GUILD_ANNOUNCEMENT` channel. + */ + CHANNEL_ANNOUNCEMENT_THREAD = 10, + + /** + * @brief A temporary sub-channel within a `GUILD_TEXT` or `GUILD_FORUM` channel. + */ + CHANNEL_PUBLIC_THREAD = 11, + + /** + * @brief A temporary sub-channel within a `GUILD_TEXT` channel + * that is only viewable by those invited and those with the `MANAGE_THREADS` permission. + */ + CHANNEL_PRIVATE_THREAD = 12, + + /** + * @brief A "stage" channel, like a voice channel with one authorised speaker. + */ + CHANNEL_STAGE = 13, + + /** + * @brief The channel in a hub containing the listed servers. + * + * @see https://support.discord.com/hc/en-us/articles/4406046651927-Discord-Student-Hubs-FAQ + */ + CHANNEL_DIRECTORY = 14, + + /** + * @brief Forum channel that can only contain threads. + */ + CHANNEL_FORUM = 15, + + /** + * @brief Media channel that can only contain threads, similar to forum channels. + */ + CHANNEL_MEDIA = 16, }; /** @brief Our flags as stored in the object @@ -68,18 +121,36 @@ enum channel_type : uint8_t { */ enum channel_flags : uint16_t { /* Note that bits 1 to 4 are used for the channel type mask */ - /// NSFW Gated Channel + /** + * @brief NSFW Gated Channel + */ c_nsfw = 0b0000000000010000, - /// Video quality forced to 720p + + /** + * @brief Video quality forced to 720p + */ c_video_quality_720p = 0b0000000000100000, - /// Lock permissions (only used when updating channel positions) + + /** + * @brief Lock permissions (only used when updating channel positions) + */ c_lock_permissions = 0b0000000001000000, - /// Thread is pinned to the top of its parent forum or media channel + + /** + * @brief Thread is pinned to the top of its parent forum or media channel + */ c_pinned_thread = 0b0000000010000000, - /// Whether a tag is required to be specified when creating a thread in a forum or a media channel. Tags are specified in the thread::applied_tags field. + + /** + * @brief Whether a tag is required to be specified when creating a thread in a forum or media channel. + * Tags are specified in the thread::applied_tags field. + */ c_require_tag = 0b0000000100000000, - /* Note that the 9th and 10th bit are used for the forum layout type */ - /// When set hides the embedded media download options. Available only for media channels + + /* Note that the 9th and 10th bit are used for the forum layout type. */ + /** + * @brief When set hides the embedded media download options. Available only for media channels + */ c_hide_media_download_options = 0b0001000000000000, }; @@ -87,9 +158,14 @@ enum channel_flags : uint16_t { * @brief Types for sort posts in a forum channel */ enum default_forum_sort_order_t : uint8_t { - /// Sort forum posts by activity (default) + /** + * @brief Sort forum posts by activity (default) + */ so_latest_activity = 0, - /// Sort forum posts by creation time (from most recent to oldest) + + /** + * @brief Sort forum posts by creation time (from most recent to oldest) + */ so_creation_date = 1, }; @@ -97,18 +173,34 @@ enum default_forum_sort_order_t : uint8_t { * @brief Types of forum layout views that indicates how the threads in a forum channel will be displayed for users by default */ enum forum_layout_type : uint8_t { - fl_not_set = 0, //!< No default has been set for the forum channel - fl_list_view = 1, //!< Display posts as a list - fl_gallery_view = 2, //!< Display posts as a collection of tiles + /** + * @brief No default has been set for the forum channel + */ + fl_not_set = 0, + + /** + * @brief Display posts as a list + */ + fl_list_view = 1, + + /** + * @brief Display posts as a collection of tiles + */ + fl_gallery_view = 2, }; /** * @brief channel permission overwrite types */ enum overwrite_type : uint8_t { - /// Role + /** + * @brief Role + */ ot_role = 0, - /// Member + + /** + * @brief Member + */ ot_member = 1 }; @@ -116,13 +208,24 @@ enum overwrite_type : uint8_t { * @brief Channel permission overwrites */ struct DPP_EXPORT permission_overwrite { - /// ID of the role or the member + /** + * @brief ID of the role or the member + */ snowflake id; - /// Bitmask of allowed permissions + + /** + * @brief Bitmask of allowed permissions + */ permission allow; - /// Bitmask of denied permissions + + /** + * @brief Bitmask of denied permissions + */ permission deny; - /// Type of overwrite. See dpp::overwrite_type + + /** + * @brief Type of overwrite. See dpp::overwrite_type + */ uint8_t type; /** @@ -145,15 +248,30 @@ struct DPP_EXPORT permission_overwrite { * @brief metadata for threads */ struct DPP_EXPORT thread_metadata { - /// Timestamp when the thread's archive status was last changed, used for calculating recent activity + /** + * @brief Timestamp when the thread's archive status was last changed, used for calculating recent activity. + */ time_t archive_timestamp; - /// The duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 + + /** + * @brief The duration in minutes to automatically archive the thread after recent activity (60, 1440, 4320, 10080). + */ uint16_t auto_archive_duration; - /// Whether a thread is archived + + /** + * @brief Whether a thread is archived + */ bool archived; - /// Whether a thread is locked. When a thread is locked, only users with `MANAGE_THREADS` can unarchive it + + /** + * @brief Whether a thread is locked. When a thread is locked, + * only users with `MANAGE_THREADS` can un-archive it. + */ bool locked; - /// Whether non-moderators can add other non-moderators. Only for private threads + + /** + * @brief Whether non-moderators can add other non-moderators. Only for private threads. + */ bool invitable; }; @@ -162,13 +280,24 @@ struct DPP_EXPORT thread_metadata { * Defined as an enum to fit into 1 byte. Internally it'll be translated to minutes to match the API */ enum auto_archive_duration_t : uint8_t { - /// Auto archive duration of 1 hour. (60 minutes) + /** + * @brief Auto archive duration of 1 hour (60 minutes). + */ arc_1_hour = 1, - /// Auto archive duration of 1 day. (1440 minutes) + + /** + * @brief Auto archive duration of 1 day (1440 minutes). + */ arc_1_day = 2, - /// Auto archive duration of 3 days. (4320 minutes) + + /** + * @brief Auto archive duration of 3 days (4320 minutes). + */ arc_3_days = 3, - /// Auto archive duration of 1 week. (10080 minutes) + + /** + * @brief Auto archive duration of 1 week (10080 minutes). + */ arc_1_week = 4, }; @@ -187,13 +316,24 @@ struct DPP_EXPORT thread_member : public json_interface { thread_member& fill_from_json_impl(nlohmann::json* j); public: - /// ID of the thread member is part of + /** + * @brief ID of the thread member is part of. + */ snowflake thread_id; - /// ID of the member + + /** + * @brief ID of the member. + */ snowflake user_id; - /// The time when user last joined the thread + + /** + * @brief The time when user last joined the thread. + */ time_t joined; - /// Any user-thread settings, currently only used for notifications + + /** + * @brief Any user-thread settings, currently only used for notifications. + */ uint32_t flags; }; @@ -220,11 +360,21 @@ struct DPP_EXPORT forum_tag : public managed, public json_interface { json to_json_impl(bool with_id = false) const; public: - /** The name of the tag (0-20 characters) */ + /** + * @brief The name of the tag (0-20 characters). + */ std::string name; - /** The emoji of the tag. Contains either nothing, the id of a guild's custom emoji or the unicode character of the emoji */ + + /** + * @brief The emoji of the tag. + * Contains either nothing, the id of a guild's custom emoji or the unicode character of the emoji. + */ std::variant emoji; - /** Whether this tag can only be added to or removed from threads by a member with the `MANAGE_THREADS` permission */ + + /** + * @brief Whether this tag can only be added to or removed from threads + * by a member with the `MANAGE_THREADS` permission. + */ bool moderated; /** Constructor */ @@ -280,50 +430,72 @@ class DPP_EXPORT channel : public managed, public json_interface { virtual json to_json_impl(bool with_id = false) const; public: - /** Channel name (1-100 characters) */ + /** + * @brief Channel name (1-100 characters). + */ std::string name; - /** Channel topic (0-4096 characters for forum and media channels, 0-1024 characters for all others) */ + /** + * @brief Channel topic (0-4096 characters for forum and media channels, 0-1024 characters for all others). + */ std::string topic; /** - * @brief Voice region if set for voice channel, otherwise empty string + * @brief Voice region if set for voice channel, otherwise empty string. */ std::string rtc_region; - /** DM recipients */ + /** + * @brief DM recipients. + */ std::vector recipients; - /** Permission overwrites to apply to base permissions */ + /** + * @brief Permission overwrites to apply to base permissions. + */ std::vector permission_overwrites; - /** A set of tags that can be used in a forum or media channel */ + /** + * @brief A set of tags that can be used in a forum or media channel. + */ std::vector available_tags; /** * @brief The emoji to show as the default reaction button on a thread in a forum or media channel. - * Contains either nothing, the id of a guild's custom emoji or the unicode character of the emoji + * Contains either nothing, the id of a guild's custom emoji or the unicode character of the emoji. */ std::variant default_reaction; /** - * @brief Channel icon (for group DMs) + * @brief Channel icon (for group DMs). */ utility::iconhash icon; - /** User ID of the creator for group DMs or threads */ + /** + * @brief User ID of the creator for group DMs or threads. + */ snowflake owner_id; - /** Parent ID (for guild channels: id of the parent category, for threads: id of the text channel this thread was created) */ + /** + * @brief Parent ID (for guild channels: id of the parent category, for threads: id of the text channel this thread was created). + */ snowflake parent_id; - /** Guild id of the guild that owns the channel */ + /** + * @brief Guild id of the guild that owns the channel. + */ snowflake guild_id; - /** ID of last message to be sent to the channel (may not point to an existing or valid message or thread) */ + /** + * @brief ID of last message to be sent to the channel. + * + * @warning may not point to an existing or valid message/thread. + */ snowflake last_message_id; - /** Timestamp of last pinned message */ + /** + * @brief Timestamp of last pinned message. + */ time_t last_pin_timestamp; /** @@ -334,31 +506,47 @@ class DPP_EXPORT channel : public managed, public json_interface { */ permission permissions; - /** Sorting position, lower number means higher up the list */ + /** + * @brief Sorting position, lower number means higher up the list + */ uint16_t position; - /** the bitrate (in kilobits) of the voice channel */ + /** + * @brief The bitrate (in kilobits) of the voice channel. + */ uint16_t bitrate; - /** amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected*/ + /** + * @brief Amount of seconds a user has to wait before sending another message (0-21600). + * Bots, as well as users with the permission manage_messages or manage_channel, are unaffected + */ uint16_t rate_limit_per_user; - /** The initial `rate_limit_per_user` to set on newly created threads in a channel. This field is copied to the thread at creation time and does not live update */ + /** + * @brief The initial `rate_limit_per_user` to set on newly created threads in a channel. + * This field is copied to the thread at creation time and does not live update. + */ uint16_t default_thread_rate_limit_per_user; /** * @brief Default duration, copied onto newly created threads. Used by the clients, not the API. - * Threads will stop showing in the channel list after the specified period of inactivity. Defaults to dpp::arc_1_day + * Threads will stop showing in the channel list after the specified period of inactivity. Defaults to dpp::arc_1_day. */ auto_archive_duration_t default_auto_archive_duration; - /** the default sort order type used to order posts in forum and media channels */ + /** + * @brief The default sort order type used to order posts in forum and media channels. + */ default_forum_sort_order_t default_sort_order; - /** Flags bitmap (dpp::channel_flags) */ + /** + * @brief Flags bitmap (dpp::channel_flags) + */ uint16_t flags; - /** Maximum user limit for voice channels (0-99) */ + /** + * @brief Maximum user limit for voice channels (0-99) + */ uint8_t user_limit; /** Constructor */ @@ -781,14 +969,18 @@ class DPP_EXPORT thread : public channel, public json_interface { */ thread_member member; - /** Thread metadata (threads) */ + /** + * @brief Thread metadata (threads) + */ thread_metadata metadata; - /** Created message. Only filled within the cluster::thread_create_in_forum() method */ + /** + * @brief Created message. Only filled within the cluster::thread_create_in_forum() method + */ message msg; /** - * A list of dpp::forum_tag IDs that have been applied to a thread in a forum or media channel + * @brief A list of dpp::forum_tag IDs that have been applied to a thread in a forum or media channel. */ std::vector applied_tags; @@ -804,7 +996,9 @@ class DPP_EXPORT thread : public channel, public json_interface { */ uint8_t message_count; - /** Approximate count of members in a thread (stops counting at 50) */ + /** + * @brief Approximate count of members in a thread (stops counting at 50) + */ uint8_t member_count; /** diff --git a/include/dpp/collector.h b/include/dpp/collector.h index 4e388971c4..ac09bf95a6 100644 --- a/include/dpp/collector.h +++ b/include/dpp/collector.h @@ -55,14 +55,24 @@ namespace dpp { template class collector { protected: - /// Owning cluster + /** + * @brief Owning cluster. + */ class cluster* owner; private: - /// Timed listener + /** + * @brief Timed listener. + */ timed_listener, std::function>* tl; - /// stored list + + /** + * @brief Stored list. + */ std::vector stored; - /// Trigger flag + + /** + * @brief Trigger flag. + */ bool triggered; public: /** @@ -153,17 +163,34 @@ template class collector */ class collected_reaction : public managed { public: - /// Reacting user + /** + * @brief Reacting user. + */ user react_user; - /// Reacting guild + + /** + * @brief Reacting guild. + */ guild* react_guild{}; - /// Reacting guild member + + /** + * @brief Reacting guild member. + */ guild_member react_member; - /// Reacting channel + + /** + * @brief Reacting channel. + */ channel* react_channel{}; - /// Reacted emoji + + /** + * @brief Reacted emoji. + */ emoji react_emoji; - /// ID of the user who authored the message which was reacted to (Optional) + + /** + * @brief Optional: ID of the user who authored the message which was reacted to. + */ snowflake message_author_id{}; }; @@ -239,7 +266,14 @@ class message_collector : public message_collector_t { * Collects message reactions during a set timeframe and returns them in a list via the completed() method. */ class reaction_collector : public reaction_collector_t { + /** + * @brief The ID of the message. + */ snowflake message_id; + + /** + * @brief The reaction. + */ collected_reaction react; public: /** diff --git a/include/dpp/colors.h b/include/dpp/colors.h index d5f642402a..7a2c90b957 100644 --- a/include/dpp/colors.h +++ b/include/dpp/colors.h @@ -22,723 +22,724 @@ #include - /** - * @brief The main namespace for D++ functions. classes and types +/** + * @brief The main namespace for D++ functions. classes and types */ namespace dpp { - /** - * @brief predefined color constants - */ - namespace colors { - const uint32_t - white = 0xFFFFFF, - discord_white = 0xFFFFFE, - light_gray = 0xC0C0C0, - gray = 0x808080, - dark_gray = 0x404040, - black = 0x000000, - discord_black = 0x000001, - red = 0xFF0000, - pink = 0xFFAFAF, - orange = 0xFFC800, - yellow = 0xFFFF00, - green = 0x00FF00, - magenta = 0xFF00FF, - cyan = 0x00FFFF, - blue = 0x0000FF, - light_sea_green = 0x1ABC9C, - medium_sea_green = 0x2ECC71, - summer_sky = 0x3498DB, - deep_lilac = 0x9B59B6, - ruby = 0xE91E63, - moon_yellow = 0xF1C40F, - tahiti_gold = 0xE67E22, - cinnabar = 0xE74C3C, - submarine = 0x95A5A6, - blue_aquamarine = 0x607D8B, - deep_sea = 0x11806A, - sea_green = 0x1F8B4C, - endeavour = 0x206694, - vivid_violet = 0x71368A, - jazzberry_jam = 0xAD1457, - dark_goldenrod = 0xC27C0E, - rust = 0xA84300, - brown = 0x992D22, - gray_chateau = 0x979C9F, - bismark = 0x546E7A, - sti_blue = 0x0E4BEF, - wrx_blue = 0x00247D, - rallyart_crimson = 0xE60012, - lime = 0x00FF00, - forest_green = 0x228B22, - cadmium_green = 0x097969, - aquamarine = 0x7FFFD4, - blue_green = 0x088F8F, - raspberry = 0xE30B5C, - scarlet_red = 0xFF2400, - night = 0x0C090A, - charcoal = 0x34282C, - oil = 0x3B3131, - light_black = 0x454545, - black_cat = 0x413839, - iridium = 0x3D3C3A, - black_eel = 0x463E3F, - black_cow = 0x4C4646, - gray_wolf = 0x504A4B, - grey_wolf = 0x504A4B, - vampire_gray = 0x565051, - vampire_grey = 0x565051, - iron_gray = 0x52595D, - iron_grey = 0x52595D, - gray_dolphin = 0x5C5858, - grey_dolphin = 0x5C5858, - carbon_gray = 0x625D5D, - carbon_grey = 0x625D5D, - ash_gray = 0x666362, - ash_grey = 0x666362, - dim_gray = 0x696969, - dim_grey = 0x696969, - nardo_gray = 0x686A6C, - nardo_grey = 0x686A6C, - cloudy_gray = 0x6D6968, - cloudy_grey = 0x6D6968, - smokey_gray = 0x726E6D, - smokey_grey = 0x726E6D, - alien_gray = 0x736F6E, - alien_grey = 0x736F6E, - sonic_silver = 0x757575, - platinum_gray = 0x797979, - platinum_grey = 0x797979, - granite = 0x837E7C, - battleship_gray = 0x848482, - battleship_grey = 0x848482, - gunmetal_gray = 0x8D918D, - gunmetal_grey = 0x8D918D, - gray_cloud = 0xB6B6B4, - grey_cloud = 0xB6B6B4, - silver = 0xC0C0C0, - pale_silver = 0xC9C0BB, - gray_goose = 0xD1D0CE, - grey_goose = 0xD1D0CE, - platinum_silver = 0xCECECE, - silver_white = 0xDADBDD, - gainsboro = 0xDCDCDC, - platinum = 0xE5E4E2, - metallic_silver = 0xBCC6CC, - blue_gray = 0x98AFC7, - blue_grey = 0x98AFC7, - roman_silver = 0x838996, - light_slate_gray = 0x778899, - light_slate_grey = 0x778899, - slate_gray = 0x708090, - slate_grey = 0x708090, - rat_gray = 0x6D7B8D, - slate_granite_gray = 0x657383, - slate_granite_grey = 0x657383, - jet_gray = 0x616D7E, - jet_grey = 0x616D7E, - mist_blue = 0x646D7E, - marble_blue = 0x566D7E, - slate_blue_grey = 0x737CA1, - slate_blue_gray = 0x737CA1, - light_purple_blue = 0x728FCE, - azure_blue = 0x4863A0, - blue_jay = 0x2B547E, - charcoal_blue = 0x36454F, - dark_blue_grey = 0x29465B, - dark_slate = 0x2B3856, - deep_sea_blue = 0x123456, - night_blue = 0x151B54, - midnight_blue = 0x191970, - navy = 0x000080, - denim_dark_blue = 0x151B8D, - dark_blue = 0x00008B, - lapis_blue = 0x15317E, - new_midnight_blue = 0x0000A0, - earth_blue = 0x0000A5, - cobalt_blue = 0x0020C2, - medium_blue = 0x0000CD, - blueberry_blue = 0x0041C2, - canary_blue = 0x2916F5, - samco_blue = 0x0002FF, - bright_blue = 0x0909FF, - blue_orchid = 0x1F45FC, - sapphire_blue = 0x2554C7, - blue_eyes = 0x1569C7, - bright_navy_blue = 0x1974D2, - balloon_blue = 0x2B60DE, - royal_blue = 0x4169E1, - ocean_blue = 0x2B65EC, - blue_ribbon = 0x306EFF, - blue_dress = 0x157DEC, - neon_blue = 0x1589FF, - dodger_blue = 0x1E90FF, - glacial_blue_ice = 0x368BC1, - steel_blue = 0x4682B4, - silk_blue = 0x488AC7, - windows_blue = 0x357EC7, - blue_ivy = 0x3090C7, - blue_koi = 0x659EC7, - columbia_blue = 0x87AFC7, - baby_blue = 0x95B9C7, - cornflower_blue = 0x6495ED, - sky_blue_dress = 0x6698FF, - iceberg = 0x56A5EC, - butterfly_blue = 0x38ACEC, - deep_sky_blue = 0x00BFFF, - midday_blue = 0x3BB9FF, - crystal_blue = 0x5CB3FF, - denim_blue = 0x79BAEC, - day_sky_blue = 0x82CAFF, - light_sky_blue = 0x87CEFA, - sky_blue = 0x87CEEB, - jeans_blue = 0xA0CFEC, - blue_angel = 0xB7CEEC, - pastel_blue = 0xB4CFEC, - light_day_blue = 0xADDFFF, - sea_blue = 0xC2DFFF, - heavenly_blue = 0xC6DEFF, - robin_egg_blue = 0xBDEDFF, - powder_blue = 0xB0E0E6, - coral_blue = 0xAFDCEC, - light_blue = 0xADD8E6, - light_steel_blue = 0xB0CFDE, - gulf_blue = 0xC9DFEC, - pastel_light_blue = 0xD5D6EA, - lavender_blue = 0xE3E4FA, - white_blue = 0xDBE9FA, - lavender = 0xE6E6FA, - water = 0xEBF4FA, - alice_blue = 0xF0F8FF, - ghost_white = 0xF8F8FF, - azure = 0xF0FFFF, - light_cyan = 0xE0FFFF, - light_slate = 0xCCFFFF, - electric_blue = 0x9AFEFF, - tron_blue = 0x7DFDFE, - blue_zircon = 0x57FEFF, - aqua = 0x00FFFF, - bright_cyan = 0x0AFFFF, - celeste = 0x50EBEC, - blue_diamond = 0x4EE2EC, - bright_turquoise = 0x16E2F5, - blue_lagoon = 0x8EEBEC, - pale_turquoise = 0xAFEEEE, - pale_blue_lily = 0xCFECEC, - light_teal = 0xB3D9D9, - tiffany_blue = 0x81D8D0, - blue_hosta = 0x77BFC7, - cyan_opaque = 0x92C7C7, - northern_lights_blue = 0x78C7C7, - medium_aquamarine = 0x66CDAA, - magic_mint = 0xAAF0D1, - light_aquamarine = 0x93FFE8, - bright_teal = 0x01F9C6, - turquoise = 0x40E0D0, - medium_turquoise = 0x48D1CC, - deep_turquoise = 0x48CCCD, - jellyfish = 0x46C7C7, - blue_turquoise = 0x43C6DB, - dark_turquoise = 0x00CED1, - macaw_blue_green = 0x43BFC7, - seafoam_green = 0x3EA99F, - cadet_blue = 0x5F9EA0, - blue_chill = 0x3B9C9C, - dark_cyan = 0x008B8B, - teal_green = 0x00827F, - teal = 0x008080, - teal_blue = 0x007C80, - medium_teal = 0x045F5F, - dark_teal = 0x045D5D, - deep_teal = 0x033E3E, - dark_slate_gray = 0x25383C, - dark_slate_grey = 0x25383C, - gunmetal = 0x2C3539, - blue_moss_green = 0x3C565B, - beetle_green = 0x4C787E, - grayish_turquoise = 0x5E7D7E, - greenish_blue = 0x307D7E, - aquamarine_stone = 0x348781, - sea_turtle_green = 0x438D80, - dull_sea_green = 0x4E8975, - dark_green_blue = 0x1F6357, - deep_sea_green = 0x306754, - bottle_green = 0x006A4E, - elf_green = 0x1B8A6B, - dark_mint = 0x31906E, - jade = 0x00A36C, - earth_green = 0x34A56F, - chrome_green = 0x1AA260, - emerald = 0x50C878, - mint = 0x3EB489, - metallic_green = 0x7C9D8E, - camouflage_green = 0x78866B, - sage_green = 0x848B79, - hazel_green = 0x617C58, - venom_green = 0x728C00, - olive_drab = 0x6B8E23, - olive = 0x808000, - dark_olive_green = 0x556B2F, - military_green = 0x4E5B31, - green_leaves = 0x3A5F0B, - army_green = 0x4B5320, - fern_green = 0x667C26, - fall_forest_green = 0x4E9258, - irish_green = 0x08A04B, - pine_green = 0x387C44, - medium_forest_green = 0x347235, - jungle_green = 0x347C2C, - cactus_green = 0x227442, - dark_green = 0x006400, - deep_green = 0x056608, - deep_emerald_green = 0x046307, - hunter_green = 0x355E3B, - dark_forest_green = 0x254117, - lotus_green = 0x004225, - seaweed_green = 0x437C17, - shamrock_green = 0x347C17, - green_onion = 0x6AA121, - moss_green = 0x8A9A5B, - grass_green = 0x3F9B0B, - green_pepper = 0x4AA02C, - dark_lime_green = 0x41A317, - parrot_green = 0x12AD2B, - clover_green = 0x3EA055, - dinosaur_green = 0x73A16C, - green_snake = 0x6CBB3C, - alien_green = 0x6CC417, - green_apple = 0x4CC417, - lime_green = 0x32CD32, - pea_green = 0x52D017, - kelly_green = 0x4CC552, - zombie_green = 0x54C571, - green_peas = 0x89C35C, - dollar_bill_green = 0x85BB65, - frog_green = 0x99C68E, - turquoise_green = 0xA0D6B4, - dark_sea_green = 0x8FBC8F, - basil_green = 0x829F82, - gray_green = 0xA2AD9C, - iguana_green = 0x9CB071, - citron_green = 0x8FB31D, - acid_green = 0xB0BF1A, - avocado_green = 0xB2C248, - pistachio_green = 0x9DC209, - salad_green = 0xA1C935, - yellow_green = 0x9ACD32, - pastel_green = 0x77DD77, - hummingbird_green = 0x7FE817, - nebula_green = 0x59E817, - stoplight_go_green = 0x57E964, - neon_green = 0x16F529, - jade_green = 0x5EFB6E, - lime_mint_green = 0x36F57F, - spring_green = 0x00FF7F, - medium_spring_green = 0x00FA9A, - emerald_green = 0x5FFB17, - lawn_green = 0x7CFC00, - bright_green = 0x66FF00, - chartreuse = 0x7FFF00, - yellow_lawn_green = 0x87F717, - aloe_vera_green = 0x98F516, - dull_green_yellow = 0xB1FB17, - lemon_green = 0xADF802, - green_yellow = 0xADFF2F, - chameleon_green = 0xBDF516, - neon_yellow_green = 0xDAEE01, - yellow_green_grosbeak = 0xE2F516, - tea_green = 0xCCFB5D, - slime_green = 0xBCE954, - algae_green = 0x64E986, - light_green = 0x90EE90, - dragon_green = 0x6AFB92, - pale_green = 0x98FB98, - mint_green = 0x98FF98, - green_thumb = 0xB5EAAA, - organic_brown = 0xE3F9A6, - light_jade = 0xC3FDB8, - light_mint_green = 0xC2E5D3, - light_rose_green = 0xDBF9DB, - chrome_white = 0xE8F1D4, - honeydew = 0xF0FFF0, - mint_cream = 0xF5FFFA, - lemon_chiffon = 0xFFFACD, - parchment = 0xFFFFC2, - cream = 0xFFFFCC, - cream_white = 0xFFFDD0, - light_goldenrod_yellow = 0xFAFAD2, - light_yellow = 0xFFFFE0, - beige = 0xF5F5DC, - cornsilk = 0xFFF8DC, - blonde = 0xFBF6D9, - champagne = 0xF7E7CE, - antique_white = 0xFAEBD7, - papaya_whip = 0xFFEFD5, - blanched_almond = 0xFFEBCD, - bisque = 0xFFE4C4, - wheat = 0xF5DEB3, - moccasin = 0xFFE4B5, - peach = 0xFFE5B4, - light_orange = 0xFED8B1, - peach_puff = 0xFFDAB9, - coral_peach = 0xFBD5AB, - navajo_white = 0xFFDEAD, - golden_blonde = 0xFBE7A1, - golden_silk = 0xF3E3C3, - dark_blonde = 0xF0E2B6, - light_gold = 0xF1E5AC, - vanilla = 0xF3E5AB, - tan_brown = 0xECE5B6, - dirty_white = 0xE8E4C9, - pale_goldenrod = 0xEEE8AA, - khaki = 0xF0E68C, - cardboard_brown = 0xEDDA74, - harvest_gold = 0xEDE275, - sun_yellow = 0xFFE87C, - corn_yellow = 0xFFF380, - pastel_yellow = 0xFAF884, - neon_yellow = 0xFFFF33, - canary_yellow = 0xFFEF00, - banana_yellow = 0xF5E216, - mustard_yellow = 0xFFDB58, - golden_yellow = 0xFFDF00, - bold_yellow = 0xF9DB24, - rubber_ducky_yellow = 0xFFD801, - gold = 0xFFD700, - bright_gold = 0xFDD017, - chrome_gold = 0xFFCE44, - golden_brown = 0xEAC117, - deep_yellow = 0xF6BE00, - macaroni_and_cheese = 0xF2BB66, - saffron = 0xFBB917, - neon_gold = 0xFDBD01, - beer = 0xFBB117, - yellow_orange = 0xFFAE42, - orange_yellow = 0xFFAE42, - cantaloupe = 0xFFA62F, - cheese_orange = 0xFFA600, - brown_sand = 0xEE9A4D, - sandy_brown = 0xF4A460, - brown_sugar = 0xE2A76F, - camel_brown = 0xC19A6B, - deer_brown = 0xE6BF83, - burly_wood = 0xDEB887, - tan = 0xD2B48C, - light_french_beige = 0xC8AD7F, - sand = 0xC2B280, - sage = 0xBCB88A, - fall_leaf_brown = 0xC8B560, - ginger_brown = 0xC9BE62, - bronze_gold = 0xC9AE5D, - dark_khaki = 0xBDB76B, - olive_green = 0xBAB86C, - brass = 0xB5A642, - cookie_brown = 0xC7A317, - metallic_gold = 0xD4AF37, - bee_yellow = 0xE9AB17, - school_bus_yellow = 0xE8A317, - goldenrod = 0xDAA520, - orange_gold = 0xD4A017, - caramel = 0xC68E17, - cinnamon = 0xC58917, - peru = 0xCD853F, - bronze = 0xCD7F32, - tiger_orange = 0xC88141, - copper = 0xB87333, - dark_gold = 0xAA6C39, - metallic_bronze = 0xA97142, - dark_almond = 0xAB784E, - wood = 0x966F33, - oak_brown = 0x806517, - antique_bronze = 0x665D1E, - hazel = 0x8E7618, - dark_yellow = 0x8B8000, - dark_moccasin = 0x827839, - khaki_green = 0x8A865D, - millennium_jade = 0x93917C, - dark_beige = 0x9F8C76, - bullet_shell = 0xAF9B60, - army_brown = 0x827B60, - sandstone = 0x786D5F, - taupe = 0x483C32, - mocha = 0x493D26, - milk_chocolate = 0x513B1C, - gray_brown = 0x3D3635, - dark_coffee = 0x3B2F2F, - old_burgundy = 0x43302E, - western_charcoal = 0x49413F, - bakers_brown = 0x5C3317, - dark_brown = 0x654321, - sepia_brown = 0x704214, - dark_bronze = 0x804A00, - coffee = 0x6F4E37, - brown_bear = 0x835C3B, - red_dirt = 0x7F5217, - sepia = 0x7F462C, - sienna = 0xA0522D, - saddle_brown = 0x8B4513, - dark_sienna = 0x8A4117, - sangria = 0x7E3817, - blood_red = 0x7E3517, - chestnut = 0x954535, - coral_brown = 0x9E4638, - chestnut_red = 0xC34A2C, - mahogany = 0xC04000, - red_gold = 0xEB5406, - red_fox = 0xC35817, - dark_bisque = 0xB86500, - light_brown = 0xB5651D, - petra_gold = 0xB76734, - copper_red = 0xCB6D51, - orange_salmon = 0xC47451, - chocolate = 0xD2691E, - sedona = 0xCC6600, - papaya_orange = 0xE56717, - halloween_orange = 0xE66C2C, - neon_orange = 0xFF6700, - bright_orange = 0xFF5F1F, - pumpkin_orange = 0xF87217, - carrot_orange = 0xF88017, - dark_orange = 0xFF8C00, - construction_cone_orange = 0xF87431, - indian_saffron = 0xFF7722, - sunrise_orange = 0xE67451, - mango_orange = 0xFF8040, - coral = 0xFF7F50, - basket_ball_orange = 0xF88158, - light_salmon_rose = 0xF9966B, - light_salmon = 0xFFA07A, - dark_salmon = 0xE9967A, - tangerine = 0xE78A61, - light_copper = 0xDA8A67, - salmon_pink = 0xFF8674, - salmon = 0xFA8072, - peach_pink = 0xF98B88, - light_coral = 0xF08080, - pastel_red = 0xF67280, - pink_coral = 0xE77471, - bean_red = 0xF75D59, - valentine_red = 0xE55451, - indian_red = 0xCD5C5C, - tomato = 0xFF6347, - shocking_orange = 0xE55B3C, - orange_red = 0xFF4500, - neon_red = 0xFD1C03, - ruby_red = 0xF62217, - ferrari_red = 0xF70D1A, - fire_engine_red = 0xF62817, - lava_red = 0xE42217, - love_red = 0xE41B17, - grapefruit = 0xDC381F, - cherry_red = 0xC24641, - chilli_pepper = 0xC11B17, - fire_brick = 0xB22222, - tomato_sauce_red = 0xB21807, - carbon_red = 0xA70D2A, - cranberry = 0x9F000F, - saffron_red = 0x931314, - crimson_red = 0x990000, - red_wine = 0x990012, - wine_red = 0x990012, - dark_red = 0x8B0000, - maroon = 0x800000, - burgundy = 0x8C001A, - vermilion = 0x7E191B, - deep_red = 0x800517, - red_blood = 0x660000, - blood_night = 0x551606, - dark_scarlet = 0x560319, - black_bean = 0x3D0C02, - chocolate_brown = 0x3F000F, - midnight = 0x2B1B17, - purple_lily = 0x550A35, - purple_maroon = 0x810541, - plum_pie = 0x7D0541, - plum_velvet = 0x7D0552, - dark_raspberry = 0x872657, - velvet_maroon = 0x7E354D, - rosy_finch = 0x7F4E52, - dull_purple = 0x7F525D, - puce = 0x7F5A58, - rose_dust = 0x997070, - pastel_brown = 0xB1907F, - rosy_pink = 0xB38481, - rosy_brown = 0xBC8F8F, - khaki_rose = 0xC5908E, - lipstick_pink = 0xC48793, - pink_brown = 0xC48189, - old_rose = 0xC08081, - dusty_pink = 0xD58A94, - pink_daisy = 0xE799A3, - rose = 0xE8ADAA, - dusty_rose = 0xC9A9A6, - silver_pink = 0xC4AEAD, - gold_pink = 0xE6C7C2, - rose_gold = 0xECC5C0, - deep_peach = 0xFFCBA4, - pastel_orange = 0xF8B88B, - desert_sand = 0xEDC9AF, - unbleached_silk = 0xFFDDCA, - pig_pink = 0xFDD7E4, - pale_pink = 0xF2D4D7, - blush = 0xFFE6E8, - misty_rose = 0xFFE4E1, - pink_bubble_gum = 0xFFDFDD, - light_rose = 0xFBCFCD, - light_red = 0xFFCCCB, - warm_pink = 0xF6C6BD, - deep_rose = 0xFBBBB9, - light_pink = 0xFFB6C1, - soft_pink = 0xFFB8BF, - donut_pink = 0xFAAFBE, - baby_pink = 0xFAAFBA, - flamingo_pink = 0xF9A7B0, - pastel_pink = 0xFEA3AA, - rose_pink = 0xE7A1B0, - pink_rose = 0xE7A1B0, - cadillac_pink = 0xE38AAE, - carnation_pink = 0xF778A1, - pastel_rose = 0xE5788F, - blush_red = 0xE56E94, - pale_violet_red = 0xDB7093, - purple_pink = 0xD16587, - tulip_pink = 0xC25A7C, - bashful_pink = 0xC25283, - dark_pink = 0xE75480, - dark_hot_pink = 0xF660AB, - hot_pink = 0xFF69B4, - watermelon_pink = 0xFC6C85, - violet_red = 0xF6358A, - hot_deep_pink = 0xF52887, - bright_pink = 0xFF007F, - deep_pink = 0xFF1493, - neon_pink = 0xF535AA, - chrome_pink = 0xFF33AA, - neon_hot_pink = 0xFD349C, - pink_cupcake = 0xE45E9D, - royal_pink = 0xE759AC, - dimorphotheca_magenta = 0xE3319D, - pink_lemonade = 0xE4287C, - red_pink = 0xFA2A55, - crimson = 0xDC143C, - bright_maroon = 0xC32148, - rose_red = 0xC21E56, - rogue_pink = 0xC12869, - burnt_pink = 0xC12267, - pink_violet = 0xCA226B, - magenta_pink = 0xCC338B, - medium_violet_red = 0xC71585, - dark_carnation_pink = 0xC12283, - raspberry_purple = 0xB3446C, - pink_plum = 0xB93B8F, - orchid = 0xDA70D6, - deep_mauve = 0xDF73D4, - violet = 0xEE82EE, - fuchsia_pink = 0xFF77FF, - bright_neon_pink = 0xF433FF, - fuchsia = 0xFF00FF, - crimson_purple = 0xE238EC, - heliotrope_purple = 0xD462FF, - tyrian_purple = 0xC45AEC, - medium_orchid = 0xBA55D3, - purple_flower = 0xA74AC7, - orchid_purple = 0xB048B5, - rich_lilac = 0xB666D2, - pastel_violet = 0xD291BC, - mauve_taupe = 0x915F6D, - viola_purple = 0x7E587E, - eggplant = 0x614051, - plum_purple = 0x583759, - grape = 0x5E5A80, - purple_navy = 0x4E5180, - slate_blue = 0x6A5ACD, - blue_lotus = 0x6960EC, - blurple = 0x5865F2, - light_slate_blue = 0x736AFF, - medium_slate_blue = 0x7B68EE, - periwinkle_purple = 0x7575CF, - very_peri = 0x6667AB, - bright_grape = 0x6F2DA8, - purple_amethyst = 0x6C2DC7, - bright_purple = 0x6A0DAD, - deep_periwinkle = 0x5453A6, - dark_slate_blue = 0x483D8B, - purple_haze = 0x4E387E, - purple_iris = 0x571B7E, - dark_purple = 0x4B0150, - deep_purple = 0x36013F, - midnight_purple = 0x2E1A47, - purple_monster = 0x461B7E, - indigo = 0x4B0082, - blue_whale = 0x342D7E, - rebecca_purple = 0x663399, - purple_jam = 0x6A287E, - dark_magenta = 0x8B008B, - purple = 0x800080, - french_lilac = 0x86608E, - dark_orchid = 0x9932CC, - dark_violet = 0x9400D3, - purple_violet = 0x8D38C9, - jasmine_purple = 0xA23BEC, - purple_daffodil = 0xB041FF, - clematis_violet = 0x842DCE, - blue_violet = 0x8A2BE2, - purple_sage_bush = 0x7A5DC7, - lovely_purple = 0x7F38EC, - neon_purple = 0x9D00FF, - purple_plum = 0x8E35EF, - aztech_purple = 0x893BFF, - medium_purple = 0x9370DB, - light_purple = 0x8467D7, - crocus_purple = 0x9172EC, - purple_mimosa = 0x9E7BFF, - periwinkle = 0xCCCCFF, - pale_lilac = 0xDCD0FF, - lavender_purple = 0x967BB6, - rose_purple = 0xB09FCA, - lilac = 0xC8A2C8, - mauve = 0xE0B0FF, - bright_lilac = 0xD891EF, - purple_dragon = 0xC38EC7, - plum = 0xDDA0DD, - blush_pink = 0xE6A9EC, - pastel_purple = 0xF2A2E8, - blossom_pink = 0xF9B7FF, - wisteria_purple = 0xC6AEC7, - purple_thistle = 0xD2B9D3, - thistle = 0xD8BFD8, - purple_white = 0xDFD3E3, - periwinkle_pink = 0xE9CFEC, - cotton_candy = 0xFCDFFF, - lavender_pinocchio = 0xEBDDE2, - dark_white = 0xE1D9D1, - ash_white = 0xE9E4D4, - white_chocolate = 0xEDE6D6, - soft_ivory = 0xFAF0DD, - off_white = 0xF8F0E3, - pearl_white = 0xF8F6F0, - red_white = 0xF3E8EA, - lavender_blush = 0xFFF0F5, - pearl = 0xFDEEF4, - egg_shell = 0xFFF9E3, - old_lace = 0xFEF0E3, - linen = 0xFAF0E6, - sea_shell = 0xFFF5EE, - bone_white = 0xF9F6EE, - rice = 0xFAF5EF, - floral_white = 0xFFFAF0, - ivory = 0xFFFFF0, - white_gold = 0xFFFFF4, - light_white = 0xFFFFF7, - white_smoke = 0xF5F5F5, - cotton = 0xFBFBF9, - snow = 0xFFFAFA, - milk_white = 0xFEFCFF, - half_white = 0xFFFEFA; - } // namespace colors - /** - * @brief predefined color constants, same as colors - */ - namespace colours = colors; +/** + * @brief predefined color constants. + */ +namespace colors { + const uint32_t + white = 0xFFFFFF, + discord_white = 0xFFFFFE, + light_gray = 0xC0C0C0, + gray = 0x808080, + dark_gray = 0x404040, + black = 0x000000, + discord_black = 0x000001, + red = 0xFF0000, + pink = 0xFFAFAF, + orange = 0xFFC800, + yellow = 0xFFFF00, + green = 0x00FF00, + magenta = 0xFF00FF, + cyan = 0x00FFFF, + blue = 0x0000FF, + light_sea_green = 0x1ABC9C, + medium_sea_green = 0x2ECC71, + summer_sky = 0x3498DB, + deep_lilac = 0x9B59B6, + ruby = 0xE91E63, + moon_yellow = 0xF1C40F, + tahiti_gold = 0xE67E22, + cinnabar = 0xE74C3C, + submarine = 0x95A5A6, + blue_aquamarine = 0x607D8B, + deep_sea = 0x11806A, + sea_green = 0x1F8B4C, + endeavour = 0x206694, + vivid_violet = 0x71368A, + jazzberry_jam = 0xAD1457, + dark_goldenrod = 0xC27C0E, + rust = 0xA84300, + brown = 0x992D22, + gray_chateau = 0x979C9F, + bismark = 0x546E7A, + sti_blue = 0x0E4BEF, + wrx_blue = 0x00247D, + rallyart_crimson = 0xE60012, + lime = 0x00FF00, + forest_green = 0x228B22, + cadmium_green = 0x097969, + aquamarine = 0x7FFFD4, + blue_green = 0x088F8F, + raspberry = 0xE30B5C, + scarlet_red = 0xFF2400, + night = 0x0C090A, + charcoal = 0x34282C, + oil = 0x3B3131, + light_black = 0x454545, + black_cat = 0x413839, + iridium = 0x3D3C3A, + black_eel = 0x463E3F, + black_cow = 0x4C4646, + gray_wolf = 0x504A4B, + grey_wolf = 0x504A4B, + vampire_gray = 0x565051, + vampire_grey = 0x565051, + iron_gray = 0x52595D, + iron_grey = 0x52595D, + gray_dolphin = 0x5C5858, + grey_dolphin = 0x5C5858, + carbon_gray = 0x625D5D, + carbon_grey = 0x625D5D, + ash_gray = 0x666362, + ash_grey = 0x666362, + dim_gray = 0x696969, + dim_grey = 0x696969, + nardo_gray = 0x686A6C, + nardo_grey = 0x686A6C, + cloudy_gray = 0x6D6968, + cloudy_grey = 0x6D6968, + smokey_gray = 0x726E6D, + smokey_grey = 0x726E6D, + alien_gray = 0x736F6E, + alien_grey = 0x736F6E, + sonic_silver = 0x757575, + platinum_gray = 0x797979, + platinum_grey = 0x797979, + granite = 0x837E7C, + battleship_gray = 0x848482, + battleship_grey = 0x848482, + gunmetal_gray = 0x8D918D, + gunmetal_grey = 0x8D918D, + gray_cloud = 0xB6B6B4, + grey_cloud = 0xB6B6B4, + silver = 0xC0C0C0, + pale_silver = 0xC9C0BB, + gray_goose = 0xD1D0CE, + grey_goose = 0xD1D0CE, + platinum_silver = 0xCECECE, + silver_white = 0xDADBDD, + gainsboro = 0xDCDCDC, + platinum = 0xE5E4E2, + metallic_silver = 0xBCC6CC, + blue_gray = 0x98AFC7, + blue_grey = 0x98AFC7, + roman_silver = 0x838996, + light_slate_gray = 0x778899, + light_slate_grey = 0x778899, + slate_gray = 0x708090, + slate_grey = 0x708090, + rat_gray = 0x6D7B8D, + slate_granite_gray = 0x657383, + slate_granite_grey = 0x657383, + jet_gray = 0x616D7E, + jet_grey = 0x616D7E, + mist_blue = 0x646D7E, + marble_blue = 0x566D7E, + slate_blue_grey = 0x737CA1, + slate_blue_gray = 0x737CA1, + light_purple_blue = 0x728FCE, + azure_blue = 0x4863A0, + blue_jay = 0x2B547E, + charcoal_blue = 0x36454F, + dark_blue_grey = 0x29465B, + dark_slate = 0x2B3856, + deep_sea_blue = 0x123456, + night_blue = 0x151B54, + midnight_blue = 0x191970, + navy = 0x000080, + denim_dark_blue = 0x151B8D, + dark_blue = 0x00008B, + lapis_blue = 0x15317E, + new_midnight_blue = 0x0000A0, + earth_blue = 0x0000A5, + cobalt_blue = 0x0020C2, + medium_blue = 0x0000CD, + blueberry_blue = 0x0041C2, + canary_blue = 0x2916F5, + samco_blue = 0x0002FF, + bright_blue = 0x0909FF, + blue_orchid = 0x1F45FC, + sapphire_blue = 0x2554C7, + blue_eyes = 0x1569C7, + bright_navy_blue = 0x1974D2, + balloon_blue = 0x2B60DE, + royal_blue = 0x4169E1, + ocean_blue = 0x2B65EC, + blue_ribbon = 0x306EFF, + blue_dress = 0x157DEC, + neon_blue = 0x1589FF, + dodger_blue = 0x1E90FF, + glacial_blue_ice = 0x368BC1, + steel_blue = 0x4682B4, + silk_blue = 0x488AC7, + windows_blue = 0x357EC7, + blue_ivy = 0x3090C7, + blue_koi = 0x659EC7, + columbia_blue = 0x87AFC7, + baby_blue = 0x95B9C7, + cornflower_blue = 0x6495ED, + sky_blue_dress = 0x6698FF, + iceberg = 0x56A5EC, + butterfly_blue = 0x38ACEC, + deep_sky_blue = 0x00BFFF, + midday_blue = 0x3BB9FF, + crystal_blue = 0x5CB3FF, + denim_blue = 0x79BAEC, + day_sky_blue = 0x82CAFF, + light_sky_blue = 0x87CEFA, + sky_blue = 0x87CEEB, + jeans_blue = 0xA0CFEC, + blue_angel = 0xB7CEEC, + pastel_blue = 0xB4CFEC, + light_day_blue = 0xADDFFF, + sea_blue = 0xC2DFFF, + heavenly_blue = 0xC6DEFF, + robin_egg_blue = 0xBDEDFF, + powder_blue = 0xB0E0E6, + coral_blue = 0xAFDCEC, + light_blue = 0xADD8E6, + light_steel_blue = 0xB0CFDE, + gulf_blue = 0xC9DFEC, + pastel_light_blue = 0xD5D6EA, + lavender_blue = 0xE3E4FA, + white_blue = 0xDBE9FA, + lavender = 0xE6E6FA, + water = 0xEBF4FA, + alice_blue = 0xF0F8FF, + ghost_white = 0xF8F8FF, + azure = 0xF0FFFF, + light_cyan = 0xE0FFFF, + light_slate = 0xCCFFFF, + electric_blue = 0x9AFEFF, + tron_blue = 0x7DFDFE, + blue_zircon = 0x57FEFF, + aqua = 0x00FFFF, + bright_cyan = 0x0AFFFF, + celeste = 0x50EBEC, + blue_diamond = 0x4EE2EC, + bright_turquoise = 0x16E2F5, + blue_lagoon = 0x8EEBEC, + pale_turquoise = 0xAFEEEE, + pale_blue_lily = 0xCFECEC, + light_teal = 0xB3D9D9, + tiffany_blue = 0x81D8D0, + blue_hosta = 0x77BFC7, + cyan_opaque = 0x92C7C7, + northern_lights_blue = 0x78C7C7, + medium_aquamarine = 0x66CDAA, + magic_mint = 0xAAF0D1, + light_aquamarine = 0x93FFE8, + bright_teal = 0x01F9C6, + turquoise = 0x40E0D0, + medium_turquoise = 0x48D1CC, + deep_turquoise = 0x48CCCD, + jellyfish = 0x46C7C7, + blue_turquoise = 0x43C6DB, + dark_turquoise = 0x00CED1, + macaw_blue_green = 0x43BFC7, + seafoam_green = 0x3EA99F, + cadet_blue = 0x5F9EA0, + blue_chill = 0x3B9C9C, + dark_cyan = 0x008B8B, + teal_green = 0x00827F, + teal = 0x008080, + teal_blue = 0x007C80, + medium_teal = 0x045F5F, + dark_teal = 0x045D5D, + deep_teal = 0x033E3E, + dark_slate_gray = 0x25383C, + dark_slate_grey = 0x25383C, + gunmetal = 0x2C3539, + blue_moss_green = 0x3C565B, + beetle_green = 0x4C787E, + grayish_turquoise = 0x5E7D7E, + greenish_blue = 0x307D7E, + aquamarine_stone = 0x348781, + sea_turtle_green = 0x438D80, + dull_sea_green = 0x4E8975, + dark_green_blue = 0x1F6357, + deep_sea_green = 0x306754, + bottle_green = 0x006A4E, + elf_green = 0x1B8A6B, + dark_mint = 0x31906E, + jade = 0x00A36C, + earth_green = 0x34A56F, + chrome_green = 0x1AA260, + emerald = 0x50C878, + mint = 0x3EB489, + metallic_green = 0x7C9D8E, + camouflage_green = 0x78866B, + sage_green = 0x848B79, + hazel_green = 0x617C58, + venom_green = 0x728C00, + olive_drab = 0x6B8E23, + olive = 0x808000, + dark_olive_green = 0x556B2F, + military_green = 0x4E5B31, + green_leaves = 0x3A5F0B, + army_green = 0x4B5320, + fern_green = 0x667C26, + fall_forest_green = 0x4E9258, + irish_green = 0x08A04B, + pine_green = 0x387C44, + medium_forest_green = 0x347235, + jungle_green = 0x347C2C, + cactus_green = 0x227442, + dark_green = 0x006400, + deep_green = 0x056608, + deep_emerald_green = 0x046307, + hunter_green = 0x355E3B, + dark_forest_green = 0x254117, + lotus_green = 0x004225, + seaweed_green = 0x437C17, + shamrock_green = 0x347C17, + green_onion = 0x6AA121, + moss_green = 0x8A9A5B, + grass_green = 0x3F9B0B, + green_pepper = 0x4AA02C, + dark_lime_green = 0x41A317, + parrot_green = 0x12AD2B, + clover_green = 0x3EA055, + dinosaur_green = 0x73A16C, + green_snake = 0x6CBB3C, + alien_green = 0x6CC417, + green_apple = 0x4CC417, + lime_green = 0x32CD32, + pea_green = 0x52D017, + kelly_green = 0x4CC552, + zombie_green = 0x54C571, + green_peas = 0x89C35C, + dollar_bill_green = 0x85BB65, + frog_green = 0x99C68E, + turquoise_green = 0xA0D6B4, + dark_sea_green = 0x8FBC8F, + basil_green = 0x829F82, + gray_green = 0xA2AD9C, + iguana_green = 0x9CB071, + citron_green = 0x8FB31D, + acid_green = 0xB0BF1A, + avocado_green = 0xB2C248, + pistachio_green = 0x9DC209, + salad_green = 0xA1C935, + yellow_green = 0x9ACD32, + pastel_green = 0x77DD77, + hummingbird_green = 0x7FE817, + nebula_green = 0x59E817, + stoplight_go_green = 0x57E964, + neon_green = 0x16F529, + jade_green = 0x5EFB6E, + lime_mint_green = 0x36F57F, + spring_green = 0x00FF7F, + medium_spring_green = 0x00FA9A, + emerald_green = 0x5FFB17, + lawn_green = 0x7CFC00, + bright_green = 0x66FF00, + chartreuse = 0x7FFF00, + yellow_lawn_green = 0x87F717, + aloe_vera_green = 0x98F516, + dull_green_yellow = 0xB1FB17, + lemon_green = 0xADF802, + green_yellow = 0xADFF2F, + chameleon_green = 0xBDF516, + neon_yellow_green = 0xDAEE01, + yellow_green_grosbeak = 0xE2F516, + tea_green = 0xCCFB5D, + slime_green = 0xBCE954, + algae_green = 0x64E986, + light_green = 0x90EE90, + dragon_green = 0x6AFB92, + pale_green = 0x98FB98, + mint_green = 0x98FF98, + green_thumb = 0xB5EAAA, + organic_brown = 0xE3F9A6, + light_jade = 0xC3FDB8, + light_mint_green = 0xC2E5D3, + light_rose_green = 0xDBF9DB, + chrome_white = 0xE8F1D4, + honeydew = 0xF0FFF0, + mint_cream = 0xF5FFFA, + lemon_chiffon = 0xFFFACD, + parchment = 0xFFFFC2, + cream = 0xFFFFCC, + cream_white = 0xFFFDD0, + light_goldenrod_yellow = 0xFAFAD2, + light_yellow = 0xFFFFE0, + beige = 0xF5F5DC, + cornsilk = 0xFFF8DC, + blonde = 0xFBF6D9, + champagne = 0xF7E7CE, + antique_white = 0xFAEBD7, + papaya_whip = 0xFFEFD5, + blanched_almond = 0xFFEBCD, + bisque = 0xFFE4C4, + wheat = 0xF5DEB3, + moccasin = 0xFFE4B5, + peach = 0xFFE5B4, + light_orange = 0xFED8B1, + peach_puff = 0xFFDAB9, + coral_peach = 0xFBD5AB, + navajo_white = 0xFFDEAD, + golden_blonde = 0xFBE7A1, + golden_silk = 0xF3E3C3, + dark_blonde = 0xF0E2B6, + light_gold = 0xF1E5AC, + vanilla = 0xF3E5AB, + tan_brown = 0xECE5B6, + dirty_white = 0xE8E4C9, + pale_goldenrod = 0xEEE8AA, + khaki = 0xF0E68C, + cardboard_brown = 0xEDDA74, + harvest_gold = 0xEDE275, + sun_yellow = 0xFFE87C, + corn_yellow = 0xFFF380, + pastel_yellow = 0xFAF884, + neon_yellow = 0xFFFF33, + canary_yellow = 0xFFEF00, + banana_yellow = 0xF5E216, + mustard_yellow = 0xFFDB58, + golden_yellow = 0xFFDF00, + bold_yellow = 0xF9DB24, + rubber_ducky_yellow = 0xFFD801, + gold = 0xFFD700, + bright_gold = 0xFDD017, + chrome_gold = 0xFFCE44, + golden_brown = 0xEAC117, + deep_yellow = 0xF6BE00, + macaroni_and_cheese = 0xF2BB66, + saffron = 0xFBB917, + neon_gold = 0xFDBD01, + beer = 0xFBB117, + yellow_orange = 0xFFAE42, + orange_yellow = 0xFFAE42, + cantaloupe = 0xFFA62F, + cheese_orange = 0xFFA600, + brown_sand = 0xEE9A4D, + sandy_brown = 0xF4A460, + brown_sugar = 0xE2A76F, + camel_brown = 0xC19A6B, + deer_brown = 0xE6BF83, + burly_wood = 0xDEB887, + tan = 0xD2B48C, + light_french_beige = 0xC8AD7F, + sand = 0xC2B280, + sage = 0xBCB88A, + fall_leaf_brown = 0xC8B560, + ginger_brown = 0xC9BE62, + bronze_gold = 0xC9AE5D, + dark_khaki = 0xBDB76B, + olive_green = 0xBAB86C, + brass = 0xB5A642, + cookie_brown = 0xC7A317, + metallic_gold = 0xD4AF37, + bee_yellow = 0xE9AB17, + school_bus_yellow = 0xE8A317, + goldenrod = 0xDAA520, + orange_gold = 0xD4A017, + caramel = 0xC68E17, + cinnamon = 0xC58917, + peru = 0xCD853F, + bronze = 0xCD7F32, + tiger_orange = 0xC88141, + copper = 0xB87333, + dark_gold = 0xAA6C39, + metallic_bronze = 0xA97142, + dark_almond = 0xAB784E, + wood = 0x966F33, + oak_brown = 0x806517, + antique_bronze = 0x665D1E, + hazel = 0x8E7618, + dark_yellow = 0x8B8000, + dark_moccasin = 0x827839, + khaki_green = 0x8A865D, + millennium_jade = 0x93917C, + dark_beige = 0x9F8C76, + bullet_shell = 0xAF9B60, + army_brown = 0x827B60, + sandstone = 0x786D5F, + taupe = 0x483C32, + mocha = 0x493D26, + milk_chocolate = 0x513B1C, + gray_brown = 0x3D3635, + dark_coffee = 0x3B2F2F, + old_burgundy = 0x43302E, + western_charcoal = 0x49413F, + bakers_brown = 0x5C3317, + dark_brown = 0x654321, + sepia_brown = 0x704214, + dark_bronze = 0x804A00, + coffee = 0x6F4E37, + brown_bear = 0x835C3B, + red_dirt = 0x7F5217, + sepia = 0x7F462C, + sienna = 0xA0522D, + saddle_brown = 0x8B4513, + dark_sienna = 0x8A4117, + sangria = 0x7E3817, + blood_red = 0x7E3517, + chestnut = 0x954535, + coral_brown = 0x9E4638, + chestnut_red = 0xC34A2C, + mahogany = 0xC04000, + red_gold = 0xEB5406, + red_fox = 0xC35817, + dark_bisque = 0xB86500, + light_brown = 0xB5651D, + petra_gold = 0xB76734, + copper_red = 0xCB6D51, + orange_salmon = 0xC47451, + chocolate = 0xD2691E, + sedona = 0xCC6600, + papaya_orange = 0xE56717, + halloween_orange = 0xE66C2C, + neon_orange = 0xFF6700, + bright_orange = 0xFF5F1F, + pumpkin_orange = 0xF87217, + carrot_orange = 0xF88017, + dark_orange = 0xFF8C00, + construction_cone_orange = 0xF87431, + indian_saffron = 0xFF7722, + sunrise_orange = 0xE67451, + mango_orange = 0xFF8040, + coral = 0xFF7F50, + basket_ball_orange = 0xF88158, + light_salmon_rose = 0xF9966B, + light_salmon = 0xFFA07A, + dark_salmon = 0xE9967A, + tangerine = 0xE78A61, + light_copper = 0xDA8A67, + salmon_pink = 0xFF8674, + salmon = 0xFA8072, + peach_pink = 0xF98B88, + light_coral = 0xF08080, + pastel_red = 0xF67280, + pink_coral = 0xE77471, + bean_red = 0xF75D59, + valentine_red = 0xE55451, + indian_red = 0xCD5C5C, + tomato = 0xFF6347, + shocking_orange = 0xE55B3C, + orange_red = 0xFF4500, + neon_red = 0xFD1C03, + ruby_red = 0xF62217, + ferrari_red = 0xF70D1A, + fire_engine_red = 0xF62817, + lava_red = 0xE42217, + love_red = 0xE41B17, + grapefruit = 0xDC381F, + cherry_red = 0xC24641, + chilli_pepper = 0xC11B17, + fire_brick = 0xB22222, + tomato_sauce_red = 0xB21807, + carbon_red = 0xA70D2A, + cranberry = 0x9F000F, + saffron_red = 0x931314, + crimson_red = 0x990000, + red_wine = 0x990012, + wine_red = 0x990012, + dark_red = 0x8B0000, + maroon = 0x800000, + burgundy = 0x8C001A, + vermilion = 0x7E191B, + deep_red = 0x800517, + red_blood = 0x660000, + blood_night = 0x551606, + dark_scarlet = 0x560319, + black_bean = 0x3D0C02, + chocolate_brown = 0x3F000F, + midnight = 0x2B1B17, + purple_lily = 0x550A35, + purple_maroon = 0x810541, + plum_pie = 0x7D0541, + plum_velvet = 0x7D0552, + dark_raspberry = 0x872657, + velvet_maroon = 0x7E354D, + rosy_finch = 0x7F4E52, + dull_purple = 0x7F525D, + puce = 0x7F5A58, + rose_dust = 0x997070, + pastel_brown = 0xB1907F, + rosy_pink = 0xB38481, + rosy_brown = 0xBC8F8F, + khaki_rose = 0xC5908E, + lipstick_pink = 0xC48793, + pink_brown = 0xC48189, + old_rose = 0xC08081, + dusty_pink = 0xD58A94, + pink_daisy = 0xE799A3, + rose = 0xE8ADAA, + dusty_rose = 0xC9A9A6, + silver_pink = 0xC4AEAD, + gold_pink = 0xE6C7C2, + rose_gold = 0xECC5C0, + deep_peach = 0xFFCBA4, + pastel_orange = 0xF8B88B, + desert_sand = 0xEDC9AF, + unbleached_silk = 0xFFDDCA, + pig_pink = 0xFDD7E4, + pale_pink = 0xF2D4D7, + blush = 0xFFE6E8, + misty_rose = 0xFFE4E1, + pink_bubble_gum = 0xFFDFDD, + light_rose = 0xFBCFCD, + light_red = 0xFFCCCB, + warm_pink = 0xF6C6BD, + deep_rose = 0xFBBBB9, + light_pink = 0xFFB6C1, + soft_pink = 0xFFB8BF, + donut_pink = 0xFAAFBE, + baby_pink = 0xFAAFBA, + flamingo_pink = 0xF9A7B0, + pastel_pink = 0xFEA3AA, + rose_pink = 0xE7A1B0, + pink_rose = 0xE7A1B0, + cadillac_pink = 0xE38AAE, + carnation_pink = 0xF778A1, + pastel_rose = 0xE5788F, + blush_red = 0xE56E94, + pale_violet_red = 0xDB7093, + purple_pink = 0xD16587, + tulip_pink = 0xC25A7C, + bashful_pink = 0xC25283, + dark_pink = 0xE75480, + dark_hot_pink = 0xF660AB, + hot_pink = 0xFF69B4, + watermelon_pink = 0xFC6C85, + violet_red = 0xF6358A, + hot_deep_pink = 0xF52887, + bright_pink = 0xFF007F, + deep_pink = 0xFF1493, + neon_pink = 0xF535AA, + chrome_pink = 0xFF33AA, + neon_hot_pink = 0xFD349C, + pink_cupcake = 0xE45E9D, + royal_pink = 0xE759AC, + dimorphotheca_magenta = 0xE3319D, + pink_lemonade = 0xE4287C, + red_pink = 0xFA2A55, + crimson = 0xDC143C, + bright_maroon = 0xC32148, + rose_red = 0xC21E56, + rogue_pink = 0xC12869, + burnt_pink = 0xC12267, + pink_violet = 0xCA226B, + magenta_pink = 0xCC338B, + medium_violet_red = 0xC71585, + dark_carnation_pink = 0xC12283, + raspberry_purple = 0xB3446C, + pink_plum = 0xB93B8F, + orchid = 0xDA70D6, + deep_mauve = 0xDF73D4, + violet = 0xEE82EE, + fuchsia_pink = 0xFF77FF, + bright_neon_pink = 0xF433FF, + fuchsia = 0xFF00FF, + crimson_purple = 0xE238EC, + heliotrope_purple = 0xD462FF, + tyrian_purple = 0xC45AEC, + medium_orchid = 0xBA55D3, + purple_flower = 0xA74AC7, + orchid_purple = 0xB048B5, + rich_lilac = 0xB666D2, + pastel_violet = 0xD291BC, + mauve_taupe = 0x915F6D, + viola_purple = 0x7E587E, + eggplant = 0x614051, + plum_purple = 0x583759, + grape = 0x5E5A80, + purple_navy = 0x4E5180, + slate_blue = 0x6A5ACD, + blue_lotus = 0x6960EC, + blurple = 0x5865F2, + light_slate_blue = 0x736AFF, + medium_slate_blue = 0x7B68EE, + periwinkle_purple = 0x7575CF, + very_peri = 0x6667AB, + bright_grape = 0x6F2DA8, + purple_amethyst = 0x6C2DC7, + bright_purple = 0x6A0DAD, + deep_periwinkle = 0x5453A6, + dark_slate_blue = 0x483D8B, + purple_haze = 0x4E387E, + purple_iris = 0x571B7E, + dark_purple = 0x4B0150, + deep_purple = 0x36013F, + midnight_purple = 0x2E1A47, + purple_monster = 0x461B7E, + indigo = 0x4B0082, + blue_whale = 0x342D7E, + rebecca_purple = 0x663399, + purple_jam = 0x6A287E, + dark_magenta = 0x8B008B, + purple = 0x800080, + french_lilac = 0x86608E, + dark_orchid = 0x9932CC, + dark_violet = 0x9400D3, + purple_violet = 0x8D38C9, + jasmine_purple = 0xA23BEC, + purple_daffodil = 0xB041FF, + clematis_violet = 0x842DCE, + blue_violet = 0x8A2BE2, + purple_sage_bush = 0x7A5DC7, + lovely_purple = 0x7F38EC, + neon_purple = 0x9D00FF, + purple_plum = 0x8E35EF, + aztech_purple = 0x893BFF, + medium_purple = 0x9370DB, + light_purple = 0x8467D7, + crocus_purple = 0x9172EC, + purple_mimosa = 0x9E7BFF, + periwinkle = 0xCCCCFF, + pale_lilac = 0xDCD0FF, + lavender_purple = 0x967BB6, + rose_purple = 0xB09FCA, + lilac = 0xC8A2C8, + mauve = 0xE0B0FF, + bright_lilac = 0xD891EF, + purple_dragon = 0xC38EC7, + plum = 0xDDA0DD, + blush_pink = 0xE6A9EC, + pastel_purple = 0xF2A2E8, + blossom_pink = 0xF9B7FF, + wisteria_purple = 0xC6AEC7, + purple_thistle = 0xD2B9D3, + thistle = 0xD8BFD8, + purple_white = 0xDFD3E3, + periwinkle_pink = 0xE9CFEC, + cotton_candy = 0xFCDFFF, + lavender_pinocchio = 0xEBDDE2, + dark_white = 0xE1D9D1, + ash_white = 0xE9E4D4, + white_chocolate = 0xEDE6D6, + soft_ivory = 0xFAF0DD, + off_white = 0xF8F0E3, + pearl_white = 0xF8F6F0, + red_white = 0xF3E8EA, + lavender_blush = 0xFFF0F5, + pearl = 0xFDEEF4, + egg_shell = 0xFFF9E3, + old_lace = 0xFEF0E3, + linen = 0xFAF0E6, + sea_shell = 0xFFF5EE, + bone_white = 0xF9F6EE, + rice = 0xFAF5EF, + floral_white = 0xFFFAF0, + ivory = 0xFFFFF0, + white_gold = 0xFFFFF4, + light_white = 0xFFFFF7, + white_smoke = 0xF5F5F5, + cotton = 0xFBFBF9, + snow = 0xFFFAFA, + milk_white = 0xFEFCFF, + half_white = 0xFFFEFA; +} // namespace colors + +/** + * @brief Predefined colour constants, same as colors but for the british. + */ +namespace colours = colors; } // namespace dpp diff --git a/include/dpp/commandhandler.h b/include/dpp/commandhandler.h index 304ba9318e..724f38f577 100644 --- a/include/dpp/commandhandler.h +++ b/include/dpp/commandhandler.h @@ -50,6 +50,7 @@ struct DPP_EXPORT resolved_user { * @brief Holds user information */ dpp::user user; + /** * @brief Holds member information */ @@ -69,13 +70,40 @@ typedef std::variant> bulk_registration_list_guild; + /** * @brief List of global commands to bulk register */ @@ -384,7 +418,9 @@ class DPP_EXPORT commandhandler { */ void thinking(command_source source, command_completion_event_t callback = utility::log_error()); - /* Easter egg */ + /** + * @brief Easter egg (redefinition of dpp::commandhandler::thinking). + */ void thonk(command_source source, command_completion_event_t callback = utility::log_error()); }; diff --git a/include/dpp/discordevents.h b/include/dpp/discordevents.h index 0154d4a44b..c29d686bfc 100644 --- a/include/dpp/discordevents.h +++ b/include/dpp/discordevents.h @@ -29,21 +29,24 @@ namespace dpp { -/** @brief Returns a snowflake id from a json field value, if defined, else returns 0 +/** + * @brief Returns a snowflake id from a json field value, if defined, else returns 0 * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @return found value */ uint64_t DPP_EXPORT snowflake_not_null(const nlohmann::json* j, const char *keyname); -/** @brief Sets a snowflake id from a json field value, if defined, else does nothing +/** + * @brief Sets a snowflake id from a json field value, if defined, else does nothing * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @param v Value to change */ void DPP_EXPORT set_snowflake_not_null(const nlohmann::json* j, const char *keyname, uint64_t &v); -/** @brief Sets an array of snowflakes from a json field value, if defined, else does nothing +/** + * @brief Sets an array of snowflakes from a json field value, if defined, else does nothing * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for the values * @param v Value to change @@ -58,7 +61,8 @@ void DPP_EXPORT set_snowflake_array_not_null(const nlohmann::json* j, const char */ void DPP_EXPORT for_each_json(nlohmann::json* parent, std::string_view key, const std::function &fn); -/** @brief Sets an array of objects from a json field value, if defined, else does nothing +/** + * @brief Sets an array of objects from a json field value, if defined, else does nothing * @tparam T The class of which the array consists of. Must be derived from dpp::json_interface * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for the values @@ -71,42 +75,48 @@ template void set_object_array_not_null(nlohmann::json* j, std::string_ }); } -/** @brief Returns a string from a json field value, if defined, else returns an empty string. +/** + * @brief Returns a string from a json field value, if defined, else returns an empty string. * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @return found value */ std::string DPP_EXPORT string_not_null(const nlohmann::json* j, const char *keyname); -/** @brief Sets a string from a json field value, if defined, else does nothing +/** + * @brief Sets a string from a json field value, if defined, else does nothing * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @param v Value to change */ void DPP_EXPORT set_string_not_null(const nlohmann::json* j, const char *keyname, std::string &v); -/** @brief This is a repeat of set_string_not_null, but takes in a iconhash. +/** + * @brief This is a repeat of set_string_not_null, but takes in a iconhash. * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @param v Value to change */ void DPP_EXPORT set_iconhash_not_null(const nlohmann::json* j, const char *keyname, utility::iconhash &v); -/** @brief Returns a double from a json field value, if defined, else returns 0. +/** + * @brief Returns a double from a json field value, if defined, else returns 0. * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @return found value */ double DPP_EXPORT double_not_null(const nlohmann::json* j, const char *keyname); -/** @brief Sets a double from a json field value, if defined, else does nothing +/** + * @brief Sets a double from a json field value, if defined, else does nothing * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @param v Value to change */ void DPP_EXPORT set_double_not_null(const nlohmann::json* j, const char *keyname, double &v); -/** @brief Returns a 64 bit unsigned integer from a json field value, if defined, else returns 0. +/** + * @brief Returns a 64 bit unsigned integer from a json field value, if defined, else returns 0. * DO NOT use this for snowflakes, as usually snowflakes are wrapped in a string! * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value @@ -114,70 +124,80 @@ void DPP_EXPORT set_double_not_null(const nlohmann::json* j, const char *keyname */ uint64_t DPP_EXPORT int64_not_null(const nlohmann::json* j, const char *keyname); -/** @brief Sets an unsigned 64 bit integer from a json field value, if defined, else does nothing +/** + * @brief Sets an unsigned 64 bit integer from a json field value, if defined, else does nothing * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @param v Value to change */ void DPP_EXPORT set_int64_not_null(const nlohmann::json* j, const char *keyname, uint64_t &v); -/** @brief Returns a 32 bit unsigned integer from a json field value, if defined, else returns 0 +/** + * @brief Returns a 32 bit unsigned integer from a json field value, if defined, else returns 0 * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @return found value */ uint32_t DPP_EXPORT int32_not_null(const nlohmann::json* j, const char *keyname); -/** @brief Sets an unsigned 32 bit integer from a json field value, if defined, else does nothing +/** + * @brief Sets an unsigned 32 bit integer from a json field value, if defined, else does nothing * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @param v Value to change */ void DPP_EXPORT set_int32_not_null(const nlohmann::json* j, const char *keyname, uint32_t &v); -/** @brief Returns a 16 bit unsigned integer from a json field value, if defined, else returns 0 +/** + * @brief Returns a 16 bit unsigned integer from a json field value, if defined, else returns 0 * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @return found value */ uint16_t DPP_EXPORT int16_not_null(const nlohmann::json* j, const char *keyname); -/** @brief Sets an unsigned 16 bit integer from a json field value, if defined, else does nothing +/** + * @brief Sets an unsigned 16 bit integer from a json field value, if defined, else does nothing * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @param v Value to change */ void DPP_EXPORT set_int16_not_null(const nlohmann::json* j, const char *keyname, uint16_t &v); -/** @brief Returns an 8 bit unsigned integer from a json field value, if defined, else returns 0 +/** + * @brief Returns an 8 bit unsigned integer from a json field value, if defined, else returns 0 * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @return found value */ uint8_t DPP_EXPORT int8_not_null(const nlohmann::json* j, const char *keyname); -/** @brief Sets an unsigned 8 bit integer from a json field value, if defined, else does nothing +/** + * @brief Sets an unsigned 8 bit integer from a json field value, if defined, else does nothing * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @param v Value to change */ void DPP_EXPORT set_int8_not_null(const nlohmann::json* j, const char *keyname, uint8_t &v); -/** @brief Returns a boolean value from a json field value, if defined, else returns false +/** + * @brief Returns a boolean value from a json field value, if defined, else returns false * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @return found value */ bool DPP_EXPORT bool_not_null(const nlohmann::json* j, const char *keyname); -/** @brief Sets a boolean from a json field value, if defined, else does nothing +/** + * @brief Sets a boolean from a json field value, if defined, else does nothing * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @param v Value to change */ void DPP_EXPORT set_bool_not_null(const nlohmann::json* j, const char *keyname, bool &v); -/** @brief Returns a time_t from an ISO8601 timestamp field in a json value, if defined, else returns +/** + * @brief Returns a time_t from an ISO8601 timestamp field in a json value, if defined, else returns * epoch value of 0. * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value @@ -185,14 +205,16 @@ void DPP_EXPORT set_bool_not_null(const nlohmann::json* j, const char *keyname, */ time_t DPP_EXPORT ts_not_null(const nlohmann::json* j, const char *keyname); -/** @brief Sets an timestamp from a json field value containing an ISO8601 string, if defined, else does nothing +/** + * @brief Sets an timestamp from a json field value containing an ISO8601 string, if defined, else does nothing * @param j nlohmann::json instance to retrieve value from * @param keyname key name to check for a value * @param v Value to change */ void DPP_EXPORT set_ts_not_null(const nlohmann::json* j, const char *keyname, time_t &v); -/** @brief Base64 encode data into a string. +/** + * @brief Base64 encode data into a string. * @param buf Raw binary buffer * @param buffer_length Buffer length to encode * @return The base64 encoded string diff --git a/include/dpp/discordvoiceclient.h b/include/dpp/discordvoiceclient.h index cc88ec04b8..4a13ab6725 100644 --- a/include/dpp/discordvoiceclient.h +++ b/include/dpp/discordvoiceclient.h @@ -93,6 +93,7 @@ struct DPP_EXPORT voice_out_packet { * Generally these will be RTP. */ std::string packet; + /** * @brief Duration of packet */ @@ -189,6 +190,7 @@ class DPP_EXPORT discord_voice_client : public websocket_client * voice payload. */ rtp_seq_t seq; + /** * @brief The timestamp of the RTP packet that generated this voice * payload. @@ -197,6 +199,7 @@ class DPP_EXPORT discord_voice_client : public websocket_client * number wraps around. */ rtp_timestamp_t timestamp; + /** * @brief The event payload that voice handlers receive. */ @@ -226,6 +229,7 @@ class DPP_EXPORT discord_voice_client : public websocket_client rtp_seq_t min_seq, max_seq; rtp_timestamp_t min_timestamp, max_timestamp; } range; + /** * @brief The queue of parked voice payloads. * @@ -234,10 +238,12 @@ class DPP_EXPORT discord_voice_client : public websocket_client * are parked and sorted in this queue. */ std::priority_queue parked_payloads; + /** * @brief The decoder ctls to be set on the decoder. */ std::vector> pending_decoder_ctls; + /** * @brief libopus decoder * @@ -251,6 +257,7 @@ class DPP_EXPORT discord_voice_client : public websocket_client * @brief Thread used to deliver incoming voice data to handlers. */ std::thread voice_courier; + /** * @brief Shared state between this voice client and the courier thread. */ @@ -259,16 +266,19 @@ class DPP_EXPORT discord_voice_client : public websocket_client * @brief Protects all following members. */ std::mutex mtx; + /** * @brief Signaled when there is a new payload to deliver or terminating state has changed. */ std::condition_variable signal_iteration; + /** * @brief Voice buffers to be reported to handler, grouped by speaker. * * Buffers are parked here and flushed every 500ms. */ std::map parked_voice_payloads; + /** * @brief Used to signal termination. * @@ -276,6 +286,7 @@ class DPP_EXPORT discord_voice_client : public websocket_client */ bool terminating = false; } voice_courier_shared_state; + /** * @brief The run loop of the voice courier thread. */ diff --git a/include/dpp/dispatcher.h b/include/dpp/dispatcher.h index 0df6996f42..4c41ab69ae 100644 --- a/include/dpp/dispatcher.h +++ b/include/dpp/dispatcher.h @@ -176,15 +176,21 @@ struct DPP_EXPORT event_dispatch_t { bool is_cancelled() const; }; -/** @brief Log messages */ +/** + * @brief Log messages + */ struct DPP_EXPORT log_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; - /** Severity */ + /** + * @brief Severity. + */ loglevel severity = ll_info; - /** Log Message */ + /** + * @brief Log Message + */ std::string message = {}; }; @@ -209,7 +215,9 @@ namespace utility { command_completion_event_t DPP_EXPORT log_error(); } // namespace utility -/** @brief Add user to scheduled event */ +/** + * @brief Add user to scheduled event + */ struct DPP_EXPORT guild_scheduled_event_user_add_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -230,7 +238,9 @@ struct DPP_EXPORT guild_scheduled_event_user_add_t : public event_dispatch_t { snowflake guild_id = {}; }; -/** @brief Delete user from scheduled event */ +/** + * @brief Delete user from scheduled event + */ struct DPP_EXPORT guild_scheduled_event_user_remove_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -251,7 +261,9 @@ struct DPP_EXPORT guild_scheduled_event_user_remove_t : public event_dispatch_t snowflake guild_id = {}; }; -/** @brief Create scheduled event */ +/** + * @brief Create scheduled event + */ struct DPP_EXPORT guild_scheduled_event_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -262,7 +274,9 @@ struct DPP_EXPORT guild_scheduled_event_create_t : public event_dispatch_t { scheduled_event created = {}; }; -/** @brief Create scheduled event */ +/** + * @brief Create scheduled event + */ struct DPP_EXPORT guild_scheduled_event_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -273,7 +287,9 @@ struct DPP_EXPORT guild_scheduled_event_update_t : public event_dispatch_t { scheduled_event updated = {}; }; -/** @brief Delete scheduled event */ +/** + * @brief Delete scheduled event + */ struct DPP_EXPORT guild_scheduled_event_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -284,7 +300,9 @@ struct DPP_EXPORT guild_scheduled_event_delete_t : public event_dispatch_t { scheduled_event deleted = {}; }; -/** @brief Create automod rule */ +/** + * @brief Create automod rule + */ struct DPP_EXPORT automod_rule_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -295,7 +313,9 @@ struct DPP_EXPORT automod_rule_create_t : public event_dispatch_t { automod_rule created = {}; }; -/** @brief Update automod rule */ +/** + * @brief Update automod rule + */ struct DPP_EXPORT automod_rule_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -306,7 +326,9 @@ struct DPP_EXPORT automod_rule_update_t : public event_dispatch_t { automod_rule updated = {}; }; -/** @brief Delete automod rule */ +/** + * @brief Delete automod rule + */ struct DPP_EXPORT automod_rule_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -317,7 +339,9 @@ struct DPP_EXPORT automod_rule_delete_t : public event_dispatch_t { automod_rule deleted = {}; }; -/** @brief Execute/trigger automod rule */ +/** + * @brief Execute/trigger automod rule + */ struct DPP_EXPORT automod_rule_execute_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -378,7 +402,9 @@ struct DPP_EXPORT automod_rule_execute_t : public event_dispatch_t { std::string matched_content = {}; }; -/** @brief Create stage instance */ +/** + * @brief Create stage instance + */ struct DPP_EXPORT stage_instance_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -389,7 +415,9 @@ struct DPP_EXPORT stage_instance_create_t : public event_dispatch_t { stage_instance created = {}; }; -/** @brief Update stage instance */ +/** + * @brief Update stage instance + */ struct DPP_EXPORT stage_instance_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -400,7 +428,9 @@ struct DPP_EXPORT stage_instance_update_t : public event_dispatch_t { stage_instance updated = {}; }; -/** @brief Delete stage instance */ +/** + * @brief Delete stage instance + */ struct DPP_EXPORT stage_instance_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -411,12 +441,16 @@ struct DPP_EXPORT stage_instance_delete_t : public event_dispatch_t { stage_instance deleted = {}; }; -/** @brief Voice state update */ +/** + * @brief Voice state update + */ struct DPP_EXPORT voice_state_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; - /** Voice state */ + /** + * @brief Voice state + */ voicestate state = {}; }; @@ -427,7 +461,6 @@ struct DPP_EXPORT interaction_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; - /** * @brief Acknowledge interaction without displaying a message to the user, * for use with button and select menu components. @@ -684,6 +717,9 @@ struct DPP_EXPORT button_click_t : public interaction_create_t { uint8_t component_type = {}; }; +/** + * @brief On form submitted. + */ struct DPP_EXPORT form_submit_t : public interaction_create_t { private: using interaction_create_t::get_parameter; @@ -826,7 +862,9 @@ struct DPP_EXPORT select_click_t : public interaction_create_t { }; -/** @brief Delete guild */ +/** + * @brief Delete guild + */ struct DPP_EXPORT guild_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -844,12 +882,16 @@ struct DPP_EXPORT guild_delete_t : public event_dispatch_t { snowflake guild_id{0}; }; -/** @brief Update guild stickers */ +/** + * @brief Update guild stickers + */ struct DPP_EXPORT guild_stickers_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; - /** Updating guild */ + /** + * @brief Updating guild + */ guild* updating_guild = nullptr; /** @@ -858,12 +900,16 @@ struct DPP_EXPORT guild_stickers_update_t : public event_dispatch_t { std::vector stickers = {}; }; -/** @brief Guild join request delete (user declined membership screening) */ +/** + * @brief Guild join request delete (user declined membership screening) + */ struct DPP_EXPORT guild_join_request_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; - /** Deleted guild */ + /** + * @brief Deleted guild + */ snowflake guild_id = {}; /** @@ -872,7 +918,9 @@ struct DPP_EXPORT guild_join_request_delete_t : public event_dispatch_t { snowflake user_id = {}; }; -/** @brief Delete channel */ +/** + * @brief Delete channel + */ struct DPP_EXPORT channel_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -888,7 +936,9 @@ struct DPP_EXPORT channel_delete_t : public event_dispatch_t { channel deleted; }; -/** @brief Update channel */ +/** + * @brief Update channel + */ struct DPP_EXPORT channel_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -904,7 +954,9 @@ struct DPP_EXPORT channel_update_t : public event_dispatch_t { channel* updated = nullptr; }; -/** @brief Session ready */ +/** + * @brief Session ready + */ struct DPP_EXPORT ready_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -920,7 +972,9 @@ struct DPP_EXPORT ready_t : public event_dispatch_t { uint32_t shard_id = {}; }; -/** @brief Message Deleted */ +/** + * @brief Message Deleted + */ struct DPP_EXPORT message_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -943,7 +997,9 @@ struct DPP_EXPORT message_delete_t : public event_dispatch_t { }; -/** @brief Guild member remove */ +/** + * @brief Guild member remove + */ struct DPP_EXPORT guild_member_remove_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -964,7 +1020,9 @@ struct DPP_EXPORT guild_member_remove_t : public event_dispatch_t { user removed; }; -/** @brief Session resumed */ +/** + * @brief Session resumed + */ struct DPP_EXPORT resumed_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -980,7 +1038,9 @@ struct DPP_EXPORT resumed_t : public event_dispatch_t { uint32_t shard_id = 0; }; -/** @brief Guild role create */ +/** + * @brief Guild role create + */ struct DPP_EXPORT guild_role_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -996,7 +1056,9 @@ struct DPP_EXPORT guild_role_create_t : public event_dispatch_t { role* created = nullptr; }; -/** @brief Typing start */ +/** + * @brief Typing start + */ struct DPP_EXPORT typing_start_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1029,20 +1091,28 @@ struct DPP_EXPORT typing_start_t : public event_dispatch_t { time_t timestamp = 0; }; -/** @brief Voice state update */ +/** + * @brief Voice state update + */ struct DPP_EXPORT voice_track_marker_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; - /** Voice client */ + /** + * @brief Voice client + */ discord_voice_client* voice_client = nullptr; - /** Track metadata */ + /** + * @brief Track metadata + */ std::string track_meta = {}; }; -/** @brief Message reaction add */ +/** + * @brief Message reaction add + */ struct DPP_EXPORT message_reaction_add_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1089,7 +1159,9 @@ struct DPP_EXPORT message_reaction_add_t : public event_dispatch_t { snowflake message_author_id = {}; }; -/** @brief Guild members chunk */ +/** + * @brief Guild members chunk + */ struct DPP_EXPORT guild_members_chunk_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1105,7 +1177,9 @@ struct DPP_EXPORT guild_members_chunk_t : public event_dispatch_t { guild_member_map* members = nullptr; }; -/** @brief Message reaction remove */ +/** + * @brief Message reaction remove + */ struct DPP_EXPORT message_reaction_remove_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1142,7 +1216,9 @@ struct DPP_EXPORT message_reaction_remove_t : public event_dispatch_t { snowflake message_id = {}; }; -/** @brief Create guild */ +/** + * @brief Create guild + */ struct DPP_EXPORT guild_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1181,7 +1257,9 @@ struct DPP_EXPORT guild_create_t : public event_dispatch_t { sticker_map stickers = {}; }; -/** @brief Create channel */ +/** + * @brief Create channel + */ struct DPP_EXPORT channel_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1197,7 +1275,9 @@ struct DPP_EXPORT channel_create_t : public event_dispatch_t { channel* created = nullptr; }; -/** @brief Message remove emoji */ +/** + * @brief Message remove emoji + */ struct DPP_EXPORT message_reaction_remove_emoji_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1229,7 +1309,9 @@ struct DPP_EXPORT message_reaction_remove_emoji_t : public event_dispatch_t { snowflake message_id = {}; }; -/** @brief Message delete bulk */ +/** + * @brief Message delete bulk + */ struct DPP_EXPORT message_delete_bulk_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1255,7 +1337,9 @@ struct DPP_EXPORT message_delete_bulk_t : public event_dispatch_t { std::vector deleted = {}; }; -/** @brief Guild role update */ +/** + * @brief Guild role update + */ struct DPP_EXPORT guild_role_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1271,7 +1355,9 @@ struct DPP_EXPORT guild_role_update_t : public event_dispatch_t { role* updated = nullptr; }; -/** @brief Guild role delete */ +/** + * @brief Guild role delete + */ struct DPP_EXPORT guild_role_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1292,7 +1378,9 @@ struct DPP_EXPORT guild_role_delete_t : public event_dispatch_t { snowflake role_id = {}; }; -/** @brief Channel pins update */ +/** + * @brief Channel pins update + */ struct DPP_EXPORT channel_pins_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1313,7 +1401,9 @@ struct DPP_EXPORT channel_pins_update_t : public event_dispatch_t { time_t timestamp = 0; }; -/** @brief Message remove all reactions */ +/** + * @brief Message remove all reactions + */ struct DPP_EXPORT message_reaction_remove_all_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1341,7 +1431,9 @@ struct DPP_EXPORT message_reaction_remove_all_t : public event_dispatch_t { }; -/** @brief Voice server update */ +/** + * @brief Voice server update + */ struct DPP_EXPORT voice_server_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1362,7 +1454,9 @@ struct DPP_EXPORT voice_server_update_t : public event_dispatch_t { std::string endpoint = {}; }; -/** @brief Guild emojis update */ +/** + * @brief Guild emojis update + */ struct DPP_EXPORT guild_emojis_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1392,7 +1486,9 @@ struct DPP_EXPORT presence_update_t : public event_dispatch_t { presence rich_presence = {}; }; -/** @brief Webhooks update */ +/** + * @brief Webhooks update + */ struct DPP_EXPORT webhooks_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1408,7 +1504,9 @@ struct DPP_EXPORT webhooks_update_t : public event_dispatch_t { channel* webhook_channel = nullptr; }; -/** @brief Guild member add */ +/** + * @brief Guild member add + */ struct DPP_EXPORT guild_member_add_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1424,7 +1522,9 @@ struct DPP_EXPORT guild_member_add_t : public event_dispatch_t { guild_member added = {}; }; -/** @brief Invite delete */ +/** + * @brief Invite delete + */ struct DPP_EXPORT invite_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1435,7 +1535,9 @@ struct DPP_EXPORT invite_delete_t : public event_dispatch_t { invite deleted_invite = {}; }; -/** @brief Guild update */ +/** + * @brief Guild update + */ struct DPP_EXPORT guild_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1446,7 +1548,9 @@ struct DPP_EXPORT guild_update_t : public event_dispatch_t { guild* updated = nullptr; }; -/** @brief Guild integrations update */ +/** + * @brief Guild integrations update + */ struct DPP_EXPORT guild_integrations_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1457,7 +1561,9 @@ struct DPP_EXPORT guild_integrations_update_t : public event_dispatch_t { guild* updating_guild = nullptr; }; -/** @brief Guild member update */ +/** + * @brief Guild member update + */ struct DPP_EXPORT guild_member_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1473,7 +1579,9 @@ struct DPP_EXPORT guild_member_update_t : public event_dispatch_t { guild_member updated = {}; }; -/** @brief Invite create */ +/** + * @brief Invite create + */ struct DPP_EXPORT invite_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1484,7 +1592,9 @@ struct DPP_EXPORT invite_create_t : public event_dispatch_t { invite created_invite = {}; }; -/** @brief Message update */ +/** + * @brief Message update + */ struct DPP_EXPORT message_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1495,7 +1605,9 @@ struct DPP_EXPORT message_update_t : public event_dispatch_t { message msg = {}; }; -/** @brief User update */ +/** + * @brief User update + */ struct DPP_EXPORT user_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1506,7 +1618,9 @@ struct DPP_EXPORT user_update_t : public event_dispatch_t { user updated = {}; }; -/** @brief Create message */ +/** + * @brief Create message + */ struct DPP_EXPORT message_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1562,7 +1676,9 @@ struct DPP_EXPORT message_create_t : public event_dispatch_t { void reply(message&& msg, bool mention_replied_user = false, command_completion_event_t callback = utility::log_error()) const; }; -/** @brief Guild audit log entry create */ +/** + * @brief Guild audit log entry create + */ struct DPP_EXPORT guild_audit_log_entry_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1573,7 +1689,9 @@ struct DPP_EXPORT guild_audit_log_entry_create_t : public event_dispatch_t { audit_entry entry = {}; }; -/** @brief Guild ban add */ +/** + * @brief Guild ban add + */ struct DPP_EXPORT guild_ban_add_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1589,7 +1707,9 @@ struct DPP_EXPORT guild_ban_add_t : public event_dispatch_t { user banned = {}; }; -/** @brief Guild ban remove */ +/** + * @brief Guild ban remove + */ struct DPP_EXPORT guild_ban_remove_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1605,7 +1725,9 @@ struct DPP_EXPORT guild_ban_remove_t : public event_dispatch_t { user unbanned = {}; }; -/** @brief Integration create */ +/** + * @brief Integration create + */ struct DPP_EXPORT integration_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1616,7 +1738,9 @@ struct DPP_EXPORT integration_create_t : public event_dispatch_t { integration created_integration = {}; }; -/** @brief Integration update */ +/** + * @brief Integration update + */ struct DPP_EXPORT integration_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1627,7 +1751,9 @@ struct DPP_EXPORT integration_update_t : public event_dispatch_t { integration updated_integration = {}; }; -/** @brief Integration delete */ +/** + * @brief Integration delete + */ struct DPP_EXPORT integration_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1638,7 +1764,9 @@ struct DPP_EXPORT integration_delete_t : public event_dispatch_t { integration deleted_integration = {}; }; -/** @brief Thread Create*/ +/** + * @brief Thread Create + */ struct DPP_EXPORT thread_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1654,8 +1782,9 @@ struct DPP_EXPORT thread_create_t : public event_dispatch_t { thread created = {}; }; -/** @brief Thread Update -*/ +/** + * @brief Thread Update + */ struct DPP_EXPORT thread_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1671,7 +1800,8 @@ struct DPP_EXPORT thread_update_t : public event_dispatch_t { thread updated = {}; }; -/** @brief Thread Delete +/** + * @brief Thread Delete */ struct DPP_EXPORT thread_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; @@ -1688,7 +1818,8 @@ struct DPP_EXPORT thread_delete_t : public event_dispatch_t { thread deleted = {}; }; -/** @brief Thread List Sync +/** + * @brief Thread List Sync */ struct DPP_EXPORT thread_list_sync_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; @@ -1710,7 +1841,8 @@ struct DPP_EXPORT thread_list_sync_t : public event_dispatch_t { std::vector members = {}; }; -/** @brief Thread Member Update +/** + * @brief Thread Member Update */ struct DPP_EXPORT thread_member_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; @@ -1722,7 +1854,8 @@ struct DPP_EXPORT thread_member_update_t : public event_dispatch_t { thread_member updated = {}; }; -/** @brief Thread Members Update +/** + * @brief Thread Members Update */ struct DPP_EXPORT thread_members_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; @@ -1773,7 +1906,9 @@ struct DPP_EXPORT voice_buffer_send_t : public event_dispatch_t { int buffer_size = 0; }; -/** @brief voice user talking */ +/** + * @brief voice user talking + */ struct DPP_EXPORT voice_user_talking_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1794,7 +1929,9 @@ struct DPP_EXPORT voice_user_talking_t : public event_dispatch_t { uint8_t talking_flags = 0; }; -/** @brief voice user talking */ +/** + * @brief voice user talking + */ struct DPP_EXPORT voice_ready_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1810,7 +1947,9 @@ struct DPP_EXPORT voice_ready_t : public event_dispatch_t { snowflake voice_channel_id = {}; }; -/** @brief voice receive packet */ +/** + * @brief voice receive packet + */ struct DPP_EXPORT voice_receive_t : public event_dispatch_t { friend class discord_voice_client; @@ -1882,7 +2021,9 @@ struct DPP_EXPORT voice_receive_t : public event_dispatch_t { void reassign(discord_voice_client* vc, snowflake _user_id, const uint8_t* pcm, size_t length); }; -/** @brief voice client speaking event */ +/** + * @brief voice client speaking event + */ struct DPP_EXPORT voice_client_speaking_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1903,7 +2044,9 @@ struct DPP_EXPORT voice_client_speaking_t : public event_dispatch_t { uint32_t ssrc = 0; }; -/** @brief voice client disconnect event */ +/** + * @brief voice client disconnect event + */ struct DPP_EXPORT voice_client_disconnect_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1919,7 +2062,9 @@ struct DPP_EXPORT voice_client_disconnect_t : public event_dispatch_t { snowflake user_id = {}; }; -/** @brief Delete stage instance */ +/** + * @brief Delete stage instance + */ struct DPP_EXPORT entitlement_create_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1930,7 +2075,9 @@ struct DPP_EXPORT entitlement_create_t : public event_dispatch_t { entitlement created = {}; }; -/** @brief Delete stage instance */ +/** + * @brief Delete stage instance + */ struct DPP_EXPORT entitlement_update_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; @@ -1941,7 +2088,9 @@ struct DPP_EXPORT entitlement_update_t : public event_dispatch_t { entitlement updating_entitlement = {}; }; -/** @brief Delete stage instance */ +/** + * @brief Delete stage instance + */ struct DPP_EXPORT entitlement_delete_t : public event_dispatch_t { using event_dispatch_t::event_dispatch_t; using event_dispatch_t::operator=; diff --git a/include/dpp/dtemplate.h b/include/dpp/dtemplate.h index 3c1bbb724a..098824e458 100644 --- a/include/dpp/dtemplate.h +++ b/include/dpp/dtemplate.h @@ -54,35 +54,43 @@ class DPP_EXPORT dtemplate : public json_interface { * @brief Template code */ std::string code; + /** * @brief Template name */ std::string name; + /** * @brief Template description */ std::string description; + /** * @brief Usage counter */ uint32_t usage_count; + /** * @brief User ID of creator */ snowflake creator_id; + /** * @brief Creation date/time * */ time_t created_at; + /** * @brief Last update date/time */ time_t updated_at; + /** * @brief Guild id the template is created from */ snowflake source_guild_id; + /** * @brief True if needs synchronising */ @@ -99,8 +107,9 @@ class DPP_EXPORT dtemplate : public json_interface { virtual ~dtemplate() = default; }; -/** A container of invites */ +/** + * @brief A container of invites + */ typedef std::unordered_map dtemplate_map; - } // namespace dpp diff --git a/include/dpp/emoji.h b/include/dpp/emoji.h index fff307d0f4..40b38b1571 100644 --- a/include/dpp/emoji.h +++ b/include/dpp/emoji.h @@ -37,13 +37,24 @@ namespace dpp { * @brief Flags for dpp::emoji */ enum emoji_flags : uint8_t { - /// Emoji requires colons + /** + * @brief Emoji requires colons. + */ e_require_colons = 0b00000001, - /// Managed (introduced by application) + + /** + * @brief Managed (introduced by application) + */ e_managed = 0b00000010, - /// Animated + + /** + * @brief Animated emoji. + */ e_animated = 0b00000100, - /// Available (false if the guild doesn't meet boosting criteria, etc) + + /** + * @brief Available (false if the guild doesn't meet boosting criteria, etc) + */ e_available = 0b00001000, }; diff --git a/include/dpp/entitlement.h b/include/dpp/entitlement.h index e1cfab8818..dd7d1ae0d5 100644 --- a/include/dpp/entitlement.h +++ b/include/dpp/entitlement.h @@ -39,11 +39,13 @@ enum entitlement_type : uint8_t { * @warning This can only be used when creating a test entitlement. */ GUILD_SUBSCRIPTION = 1, + /** * @brief A subscription for a user. * @warning This can only be used when creating a test entitlement. */ USER_SUBSCRIPTION = 2, + /** * @brief Entitlement was purchased as an app subscription. */ diff --git a/include/dpp/etf.h b/include/dpp/etf.h index 28e3806a3d..8e17ca3a96 100644 --- a/include/dpp/etf.h +++ b/include/dpp/etf.h @@ -39,7 +39,9 @@ namespace dpp { -/** Current ETF format version in use */ +/** + * @brief Current ETF format version in use + */ const uint8_t FORMAT_VERSION = 131; /** @@ -47,60 +49,142 @@ const uint8_t FORMAT_VERSION = 131; * in the ETF binary structure. */ enum etf_token_type : uint8_t { - /// 68 [Distribution header] - ett_distribution = 'D', - /// 70 [Float64:IEEE float] - ett_new_float = 'F', - /// 77 [UInt32:Len, UInt8:Bits, Len:Data] - ett_bit_binary = 'M', - /// 80 [UInt4:UncompressedSize, N:ZlibCompressedData] - ett_compressed = 'P', - /// 97 [UInt8:Int] - ett_smallint = 'a', - /// 98 [Int32:Int] - ett_integer = 'b', - /// 99 [31:Float String] Float in string format (formatted "%.20e", sscanf "%lf"). Superseded by ett_new_float - ett_float = 'c', - /// 100 [UInt16:Len, Len:AtomName] max Len is 255 - ett_atom = 'd', - /// 101 [atom:Node, UInt32:ID, UInt8:Creation] - ett_reference = 'e', - /// 102 [atom:Node, UInt32:ID, UInt8:Creation] - ett_port = 'f', - /// 103 [atom:Node, UInt32:ID, UInt32:Serial, UInt8:Creation] - ett_pid = 'g', - /// 104 [UInt8:Arity, N:Elements] - ett_small_tuple = 'h', - /// 105 [UInt32:Arity, N:Elements] - ett_large_tuple = 'i', - /// 106 empty list - ett_nil = 'j', - /// 107 [UInt16:Len, Len:Characters] - ett_string = 'k', - /// 108 [UInt32:Len, Elements, Tail] - ett_list = 'l', - /// 109 [UInt32:Len, Len:Data] - ett_binary = 'm', - /// 110 [UInt8:n, UInt8:Sign, n:nums] - ett_bigint_small = 'n', - /// 111 [UInt32:n, UInt8:Sign, n:nums] - ett_bigint_large = 'o', - /// 112 [UInt32:Size, UInt8:Arity, 16*Uint6-MD5:Uniq, UInt32:Index, UInt32:NumFree, atom:Module, int:OldIndex, int:OldUniq, pid:Pid, NunFree*ext:FreeVars] - ett_new_function = 'p', - /// 113 [atom:Module, atom:Function, smallint:Arity] - ett_export = 'q', - /// 114 [UInt16:Len, atom:Node, UInt8:Creation, Len*UInt32:ID] - ett_new_reference = 'r', - /// 115 [UInt8:Len, Len:AtomName] - ett_atom_small = 's', - /// 116 [UInt32:Airty, N:Pairs] - ett_map = 't', - /// 117 [UInt4:NumFree, pid:Pid, atom:Module, int:Index, int:Uniq, NumFree*ext:FreeVars] - ett_function = 'u', - /// 118 [UInt16:Len, Len:AtomName] max Len is 255 characters (up to 4 bytes per) - ett_atom_utf8 = 'v', - /// 119 [UInt8:Len, Len:AtomName] - ett_atom_utf8_small = 'w' + /** + * @brief 68 [Distribution header] + */ + ett_distribution = 'D', + + /** + * @brief 70 [Float64:IEEE float] + */ + ett_new_float = 'F', + + /** + * @brief 77 [UInt32:Len, UInt8:Bits, Len:Data] + */ + ett_bit_binary = 'M', + + /** + * @brief 80 [UInt4:UncompressedSize, N:ZlibCompressedData] + */ + ett_compressed = 'P', + + /** + * @brief 97 [UInt8:Int] + */ + ett_smallint = 'a', + + /** + * @brief 98 [Int32:Int] + */ + ett_integer = 'b', + + /** + * @brief 99 [31:Float String] Float in string format (formatted "%.20e", sscanf "%lf"). + * + * @note Superseded by ett_new_float. + */ + ett_float = 'c', + + /** + * @brief 100 [UInt16:Len, Len:AtomName] max Len is 255 + */ + ett_atom = 'd', + + /** + * @brief 101 [atom:Node, UInt32:ID, UInt8:Creation] + */ + ett_reference = 'e', + + /** + * @brief 102 [atom:Node, UInt32:ID, UInt8:Creation] + */ + ett_port = 'f', + + /** + * @brief 103 [atom:Node, UInt32:ID, UInt32:Serial, UInt8:Creation] + */ + ett_pid = 'g', + + /** + * @brief 104 [UInt8:Arity, N:Elements] + */ + ett_small_tuple = 'h', + + /** + * @brief 105 [UInt32:Arity, N:Elements] + */ + ett_large_tuple = 'i', + + /** + * @brief 106 empty list + */ + ett_nil = 'j', + + /** + * @brief 107 [UInt16:Len, Len:Characters] + */ + ett_string = 'k', + + /** + * @brief 108 [UInt32:Len, Elements, Tail] + */ + ett_list = 'l', + + /** + * @brief 109 [UInt32:Len, Len:Data] + */ + ett_binary = 'm', + + /** + * @brief 110 [UInt8:n, UInt8:Sign, n:nums] + */ + ett_bigint_small = 'n', + + /** + * @brief 111 [UInt32:n, UInt8:Sign, n:nums] + */ + ett_bigint_large = 'o', + + /** + * @brief 112 [UInt32:Size, UInt8:Arity, 16*Uint6-MD5:Uniq, UInt32:Index, UInt32:NumFree, atom:Module, int:OldIndex, int:OldUniq, pid:Pid, NunFree*ext:FreeVars] + */ + ett_new_function = 'p', + + /** + * @brief 113 [atom:Module, atom:Function, smallint:Arity] + */ + ett_export = 'q', + + /** + * @brief 114 [UInt16:Len, atom:Node, UInt8:Creation, Len*UInt32:ID] + */ + ett_new_reference = 'r', + + /** + * @brief 115 [UInt8:Len, Len:AtomName] + */ + ett_atom_small = 's', + + /** + * @brief 116 [UInt32:Airty, N:Pairs] + */ + ett_map = 't', + + /** + * @brief 117 [UInt4:NumFree, pid:Pid, atom:Module, int:Index, int:Uniq, NumFree*ext:FreeVars] + */ + ett_function = 'u', + + /** + * @brief 118 [UInt16:Len, Len:AtomName] max Len is 255 characters (up to 4 bytes per) + */ + ett_atom_utf8 = 'v', + + /** + * @brief 119 [UInt8:Len, Len:AtomName] + */ + ett_atom_utf8_small = 'w' }; /** @@ -111,6 +195,7 @@ struct DPP_EXPORT etf_buffer { * @brief Raw buffer */ std::vector buf; + /** * @brief Current used length of buffer * (this is different from buf.size() as it is pre-allocated @@ -137,7 +222,6 @@ struct DPP_EXPORT etf_buffer { * have to be any different for handling ETF. */ class DPP_EXPORT etf_parser { - /** * @brief Current size of binary data */ diff --git a/include/dpp/event.h b/include/dpp/event.h index b9b3f003f7..fe6df9bb45 100644 --- a/include/dpp/event.h +++ b/include/dpp/event.h @@ -38,7 +38,8 @@ namespace dpp::events { */ class DPP_EXPORT event { public: - /** Pure virtual method for event handler code + /** + * @brief Pure virtual method for event handler code * @param client The creating shard * @param j The json data of the event * @param raw The raw event json diff --git a/include/dpp/event_router.h b/include/dpp/event_router.h index 027f25a0fc..5a16aaa74b 100644 --- a/include/dpp/event_router.h +++ b/include/dpp/event_router.h @@ -201,10 +201,15 @@ template class event_router_t { private: friend class cluster; - /** @brief Non-coro event handler type */ + /** + * @brief Non-coro event handler type + */ using regular_handler_t = std::function; - /** @brief Type that event handlers will be stored as with DPP_CORO off. This is the ABI DPP_CORO has to match */ + /** + * @brief Type that event handlers will be stored as with DPP_CORO off. + * This is the ABI DPP_CORO has to match. + */ using event_handler_abi_t = std::variant>; #ifdef DPP_CORO @@ -218,11 +223,15 @@ template class event_router_t { DPP_CHECK_ABI_COMPAT(event_handler_t, event_handler_abi_t) #else - /** @brief Type that event handlers are stored as */ + /** + * @brief Type that event handlers are stored as + */ using event_handler_t = event_handler_abi_t; #endif - /** @brief Identifier for the next event handler, will be given to the user on attaching a handler */ + /** + * @brief Identifier for the next event handler, will be given to the user on attaching a handler + */ event_handle next_handle = 1; /** From 31976ecb23084b0e61020b59e6f29d8ac29324b6 Mon Sep 17 00:00:00 2001 From: Miuna <809711+Mishura4@users.noreply.github.com> Date: Tue, 31 Oct 2023 10:56:50 -0400 Subject: [PATCH 5/5] fix: exorcised the scary head. halloween is over (#980) --- include/dpp/cluster.h | 4 +-- include/dpp/export.h | 56 +++++++++++++++++++++++++++++++++++++++ include/dpp/restresults.h | 30 --------------------- src/dpp/cluster.cpp | 42 ++++++++++++++++++++++------- 4 files changed, 90 insertions(+), 42 deletions(-) diff --git a/include/dpp/cluster.h b/include/dpp/cluster.h index d74a69472a..f7cec818c4 100644 --- a/include/dpp/cluster.h +++ b/include/dpp/cluster.h @@ -231,12 +231,12 @@ class DPP_EXPORT cluster { /** * @brief dpp::cluster is non-copyable */ - cluster& operator=(const cluster&) = delete; + cluster& operator=(const cluster&) = delete; /** * @brief dpp::cluster is non-moveable */ - cluster& operator=(const cluster&&) = delete; + cluster& operator=(const cluster&&) = delete; /** * @brief Destroy the cluster object diff --git a/include/dpp/export.h b/include/dpp/export.h index c8ba8f6f69..24d6bfe81a 100644 --- a/include/dpp/export.h +++ b/include/dpp/export.h @@ -59,6 +59,62 @@ #define DPP_EXPORT #endif +namespace dpp { + +/** + * @brief Represents a build configuration. On some platforms (e.g. Windows) release isn't compatible with debug, so we use this enum to detect it. + */ +enum class build_type { + /** + * @brief Universal build, works with both debug and release + */ + universal, + + /** + * @brief Debug build + */ + debug, + + /** + * @brief Release build + */ + release +}; + +template +extern bool DPP_EXPORT validate_configuration(); + +#if defined(UE_BUILD_DEBUG) || defined(UE_BUILD_DEVELOPMENT) || defined(UE_BUILD_TEST) || defined(UE_BUILD_SHIPPING) || defined(UE_GAME) || defined(UE_EDITOR) || defined(UE_BUILD_SHIPPING_WITH_EDITOR) || defined(UE_BUILD_DOCS) + /* + * We need to tell DPP to NOT do the version checker if something from Unreal Engine is defined. + * We have to do this because UE is causing some weirdness where the version checker is broken and always errors. + * This is really only for DPP-UE. There is no reason to not do the version checker unless you are in Unreal Engine. + */ + #define DPP_BYPASS_VERSION_CHECKING +#endif /* UE */ + +#ifndef DPP_BUILD /* when including dpp */ + /** + * Version checking, making sure the program is in a configuration compatible with DPP's. + * + * Do NOT make these variables constexpr. + * We want them to initialize at runtime so the function can be pulled from the shared library object. + */ + #ifndef DPP_BYPASS_VERSION_CHECKING + #if defined(_WIN32) + #ifdef _DEBUG + inline const bool is_valid_config = validate_configuration(); + #else + inline const bool is_valid_config = validate_configuration(); + #endif /* _DEBUG */ + #else + inline const bool is_valid_config = validate_configuration(); + #endif /* _WIN32 */ + #endif /* !DPP_BYPASS_VERSION_CHECKING */ +#endif /* !DPP_BUILD */ + +} + #ifndef _WIN32 #define SOCKET int #else diff --git a/include/dpp/restresults.h b/include/dpp/restresults.h index a340b50ebc..f38da6de52 100644 --- a/include/dpp/restresults.h +++ b/include/dpp/restresults.h @@ -48,36 +48,6 @@ namespace dpp { -#ifdef _WIN32 - #ifdef _DEBUG - extern "C" DPP_EXPORT void you_are_using_a_debug_build_of_dpp_on_a_release_project(); - #else - extern "C" DPP_EXPORT void you_are_using_a_release_build_of_dpp_on_a_debug_project(); - #endif -#endif - -struct DPP_EXPORT version_checker { - version_checker() { - #ifdef _WIN32 - #ifdef _DEBUG - you_are_using_a_debug_build_of_dpp_on_a_release_project(); - #else - you_are_using_a_release_build_of_dpp_on_a_debug_project(); - #endif - #endif - } -}; - -/* - * We need to tell DPP to NOT do the version checker if something from Unreal Engine is defined. - * We have to do this because UE is causing some weirdness where the version checker is broken and always errors. - * This is really only for DPP-UE. There is no reason to not do the version checker unless you are in Unreal Engine. - */ -#if !defined(UE_BUILD_DEBUG) && !defined(UE_BUILD_DEVELOPMENT) && !defined(UE_BUILD_TEST) && !defined(UE_BUILD_SHIPPING) && !defined(UE_GAME) && !defined(UE_EDITOR) && !defined(UE_BUILD_SHIPPING_WITH_EDITOR) && !defined(UE_BUILD_DOCS) -static version_checker dpp_vc; -#endif - - /** * @brief A list of shards */ diff --git a/src/dpp/cluster.cpp b/src/dpp/cluster.cpp index 05e5e9ba17..7077ae48c1 100644 --- a/src/dpp/cluster.cpp +++ b/src/dpp/cluster.cpp @@ -35,16 +35,6 @@ namespace dpp { -#ifdef _WIN32 - #ifdef _DEBUG - extern "C" void you_are_using_a_debug_build_of_dpp_on_a_release_project() { - } - #else - extern "C" void you_are_using_a_release_build_of_dpp_on_a_debug_project() { - } - #endif -#endif - /** * @brief An audit reason for each thread. These are per-thread to make the cluster * methods like cluster::get_audit_reason and cluster::set_audit_reason thread safe across @@ -70,6 +60,38 @@ template std::function make_intent_warning(cluster* }; } +template +bool validate_configuration() { +#ifdef _DEBUG + constexpr build_type expected = build_type::debug; +#else + constexpr build_type expected = build_type::release; +#endif +#ifdef _WIN32 + if constexpr (BuildType != build_type::universal && BuildType != expected) { + MessageBox( + nullptr, + "Mismatched Debug/Release configurations between project and dpp.dll.\n" + "Please ensure both your program and the D++ DLL file are both using the same configuration.\n" + "The program will now terminate.", + "D++ Debug/Release mismatch", + MB_OK | MB_ICONERROR + ); + /* Use std::runtime_rror here because dpp exceptions use std::string and that would crash when catching, because of ABI */ + throw std::runtime_error("Mismatched Debug/Release configurations between project and dpp.dll"); + } + return true; +#else + return true; +#endif +} + +template bool DPP_EXPORT validate_configuration(); + +template bool DPP_EXPORT validate_configuration(); + +template bool DPP_EXPORT validate_configuration(); + cluster::cluster(const std::string &_token, uint32_t _intents, uint32_t _shards, uint32_t _cluster_id, uint32_t _maxclusters, bool comp, cache_policy_t policy, uint32_t request_threads, uint32_t request_threads_raw) : default_gateway("gateway.discord.gg"), rest(nullptr), raw_rest(nullptr), compressed(comp), start_time(0), token(_token), last_identify(time(nullptr) - 5), intents(_intents), numshards(_shards), cluster_id(_cluster_id), maxclusters(_maxclusters), rest_ping(0.0), cache_policy(policy), ws_mode(ws_json)