Skip to content

Commit

Permalink
feat: Added the ability to set voice channel statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 committed Jan 12, 2024
1 parent 468a197 commit c812539
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -3703,6 +3703,17 @@ class DPP_EXPORT cluster {
*/
void skus_get(command_completion_event_t callback = utility::log_error());

/**
* @brief Set the status of a voice channel.
*
* @see https://github.com/discord/discord-api-docs/pull/6400 (please replace soon).
* @param channel_id The channel to update.
* @param status The new status for the channel.
* @param callback Function to call when the API call completes.
* On success the callback will contain a dpp::confirmation object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error().
*/
void channel_set_voice_status(snowflake channel_id, const std::string& status, command_completion_event_t callback = utility::log_error());

#include <dpp/cluster_sync_calls.h>
#ifdef DPP_CORO
#include <dpp/cluster_coro_calls.h>
Expand Down
5 changes: 5 additions & 0 deletions src/dpp/cluster/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,9 @@ void cluster::channels_get(snowflake guild_id, command_completion_event_t callba
rest_request_list<channel>(this, API_PATH "/guilds", std::to_string(guild_id), "channels", m_get, "", callback);
}

void cluster::channel_set_voice_status(snowflake channel_id, const std::string& status, command_completion_event_t callback) {
json j({ {"status", status} });
rest_request_list<confirmation>(this, API_PATH "/channels", std::to_string(channel_id), "voice-status", m_put, j.dump(), callback);
}

} // namespace dpp

0 comments on commit c812539

Please sign in to comment.