From 8a0ac6316429ce5fa06ccd58b6d17aa82d14f75a Mon Sep 17 00:00:00 2001 From: Jaskowicz1 Date: Sun, 8 Oct 2023 21:05:55 +0100 Subject: [PATCH] feat: added thread_get for threads --- include/dpp/cluster.h | 9 +++++++++ src/dpp/cluster/thread.cpp | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/include/dpp/cluster.h b/include/dpp/cluster.h index 55d8bc6b8f..d7aebdcfcb 100644 --- a/include/dpp/cluster.h +++ b/include/dpp/cluster.h @@ -3314,6 +3314,15 @@ class DPP_EXPORT cluster { */ void threads_get_joined_private_archived(snowflake channel_id, snowflake before_id, uint16_t limit, command_completion_event_t callback); + /** + * @brief Get the thread specified by thread_id. This uses the same call as dpp::cluster::channel_get but returns a thread object. + * @see https://discord.com/developers/docs/resources/channel#get-channel + * @param thread_id The id of the thread to obtain. + * @param callback Function to call when the API call completes + * On success the callback will contain a dpp::thread 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 thread_get(snowflake thread_id, command_completion_event_t callback); + /** * @brief Create a sticker in a guild * @note This method supports audit log reasons set by the cluster::set_audit_reason() method. diff --git a/src/dpp/cluster/thread.cpp b/src/dpp/cluster/thread.cpp index 54f4a1b79b..8c0dab0fce 100644 --- a/src/dpp/cluster/thread.cpp +++ b/src/dpp/cluster/thread.cpp @@ -160,4 +160,8 @@ void cluster::thread_member_remove(snowflake thread_id, snowflake user_id, comma rest_request(this, API_PATH "/channels", std::to_string(thread_id), "/thread-members/" + std::to_string(user_id), m_delete, "", callback); } +void cluster::thread_get(snowflake thread_id, command_completion_event_t callback) { + rest_request(this, API_PATH "/channels", std::to_string(thread_id), "", m_get, "", callback); +} + } // namespace dpp