From d14544c62260a201b9f295b672ad44d3d58dbae2 Mon Sep 17 00:00:00 2001 From: Jaskowicz1 Date: Wed, 11 Oct 2023 07:39:22 +0100 Subject: [PATCH] feat: added coro calls --- include/dpp/cluster_coro_calls.h | 23 +++++++++++++++++++++++ src/dpp/cluster_coro_calls.cpp | 8 ++++++++ 2 files changed, 31 insertions(+) diff --git a/include/dpp/cluster_coro_calls.h b/include/dpp/cluster_coro_calls.h index b98d914642..7754c69758 100644 --- a/include/dpp/cluster_coro_calls.h +++ b/include/dpp/cluster_coro_calls.h @@ -40,6 +40,17 @@ */ [[nodiscard]] async co_global_bulk_command_create(const std::vector &commands); +/** + * @brief Delete all existing global slash commands. + * Updates will be available in all guilds after 1 hour. + * + * @see dpp::cluster::global_bulk_command_delete + * @see https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands + * @return slashcommand_map returned object on completion + * \memberof dpp::cluster + */ +[[nodiscard]] async co_global_bulk_command_delete(); + /** * @brief Create a global slash command (a bot can have a maximum of 100 of these). * @@ -108,6 +119,18 @@ */ [[nodiscard]] async co_guild_bulk_command_create(const std::vector &commands, snowflake guild_id); +/** + * @brief Delete all existing guild slash commands. + * Updates will be available in all guilds after 1 hour. + * + * @see dpp::cluster::guild_bulk_command_delete + * @see https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands + * @param guild_id Guild ID to delete the slash commands in. + * @return slashcommand_map returned object on completion + * \memberof dpp::cluster + */ +[[nodiscard]] async co_guild_bulk_command_delete(snowflake guild_id); + /** * @brief Get all slash command permissions of a guild * diff --git a/src/dpp/cluster_coro_calls.cpp b/src/dpp/cluster_coro_calls.cpp index 32edde0e17..9deb0d865c 100644 --- a/src/dpp/cluster_coro_calls.cpp +++ b/src/dpp/cluster_coro_calls.cpp @@ -39,6 +39,10 @@ async cluster::co_global_bulk_command_create(const std: return async{ this, static_cast &, command_completion_event_t)>(&cluster::global_bulk_command_create), commands }; } +async cluster::co_global_bulk_command_delete() { + return async{ this, static_cast(&cluster::global_bulk_command_delete) }; +} + async cluster::co_global_command_create(const slashcommand &s) { return async{ this, static_cast(&cluster::global_command_create), s }; } @@ -63,6 +67,10 @@ async cluster::co_guild_bulk_command_create(const std:: return async{ this, static_cast &, snowflake, command_completion_event_t)>(&cluster::guild_bulk_command_create), commands, guild_id }; } +async cluster::co_guild_bulk_command_delete(snowflake guild_id) { + return async{ this, static_cast(&cluster::guild_bulk_command_delete), guild_id }; +} + async cluster::co_guild_commands_get_permissions(snowflake guild_id) { return async{ this, static_cast(&cluster::guild_commands_get_permissions), guild_id }; }