Skip to content

Commit

Permalink
feat: added coro calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 committed Oct 11, 2023
1 parent 653e1c3 commit d14544c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
23 changes: 23 additions & 0 deletions include/dpp/cluster_coro_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@
*/
[[nodiscard]] async<confirmation_callback_t> co_global_bulk_command_create(const std::vector<slashcommand> &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<confirmation_callback_t> co_global_bulk_command_delete();

/**
* @brief Create a global slash command (a bot can have a maximum of 100 of these).
*
Expand Down Expand Up @@ -108,6 +119,18 @@
*/
[[nodiscard]] async<confirmation_callback_t> co_guild_bulk_command_create(const std::vector<slashcommand> &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<confirmation_callback_t> co_guild_bulk_command_delete(snowflake guild_id);

/**
* @brief Get all slash command permissions of a guild
*
Expand Down
8 changes: 8 additions & 0 deletions src/dpp/cluster_coro_calls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ async<confirmation_callback_t> cluster::co_global_bulk_command_create(const std:
return async{ this, static_cast<void (cluster::*)(const std::vector<slashcommand> &, command_completion_event_t)>(&cluster::global_bulk_command_create), commands };
}

async<confirmation_callback_t> cluster::co_global_bulk_command_delete() {
return async{ this, static_cast<void (cluster::*)(command_completion_event_t)>(&cluster::global_bulk_command_delete) };
}

async<confirmation_callback_t> cluster::co_global_command_create(const slashcommand &s) {
return async{ this, static_cast<void (cluster::*)(const slashcommand &, command_completion_event_t)>(&cluster::global_command_create), s };
}
Expand All @@ -63,6 +67,10 @@ async<confirmation_callback_t> cluster::co_guild_bulk_command_create(const std::
return async{ this, static_cast<void (cluster::*)(const std::vector<slashcommand> &, snowflake, command_completion_event_t)>(&cluster::guild_bulk_command_create), commands, guild_id };
}

async<confirmation_callback_t> cluster::co_guild_bulk_command_delete(snowflake guild_id) {
return async{ this, static_cast<void (cluster::*)(snowflake, command_completion_event_t)>(&cluster::guild_bulk_command_delete), guild_id };
}

async<confirmation_callback_t> cluster::co_guild_commands_get_permissions(snowflake guild_id) {
return async{ this, static_cast<void (cluster::*)(snowflake, command_completion_event_t)>(&cluster::guild_commands_get_permissions), guild_id };
}
Expand Down

0 comments on commit d14544c

Please sign in to comment.